{"action":"created","comment":{"url":"https://api.github.com/repos/pypa/pip/pulls/comments/36541010","id":36541010,"diff_hunk":"@@ -0,0 +1,162 @@\n+from __future__ import absolute_import\n+\n+import logging\n+import os\n+\n+from pip.req import RequirementSet\n+from pip.basecommand import RequirementCommand\n+from pip.index import PackageFinder\n+from pip import cmdoptions\n+from pip.utils.build import BuildDirectory\n+from pip.utils.filesystem import check_path_owner\n+\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+class DownloadCommand(RequirementCommand):\n+    \"\"\"\n+    Download packages from:\n+\n+    - PyPI (and other indexes) using requirement specifiers.\n+    - VCS project urls.\n+    - Local project directories.\n+    - Local or remote source archives.\n+\n+    pip also supports downloading from \"requirements files\", which provide\n+    an easy way to specify a whole environment to be downloaded.\n+    \"\"\"\n+    name = 'download'\n+\n+    usage = \"\"\"\n+      %prog [options] <requirement specifier> [package-index-options] ...\n+      %prog [options] -r <requirements file> [package-index-options] ...\n+      %prog [options] [-e] <vcs project url> ...\n+      %prog [options] [-e] <local project path> ...\n+      %prog [options] <archive url/path> ...\"\"\"\n+\n+    summary = 'Download packages.'\n+\n+    def __init__(self, *args, **kw):\n+        super(DownloadCommand, self).__init__(*args, **kw)\n+\n+        cmd_opts = self.cmd_opts\n+\n+        cmd_opts.add_option(cmdoptions.constraints())\n+        cmd_opts.add_option(cmdoptions.editable())\n+        cmd_opts.add_option(cmdoptions.requirements())\n+        cmd_opts.add_option(cmdoptions.build_dir())\n+        cmd_opts.add_option(cmdoptions.no_deps())\n+        cmd_opts.add_option(cmdoptions.download_options())\n+        cmd_opts.add_option(cmdoptions.global_options())\n+        cmd_opts.add_option(cmdoptions.no_binary())\n+        cmd_opts.add_option(cmdoptions.only_binary())\n+        cmd_opts.add_option(cmdoptions.src())\n+        cmd_opts.add_option(cmdoptions.no_clean())\n+        cmd_opts.add_option(\n+            '-d', '--dest', '--destination-dir', '--destination-directory',\n+            dest='download_dir',\n+            metavar='dir',\n+            default=None,\n+            help=(\"Download packages into <dir>.\"),\n+        )\n+        cmd_opts.add_option(\n+            '--pre',\n+            action='store_true',\n+            default=False,\n+            help=\"Include pre-release and development versions. By default, \"\n+                 \"pip only finds stable versions.\")\n+\n+        index_opts = cmdoptions.make_option_group(\n+            cmdoptions.index_group,\n+            self.parser,\n+        )\n+\n+        self.parser.insert_option_group(0, index_opts)\n+        self.parser.insert_option_group(0, cmd_opts)\n+\n+    def _build_package_finder(self, options, index_urls, session):\n+        \"\"\"\n+        Create a package finder appropriate to this download command.\n+        This method is meant to be overridden by subclasses, not\n+        called directly.\n+        \"\"\"\n+        return PackageFinder(\n+            find_links=options.find_links,\n+            format_control=options.format_control,\n+            index_urls=index_urls,\n+            allow_external=options.allow_external,\n+            allow_unverified=options.allow_unverified,\n+            allow_all_external=options.allow_all_external,\n+            trusted_hosts=options.trusted_hosts,\n+            allow_all_prereleases=options.pre,\n+            process_dependency_links=options.process_dependency_links,\n+            session=session,\n+        )","path":"pip/commands/download.py","position":null,"original_position":95,"commit_id":"b1f80d3997d823d5b7e469a8a7de29f8fa7059a5","original_commit_id":"54f8a81cafd834fc8b170135b4a0f29dc18be473","user":{"login":"MathewJennings","id":1478951,"avatar_url":"https://avatars.githubusercontent.com/u/1478951?v=3","gravatar_id":"","url":"https://api.github.com/users/MathewJennings","html_url":"https://github.com/MathewJennings","followers_url":"https://api.github.com/users/MathewJennings/followers","following_url":"https://api.github.com/users/MathewJennings/following{/other_user}","gists_url":"https://api.github.com/users/MathewJennings/gists{/gist_id}","starred_url":"https://api.github.com/users/MathewJennings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MathewJennings/subscriptions","organizations_url":"https://api.github.com/users/MathewJennings/orgs","repos_url":"https://api.github.com/users/MathewJennings/repos","events_url":"https://api.github.com/users/MathewJennings/events{/privacy}","received_events_url":"https://api.github.com/users/MathewJennings/received_events","type":"User","site_admin":false},"body":"Good call, I just did this.","created_at":"2015-08-07T17:29:33Z","updated_at":"2015-08-07T17:29:33Z","html_url":"https://github.com/pypa/pip/pull/2995#discussion_r36541010","pull_request_url":"https://api.github.com/repos/pypa/pip/pulls/2995","_links":{"self":{"href":"https://api.github.com/repos/pypa/pip/pulls/comments/36541010"},"html":{"href":"https://github.com/pypa/pip/pull/2995#discussion_r36541010"},"pull_request":{"href":"https://api.github.com/repos/pypa/pip/pulls/2995"}}},"pull_request":{"url":"https://api.github.com/repos/pypa/pip/pulls/2995","id":41168286,"html_url":"https://github.com/pypa/pip/pull/2995","diff_url":"https://github.com/pypa/pip/pull/2995.diff","patch_url":"https://github.com/pypa/pip/pull/2995.patch","issue_url":"https://api.github.com/repos/pypa/pip/issues/2995","number":2995,"state":"open","locked":false,"title":"Create a top level pip download command.","user":{"login":"MathewJennings","id":1478951,"avatar_url":"https://avatars.githubusercontent.com/u/1478951?v=3","gravatar_id":"","url":"https://api.github.com/users/MathewJennings","html_url":"https://github.com/MathewJennings","followers_url":"https://api.github.com/users/MathewJennings/followers","following_url":"https://api.github.com/users/MathewJennings/following{/other_user}","gists_url":"https://api.github.com/users/MathewJennings/gists{/gist_id}","starred_url":"https://api.github.com/users/MathewJennings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MathewJennings/subscriptions","organizations_url":"https://api.github.com/users/MathewJennings/orgs","repos_url":"https://api.github.com/users/MathewJennings/repos","events_url":"https://api.github.com/users/MathewJennings/events{/privacy}","received_events_url":"https://api.github.com/users/MathewJennings/received_events","type":"User","site_admin":false},"body":"`pip download -d path/to/download/directory` behaves exactly like `pip install --download path/to/download/directory`. Added a deprecation warning to `pip install --download`. Addresses #2643 ","created_at":"2015-07-29T20:29:37Z","updated_at":"2015-08-07T17:29:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"69274c60c25c32ac2aad3bb021e2491b6a12fc9a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pypa/pip/pulls/2995/commits","review_comments_url":"https://api.github.com/repos/pypa/pip/pulls/2995/comments","review_comment_url":"https://api.github.com/repos/pypa/pip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pypa/pip/issues/2995/comments","statuses_url":"https://api.github.com/repos/pypa/pip/statuses/b1f80d3997d823d5b7e469a8a7de29f8fa7059a5","head":{"label":"MathewJennings:add-pip-download-command","ref":"add-pip-download-command","sha":"b1f80d3997d823d5b7e469a8a7de29f8fa7059a5","user":{"login":"MathewJennings","id":1478951,"avatar_url":"https://avatars.githubusercontent.com/u/1478951?v=3","gravatar_id":"","url":"https://api.github.com/users/MathewJennings","html_url":"https://github.com/MathewJennings","followers_url":"https://api.github.com/users/MathewJennings/followers","following_url":"https://api.github.com/users/MathewJennings/following{/other_user}","gists_url":"https://api.github.com/users/MathewJennings/gists{/gist_id}","starred_url":"https://api.github.com/users/MathewJennings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MathewJennings/subscriptions","organizations_url":"https://api.github.com/users/MathewJennings/orgs","repos_url":"https://api.github.com/users/MathewJennings/repos","events_url":"https://api.github.com/users/MathewJennings/events{/privacy}","received_events_url":"https://api.github.com/users/MathewJennings/received_events","type":"User","site_admin":false},"repo":{"id":37326820,"name":"pip","full_name":"MathewJennings/pip","owner":{"login":"MathewJennings","id":1478951,"avatar_url":"https://avatars.githubusercontent.com/u/1478951?v=3","gravatar_id":"","url":"https://api.github.com/users/MathewJennings","html_url":"https://github.com/MathewJennings","followers_url":"https://api.github.com/users/MathewJennings/followers","following_url":"https://api.github.com/users/MathewJennings/following{/other_user}","gists_url":"https://api.github.com/users/MathewJennings/gists{/gist_id}","starred_url":"https://api.github.com/users/MathewJennings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MathewJennings/subscriptions","organizations_url":"https://api.github.com/users/MathewJennings/orgs","repos_url":"https://api.github.com/users/MathewJennings/repos","events_url":"https://api.github.com/users/MathewJennings/events{/privacy}","received_events_url":"https://api.github.com/users/MathewJennings/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MathewJennings/pip","description":"The PyPA recommended tool for installing Python packages","fork":true,"url":"https://api.github.com/repos/MathewJennings/pip","forks_url":"https://api.github.com/repos/MathewJennings/pip/forks","keys_url":"https://api.github.com/repos/MathewJennings/pip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MathewJennings/pip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MathewJennings/pip/teams","hooks_url":"https://api.github.com/repos/MathewJennings/pip/hooks","issue_events_url":"https://api.github.com/repos/MathewJennings/pip/issues/events{/number}","events_url":"https://api.github.com/repos/MathewJennings/pip/events","assignees_url":"https://api.github.com/repos/MathewJennings/pip/assignees{/user}","branches_url":"https://api.github.com/repos/MathewJennings/pip/branches{/branch}","tags_url":"https://api.github.com/repos/MathewJennings/pip/tags","blobs_url":"https://api.github.com/repos/MathewJennings/pip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MathewJennings/pip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MathewJennings/pip/git/refs{/sha}","trees_url":"https://api.github.com/repos/MathewJennings/pip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MathewJennings/pip/statuses/{sha}","languages_url":"https://api.github.com/repos/MathewJennings/pip/languages","stargazers_url":"https://api.github.com/repos/MathewJennings/pip/stargazers","contributors_url":"https://api.github.com/repos/MathewJennings/pip/contributors","subscribers_url":"https://api.github.com/repos/MathewJennings/pip/subscribers","subscription_url":"https://api.github.com/repos/MathewJennings/pip/subscription","commits_url":"https://api.github.com/repos/MathewJennings/pip/commits{/sha}","git_commits_url":"https://api.github.com/repos/MathewJennings/pip/git/commits{/sha}","comments_url":"https://api.github.com/repos/MathewJennings/pip/comments{/number}","issue_comment_url":"https://api.github.com/repos/MathewJennings/pip/issues/comments{/number}","contents_url":"https://api.github.com/repos/MathewJennings/pip/contents/{+path}","compare_url":"https://api.github.com/repos/MathewJennings/pip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MathewJennings/pip/merges","archive_url":"https://api.github.com/repos/MathewJennings/pip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MathewJennings/pip/downloads","issues_url":"https://api.github.com/repos/MathewJennings/pip/issues{/number}","pulls_url":"https://api.github.com/repos/MathewJennings/pip/pulls{/number}","milestones_url":"https://api.github.com/repos/MathewJennings/pip/milestones{/number}","notifications_url":"https://api.github.com/repos/MathewJennings/pip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MathewJennings/pip/labels{/name}","releases_url":"https://api.github.com/repos/MathewJennings/pip/releases{/id}","created_at":"2015-06-12T14:34:23Z","updated_at":"2015-06-12T14:34:25Z","pushed_at":"2015-08-07T17:25:30Z","git_url":"git://github.com/MathewJennings/pip.git","ssh_url":"git@github.com:MathewJennings/pip.git","clone_url":"https://github.com/MathewJennings/pip.git","svn_url":"https://github.com/MathewJennings/pip","homepage":"https://pip.pypa.io/","size":35865,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"pypa:develop","ref":"develop","sha":"0027580f863a25a45602c0efab32f2979e48173a","user":{"login":"pypa","id":647025,"avatar_url":"https://avatars.githubusercontent.com/u/647025?v=3","gravatar_id":"","url":"https://api.github.com/users/pypa","html_url":"https://github.com/pypa","followers_url":"https://api.github.com/users/pypa/followers","following_url":"https://api.github.com/users/pypa/following{/other_user}","gists_url":"https://api.github.com/users/pypa/gists{/gist_id}","starred_url":"https://api.github.com/users/pypa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pypa/subscriptions","organizations_url":"https://api.github.com/users/pypa/orgs","repos_url":"https://api.github.com/users/pypa/repos","events_url":"https://api.github.com/users/pypa/events{/privacy}","received_events_url":"https://api.github.com/users/pypa/received_events","type":"Organization","site_admin":false},"repo":{"id":1446467,"name":"pip","full_name":"pypa/pip","owner":{"login":"pypa","id":647025,"avatar_url":"https://avatars.githubusercontent.com/u/647025?v=3","gravatar_id":"","url":"https://api.github.com/users/pypa","html_url":"https://github.com/pypa","followers_url":"https://api.github.com/users/pypa/followers","following_url":"https://api.github.com/users/pypa/following{/other_user}","gists_url":"https://api.github.com/users/pypa/gists{/gist_id}","starred_url":"https://api.github.com/users/pypa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pypa/subscriptions","organizations_url":"https://api.github.com/users/pypa/orgs","repos_url":"https://api.github.com/users/pypa/repos","events_url":"https://api.github.com/users/pypa/events{/privacy}","received_events_url":"https://api.github.com/users/pypa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pypa/pip","description":"The PyPA recommended tool for installing Python packages","fork":false,"url":"https://api.github.com/repos/pypa/pip","forks_url":"https://api.github.com/repos/pypa/pip/forks","keys_url":"https://api.github.com/repos/pypa/pip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pypa/pip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pypa/pip/teams","hooks_url":"https://api.github.com/repos/pypa/pip/hooks","issue_events_url":"https://api.github.com/repos/pypa/pip/issues/events{/number}","events_url":"https://api.github.com/repos/pypa/pip/events","assignees_url":"https://api.github.com/repos/pypa/pip/assignees{/user}","branches_url":"https://api.github.com/repos/pypa/pip/branches{/branch}","tags_url":"https://api.github.com/repos/pypa/pip/tags","blobs_url":"https://api.github.com/repos/pypa/pip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pypa/pip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pypa/pip/git/refs{/sha}","trees_url":"https://api.github.com/repos/pypa/pip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pypa/pip/statuses/{sha}","languages_url":"https://api.github.com/repos/pypa/pip/languages","stargazers_url":"https://api.github.com/repos/pypa/pip/stargazers","contributors_url":"https://api.github.com/repos/pypa/pip/contributors","subscribers_url":"https://api.github.com/repos/pypa/pip/subscribers","subscription_url":"https://api.github.com/repos/pypa/pip/subscription","commits_url":"https://api.github.com/repos/pypa/pip/commits{/sha}","git_commits_url":"https://api.github.com/repos/pypa/pip/git/commits{/sha}","comments_url":"https://api.github.com/repos/pypa/pip/comments{/number}","issue_comment_url":"https://api.github.com/repos/pypa/pip/issues/comments{/number}","contents_url":"https://api.github.com/repos/pypa/pip/contents/{+path}","compare_url":"https://api.github.com/repos/pypa/pip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pypa/pip/merges","archive_url":"https://api.github.com/repos/pypa/pip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pypa/pip/downloads","issues_url":"https://api.github.com/repos/pypa/pip/issues{/number}","pulls_url":"https://api.github.com/repos/pypa/pip/pulls{/number}","milestones_url":"https://api.github.com/repos/pypa/pip/milestones{/number}","notifications_url":"https://api.github.com/repos/pypa/pip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pypa/pip/labels{/name}","releases_url":"https://api.github.com/repos/pypa/pip/releases{/id}","created_at":"2011-03-06T14:30:46Z","updated_at":"2015-08-07T07:01:28Z","pushed_at":"2015-08-07T17:25:32Z","git_url":"git://github.com/pypa/pip.git","ssh_url":"git@github.com:pypa/pip.git","clone_url":"https://github.com/pypa/pip.git","svn_url":"https://github.com/pypa/pip","homepage":"https://pip.pypa.io/","size":51333,"stargazers_count":2257,"watchers_count":2257,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":884,"mirror_url":null,"open_issues_count":619,"forks":884,"open_issues":619,"watchers":2257,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/pypa/pip/pulls/2995"},"html":{"href":"https://github.com/pypa/pip/pull/2995"},"issue":{"href":"https://api.github.com/repos/pypa/pip/issues/2995"},"comments":{"href":"https://api.github.com/repos/pypa/pip/issues/2995/comments"},"review_comments":{"href":"https://api.github.com/repos/pypa/pip/pulls/2995/comments"},"review_comment":{"href":"https://api.github.com/repos/pypa/pip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pypa/pip/pulls/2995/commits"},"statuses":{"href":"https://api.github.com/repos/pypa/pip/statuses/b1f80d3997d823d5b7e469a8a7de29f8fa7059a5"}}}}