{"action":"created","comment":{"url":"https://api.github.com/repos/pypa/pip/pulls/comments/26224426","id":26224426,"diff_hunk":"@@ -105,28 +105,31 @@ def find_command(cmd, paths=None, pathext=None):\n     # check if there are funny path extensions for executables, e.g. Windows\n     if pathext is None:\n         pathext = get_pathext()\n-    pathext = [ext for ext in pathext.lower().split(os.pathsep) if len(ext)]\n+    pathext = [ext for ext in pathext.lower().split(os.pathsep) if ext]\n     # don't use extensions if the command ends with one of them\n     if os.path.splitext(cmd)[1].lower() in pathext:\n-        pathext = ['']\n+        pathext = []\n     # check if we find the command on PATH\n     for path in paths:\n-        # try without extension first\n         cmd_path = os.path.join(path, cmd)\n+        # if we have extensions, try them\n         for ext in pathext:\n-            # then including the extension\n             cmd_path_ext = cmd_path + ext\n             if os.path.isfile(cmd_path_ext):\n                 return cmd_path_ext\n-        if os.path.isfile(cmd_path):\n-            return cmd_path\n+        # else, don't use any extension\n+        if not pathext:\n+            if os.path.isfile(cmd_path):\n+                return cmd_path\n     raise BadCommand('Cannot find command %r' % cmd)\n \n \n def get_pathext(default_pathext=None):\n     \"\"\"Returns the path extensions from environment or a default\"\"\"\n-    if default_pathext is None:\n+    if default_pathext is None and os.name == 'nt':\n         default_pathext = os.pathsep.join(['.COM', '.EXE', '.BAT', '.CMD'])\n+    else:\n+        default_pathext = ''","path":"pip/utils/__init__.py","position":35,"original_position":35,"commit_id":"dda9bb67ba934ca6658eb68c7fa5d9456ac03a9c","original_commit_id":"dda9bb67ba934ca6658eb68c7fa5d9456ac03a9c","user":{"login":"Ivoz","id":199266,"avatar_url":"https://avatars.githubusercontent.com/u/199266?v=3","gravatar_id":"","url":"https://api.github.com/users/Ivoz","html_url":"https://github.com/Ivoz","followers_url":"https://api.github.com/users/Ivoz/followers","following_url":"https://api.github.com/users/Ivoz/following{/other_user}","gists_url":"https://api.github.com/users/Ivoz/gists{/gist_id}","starred_url":"https://api.github.com/users/Ivoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ivoz/subscriptions","organizations_url":"https://api.github.com/users/Ivoz/orgs","repos_url":"https://api.github.com/users/Ivoz/repos","events_url":"https://api.github.com/users/Ivoz/events{/privacy}","received_events_url":"https://api.github.com/users/Ivoz/received_events","type":"User","site_admin":false},"body":"Should also be using [this](https://github.com/pypa/pip/blob/develop/pip/compat/__init__.py#L102) instead","created_at":"2015-03-11T15:49:02Z","updated_at":"2015-03-11T15:49:02Z","html_url":"https://github.com/pypa/pip/pull/1829#discussion_r26224426","pull_request_url":"https://api.github.com/repos/pypa/pip/pulls/1829","_links":{"self":{"href":"https://api.github.com/repos/pypa/pip/pulls/comments/26224426"},"html":{"href":"https://github.com/pypa/pip/pull/1829#discussion_r26224426"},"pull_request":{"href":"https://api.github.com/repos/pypa/pip/pulls/1829"}}},"pull_request":{"url":"https://api.github.com/repos/pypa/pip/pulls/1829","id":16190956,"html_url":"https://github.com/pypa/pip/pull/1829","diff_url":"https://github.com/pypa/pip/pull/1829.diff","patch_url":"https://github.com/pypa/pip/pull/1829.patch","issue_url":"https://api.github.com/repos/pypa/pip/issues/1829","number":1829,"state":"open","locked":false,"title":"Fixes find_command on Windows","user":{"login":"remram44","id":426784,"avatar_url":"https://avatars.githubusercontent.com/u/426784?v=3","gravatar_id":"","url":"https://api.github.com/users/remram44","html_url":"https://github.com/remram44","followers_url":"https://api.github.com/users/remram44/followers","following_url":"https://api.github.com/users/remram44/following{/other_user}","gists_url":"https://api.github.com/users/remram44/gists{/gist_id}","starred_url":"https://api.github.com/users/remram44/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remram44/subscriptions","organizations_url":"https://api.github.com/users/remram44/orgs","repos_url":"https://api.github.com/users/remram44/repos","events_url":"https://api.github.com/users/remram44/events{/privacy}","received_events_url":"https://api.github.com/users/remram44/received_events","type":"User","site_admin":false},"body":"Trying the command name with the extension doesn't make sense.\r\n\r\nAlso, the comments were misleading, as they stated that the path was\r\nfirst tried without extension and then with it, although the opposite\r\nhappened.","created_at":"2014-05-21T21:57:48Z","updated_at":"2015-03-11T15:49:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0bd2ac355ce06e532b5d381527abf9311ac08a24","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pypa/pip/pulls/1829/commits","review_comments_url":"https://api.github.com/repos/pypa/pip/pulls/1829/comments","review_comment_url":"https://api.github.com/repos/pypa/pip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pypa/pip/issues/1829/comments","statuses_url":"https://api.github.com/repos/pypa/pip/statuses/dda9bb67ba934ca6658eb68c7fa5d9456ac03a9c","head":{"label":"remram44:win-find_command","ref":"win-find_command","sha":"dda9bb67ba934ca6658eb68c7fa5d9456ac03a9c","user":{"login":"remram44","id":426784,"avatar_url":"https://avatars.githubusercontent.com/u/426784?v=3","gravatar_id":"","url":"https://api.github.com/users/remram44","html_url":"https://github.com/remram44","followers_url":"https://api.github.com/users/remram44/followers","following_url":"https://api.github.com/users/remram44/following{/other_user}","gists_url":"https://api.github.com/users/remram44/gists{/gist_id}","starred_url":"https://api.github.com/users/remram44/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remram44/subscriptions","organizations_url":"https://api.github.com/users/remram44/orgs","repos_url":"https://api.github.com/users/remram44/repos","events_url":"https://api.github.com/users/remram44/events{/privacy}","received_events_url":"https://api.github.com/users/remram44/received_events","type":"User","site_admin":false},"repo":{"id":9876827,"name":"pip","full_name":"remram44/pip","owner":{"login":"remram44","id":426784,"avatar_url":"https://avatars.githubusercontent.com/u/426784?v=3","gravatar_id":"","url":"https://api.github.com/users/remram44","html_url":"https://github.com/remram44","followers_url":"https://api.github.com/users/remram44/followers","following_url":"https://api.github.com/users/remram44/following{/other_user}","gists_url":"https://api.github.com/users/remram44/gists{/gist_id}","starred_url":"https://api.github.com/users/remram44/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remram44/subscriptions","organizations_url":"https://api.github.com/users/remram44/orgs","repos_url":"https://api.github.com/users/remram44/repos","events_url":"https://api.github.com/users/remram44/events{/privacy}","received_events_url":"https://api.github.com/users/remram44/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/remram44/pip","description":"A tool for installing and managing Python packages","fork":true,"url":"https://api.github.com/repos/remram44/pip","forks_url":"https://api.github.com/repos/remram44/pip/forks","keys_url":"https://api.github.com/repos/remram44/pip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/remram44/pip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/remram44/pip/teams","hooks_url":"https://api.github.com/repos/remram44/pip/hooks","issue_events_url":"https://api.github.com/repos/remram44/pip/issues/events{/number}","events_url":"https://api.github.com/repos/remram44/pip/events","assignees_url":"https://api.github.com/repos/remram44/pip/assignees{/user}","branches_url":"https://api.github.com/repos/remram44/pip/branches{/branch}","tags_url":"https://api.github.com/repos/remram44/pip/tags","blobs_url":"https://api.github.com/repos/remram44/pip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/remram44/pip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/remram44/pip/git/refs{/sha}","trees_url":"https://api.github.com/repos/remram44/pip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/remram44/pip/statuses/{sha}","languages_url":"https://api.github.com/repos/remram44/pip/languages","stargazers_url":"https://api.github.com/repos/remram44/pip/stargazers","contributors_url":"https://api.github.com/repos/remram44/pip/contributors","subscribers_url":"https://api.github.com/repos/remram44/pip/subscribers","subscription_url":"https://api.github.com/repos/remram44/pip/subscription","commits_url":"https://api.github.com/repos/remram44/pip/commits{/sha}","git_commits_url":"https://api.github.com/repos/remram44/pip/git/commits{/sha}","comments_url":"https://api.github.com/repos/remram44/pip/comments{/number}","issue_comment_url":"https://api.github.com/repos/remram44/pip/issues/comments{/number}","contents_url":"https://api.github.com/repos/remram44/pip/contents/{+path}","compare_url":"https://api.github.com/repos/remram44/pip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/remram44/pip/merges","archive_url":"https://api.github.com/repos/remram44/pip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/remram44/pip/downloads","issues_url":"https://api.github.com/repos/remram44/pip/issues{/number}","pulls_url":"https://api.github.com/repos/remram44/pip/pulls{/number}","milestones_url":"https://api.github.com/repos/remram44/pip/milestones{/number}","notifications_url":"https://api.github.com/repos/remram44/pip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/remram44/pip/labels{/name}","releases_url":"https://api.github.com/repos/remram44/pip/releases{/id}","created_at":"2013-05-06T00:50:29Z","updated_at":"2015-01-15T15:46:34Z","pushed_at":"2015-03-03T20:19:06Z","git_url":"git://github.com/remram44/pip.git","ssh_url":"git@github.com:remram44/pip.git","clone_url":"https://github.com/remram44/pip.git","svn_url":"https://github.com/remram44/pip","homepage":"www.pip-installer.org","size":26776,"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":"win-find_command"}},"base":{"label":"pypa:develop","ref":"develop","sha":"52287cae269a8358f1472e088eb272bfbb7652ab","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-03-11T14:27:17Z","pushed_at":"2015-03-09T16:41:46Z","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":44208,"stargazers_count":1921,"watchers_count":1921,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":773,"mirror_url":null,"open_issues_count":526,"forks":773,"open_issues":526,"watchers":1921,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/pypa/pip/pulls/1829"},"html":{"href":"https://github.com/pypa/pip/pull/1829"},"issue":{"href":"https://api.github.com/repos/pypa/pip/issues/1829"},"comments":{"href":"https://api.github.com/repos/pypa/pip/issues/1829/comments"},"review_comments":{"href":"https://api.github.com/repos/pypa/pip/pulls/1829/comments"},"review_comment":{"href":"https://api.github.com/repos/pypa/pip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pypa/pip/pulls/1829/commits"},"statuses":{"href":"https://api.github.com/repos/pypa/pip/statuses/dda9bb67ba934ca6658eb68c7fa5d9456ac03a9c"}}}}