{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/56751928","id":56751928,"diff_hunk":"@@ -192,27 +196,41 @@ def run(args):\n   variables = conf['variables']\n   target_defaults = conf['target_defaults']\n \n-  # argv[2] is a custom install prefix for packagers (think DESTDIR)\n-  # argv[3] is a custom install prefix (think PREFIX)\n+  # args[1] is a custom install prefix for packagers (think DESTDIR)\n+  # args[2] is a custom install prefix (think PREFIX)\n   # Difference is that dst_dir won't be included in shebang lines etc.\n-  dst_dir = args[2] if len(args) > 2 else ''\n+  dst_dir = args[1] if len(args) > 1 else ''\n \n-  if len(args) > 3:\n-    node_prefix = args[3]\n+  if len(args) > 2:\n+    node_prefix = args[2]\n \n   # install_path thus becomes the base target directory.\n   install_path = dst_dir + node_prefix + '/'\n \n-  cmd = args[1] if len(args) > 1 else 'install'\n+  cmd = args[0].lower() if len(args) else 'install'\n \n-  if os.environ.get('HEADERS_ONLY'):\n-    if cmd == 'install': return headers(install)\n-    if cmd == 'uninstall': return headers(uninstall)\n-  else:\n-    if cmd == 'install': return files(install)\n-    if cmd == 'uninstall': return files(uninstall)\n+  if cmd not in ('install', 'uninstall'):\n+    raise RuntimeError('Bad command: %s\\n' % cmd)\n+\n+  for option, value in opts:\n+    if option in ('-c', '--components'):\n+      value = (value.lower() or 'node,npm,headers').split(',')\n+      components.intersection_update([v for v in value if v in components])\n+\n+  # Even if NPM is not asked to install, if \"node_install_npm\" is set, then\n+  # install npm_files anyway, unless it is 'headers' installation\n+  if 'headers' not in components and 'true' == variables.get('node_install_npm'):\n+    components.update(['npm'])\n+\n+  files(components, install if cmd == 'install' else uninstall)\n \n-  raise RuntimeError('Bad command: %s\\n' % cmd)\n \n if __name__ == '__main__':\n-  run(sys.argv[:])\n+\n+  try:\n+    opts, args = getopt.getopt(sys.argv[1:], 'c:', ['components='])","path":"tools/install.py","position":null,"original_position":104,"commit_id":"25f9b5460e1d4cc8b160cd0d72facba197921c79","original_commit_id":"d47fa49120abc3f95519ee898df6a4b4d998830d","user":{"login":"thefourtheye","id":696611,"avatar_url":"https://avatars.githubusercontent.com/u/696611?v=3","gravatar_id":"","url":"https://api.github.com/users/thefourtheye","html_url":"https://github.com/thefourtheye","followers_url":"https://api.github.com/users/thefourtheye/followers","following_url":"https://api.github.com/users/thefourtheye/following{/other_user}","gists_url":"https://api.github.com/users/thefourtheye/gists{/gist_id}","starred_url":"https://api.github.com/users/thefourtheye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thefourtheye/subscriptions","organizations_url":"https://api.github.com/users/thefourtheye/orgs","repos_url":"https://api.github.com/users/thefourtheye/repos","events_url":"https://api.github.com/users/thefourtheye/events{/privacy}","received_events_url":"https://api.github.com/users/thefourtheye/received_events","type":"User","site_admin":false},"body":"I switched to `optparse` now. I thought its better to be consistent.","created_at":"2016-03-19T17:20:25Z","updated_at":"2016-03-19T17:20:25Z","html_url":"https://github.com/nodejs/node/pull/5741#discussion_r56751928","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/5741","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/56751928"},"html":{"href":"https://github.com/nodejs/node/pull/5741#discussion_r56751928"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/5741"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/5741","id":63108908,"html_url":"https://github.com/nodejs/node/pull/5741","diff_url":"https://github.com/nodejs/node/pull/5741.diff","patch_url":"https://github.com/nodejs/node/pull/5741.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/5741","number":5741,"state":"open","locked":false,"title":"tools: install components optionally","user":{"login":"thefourtheye","id":696611,"avatar_url":"https://avatars.githubusercontent.com/u/696611?v=3","gravatar_id":"","url":"https://api.github.com/users/thefourtheye","html_url":"https://github.com/thefourtheye","followers_url":"https://api.github.com/users/thefourtheye/followers","following_url":"https://api.github.com/users/thefourtheye/following{/other_user}","gists_url":"https://api.github.com/users/thefourtheye/gists{/gist_id}","starred_url":"https://api.github.com/users/thefourtheye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thefourtheye/subscriptions","organizations_url":"https://api.github.com/users/thefourtheye/orgs","repos_url":"https://api.github.com/users/thefourtheye/repos","events_url":"https://api.github.com/users/thefourtheye/events{/privacy}","received_events_url":"https://api.github.com/users/thefourtheye/received_events","type":"User","site_admin":false},"body":"### Pull Request check-list\r\n\r\n- [x] Does `make -j8 test` (UNIX) or `vcbuild test nosign` (Windows) pass with\r\n  this change (including linting)?\r\n- [x] Is the commit message formatted according to [CONTRIBUTING.md][0]?\r\n\r\n### Affected core subsystem(s)\r\n\r\ntools\r\n\r\n[0]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit\r\n\r\n### Description of change\r\n\r\nRefer: https://github.com/nodejs/node/pull/5734\r\n\r\nThis introduces a command line option, ('-c' or '--components')  to\r\ninstall components optionally. The valid components are\r\n\r\n  * node\r\n  * npm\r\n  * headers\r\n\r\nAll these components can be installed or uninstalled, like this\r\n\r\n    python tools/install.py -c node,headers install . /\r\n\r\n    python tools/install.py --components npm uninstall . /\r\n\r\n\"-c\" is just the short form of \"--components\"\r\n\r\n-----\r\n\r\ncc @rvagg @bnoordhuis ","created_at":"2016-03-16T17:59:03Z","updated_at":"2016-03-19T17:20:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36bb7316dde80e872c74c2517ee9870305d7a872","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/5741/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/5741/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/5741/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/25f9b5460e1d4cc8b160cd0d72facba197921c79","head":{"label":"thefourtheye:install-seperate-components","ref":"install-seperate-components","sha":"25f9b5460e1d4cc8b160cd0d72facba197921c79","user":{"login":"thefourtheye","id":696611,"avatar_url":"https://avatars.githubusercontent.com/u/696611?v=3","gravatar_id":"","url":"https://api.github.com/users/thefourtheye","html_url":"https://github.com/thefourtheye","followers_url":"https://api.github.com/users/thefourtheye/followers","following_url":"https://api.github.com/users/thefourtheye/following{/other_user}","gists_url":"https://api.github.com/users/thefourtheye/gists{/gist_id}","starred_url":"https://api.github.com/users/thefourtheye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thefourtheye/subscriptions","organizations_url":"https://api.github.com/users/thefourtheye/orgs","repos_url":"https://api.github.com/users/thefourtheye/repos","events_url":"https://api.github.com/users/thefourtheye/events{/privacy}","received_events_url":"https://api.github.com/users/thefourtheye/received_events","type":"User","site_admin":false},"repo":{"id":35113605,"name":"io.js","full_name":"thefourtheye/io.js","owner":{"login":"thefourtheye","id":696611,"avatar_url":"https://avatars.githubusercontent.com/u/696611?v=3","gravatar_id":"","url":"https://api.github.com/users/thefourtheye","html_url":"https://github.com/thefourtheye","followers_url":"https://api.github.com/users/thefourtheye/followers","following_url":"https://api.github.com/users/thefourtheye/following{/other_user}","gists_url":"https://api.github.com/users/thefourtheye/gists{/gist_id}","starred_url":"https://api.github.com/users/thefourtheye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thefourtheye/subscriptions","organizations_url":"https://api.github.com/users/thefourtheye/orgs","repos_url":"https://api.github.com/users/thefourtheye/repos","events_url":"https://api.github.com/users/thefourtheye/events{/privacy}","received_events_url":"https://api.github.com/users/thefourtheye/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thefourtheye/io.js","description":"A friendly fork of Node.js with an open governance model","fork":true,"url":"https://api.github.com/repos/thefourtheye/io.js","forks_url":"https://api.github.com/repos/thefourtheye/io.js/forks","keys_url":"https://api.github.com/repos/thefourtheye/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thefourtheye/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thefourtheye/io.js/teams","hooks_url":"https://api.github.com/repos/thefourtheye/io.js/hooks","issue_events_url":"https://api.github.com/repos/thefourtheye/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/thefourtheye/io.js/events","assignees_url":"https://api.github.com/repos/thefourtheye/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/thefourtheye/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/thefourtheye/io.js/tags","blobs_url":"https://api.github.com/repos/thefourtheye/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thefourtheye/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thefourtheye/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/thefourtheye/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thefourtheye/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/thefourtheye/io.js/languages","stargazers_url":"https://api.github.com/repos/thefourtheye/io.js/stargazers","contributors_url":"https://api.github.com/repos/thefourtheye/io.js/contributors","subscribers_url":"https://api.github.com/repos/thefourtheye/io.js/subscribers","subscription_url":"https://api.github.com/repos/thefourtheye/io.js/subscription","commits_url":"https://api.github.com/repos/thefourtheye/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/thefourtheye/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/thefourtheye/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/thefourtheye/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/thefourtheye/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/thefourtheye/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thefourtheye/io.js/merges","archive_url":"https://api.github.com/repos/thefourtheye/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thefourtheye/io.js/downloads","issues_url":"https://api.github.com/repos/thefourtheye/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/thefourtheye/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/thefourtheye/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/thefourtheye/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thefourtheye/io.js/labels{/name}","releases_url":"https://api.github.com/repos/thefourtheye/io.js/releases{/id}","deployments_url":"https://api.github.com/repos/thefourtheye/io.js/deployments","created_at":"2015-05-05T17:20:53Z","updated_at":"2015-05-05T17:20:56Z","pushed_at":"2016-03-19T17:18:48Z","git_url":"git://github.com/thefourtheye/io.js.git","ssh_url":"git@github.com:thefourtheye/io.js.git","clone_url":"https://github.com/thefourtheye/io.js.git","svn_url":"https://github.com/thefourtheye/io.js","homepage":"https://iojs.org","size":181121,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"f9e6191f8582e0ec6f1ff64da454988423e0cb89","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-03-19T17:11:57Z","pushed_at":"2016-03-19T17:18:49Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":226036,"stargazers_count":21236,"watchers_count":21236,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2784,"mirror_url":null,"open_issues_count":761,"forks":2784,"open_issues":761,"watchers":21236,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/5741"},"html":{"href":"https://github.com/nodejs/node/pull/5741"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/5741"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/5741/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/5741/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/5741/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/25f9b5460e1d4cc8b160cd0d72facba197921c79"}}}}