{"action":"created","issue":{"url":"https://api.github.com/repos/pypa/pip/issues/2601","labels_url":"https://api.github.com/repos/pypa/pip/issues/2601/labels{/name}","comments_url":"https://api.github.com/repos/pypa/pip/issues/2601/comments","events_url":"https://api.github.com/repos/pypa/pip/issues/2601/events","html_url":"https://github.com/pypa/pip/issues/2601","id":63759887,"number":2601,"title":"Wrong RE pattern in pip generated scripts while installing packages","user":{"login":"crickzhang1","id":820938,"avatar_url":"https://avatars.githubusercontent.com/u/820938?v=3","gravatar_id":"","url":"https://api.github.com/users/crickzhang1","html_url":"https://github.com/crickzhang1","followers_url":"https://api.github.com/users/crickzhang1/followers","following_url":"https://api.github.com/users/crickzhang1/following{/other_user}","gists_url":"https://api.github.com/users/crickzhang1/gists{/gist_id}","starred_url":"https://api.github.com/users/crickzhang1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crickzhang1/subscriptions","organizations_url":"https://api.github.com/users/crickzhang1/orgs","repos_url":"https://api.github.com/users/crickzhang1/repos","events_url":"https://api.github.com/users/crickzhang1/events{/privacy}","received_events_url":"https://api.github.com/users/crickzhang1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-23T16:01:09Z","updated_at":"2015-03-23T22:14:26Z","closed_at":"2015-03-23T22:11:50Z","body":"Hi,\r\n\r\nWhen pip installs a package, it would generate a script under scripts directory if there's a entry_point item in setup.py. The generated script have a **wrong RE patern in line 2** of following code snippet:\r\n\r\n```python\r\nif __name__ == '__main__':\r\n    sys.argv[0] = re.sub(r'(-script\\.pyw|\\.exe)?$', '', sys.argv[0])  # line 3\r\n    sys.exit(main())\r\n```\r\nRE pattern should be ``sys.argv[0] = re.sub(r'-script(\\.pyw|\\.exe)?$', '', sys.argv[0])''`` to correctly match ``*-script.pyw`` or ``*-script.exe`` scripts.\r\n\r\nA [rough search in pip repo](https://github.com/pypa/pip/search?utf8=%E2%9C%93&q=re.sub%28r%27%28-script\\.pyw|\\.exe%29%3F%24%27) shows the above code snippet appears in file ``pip/_vendor/distlib/scripts.py `` and ``pip/wheel.py``.\r\n\r\nTest under pip version 6.0.8.\r\n"},"comment":{"url":"https://api.github.com/repos/pypa/pip/issues/comments/85227252","html_url":"https://github.com/pypa/pip/issues/2601#issuecomment-85227252","issue_url":"https://api.github.com/repos/pypa/pip/issues/2601","id":85227252,"user":{"login":"crickzhang1","id":820938,"avatar_url":"https://avatars.githubusercontent.com/u/820938?v=3","gravatar_id":"","url":"https://api.github.com/users/crickzhang1","html_url":"https://github.com/crickzhang1","followers_url":"https://api.github.com/users/crickzhang1/followers","following_url":"https://api.github.com/users/crickzhang1/following{/other_user}","gists_url":"https://api.github.com/users/crickzhang1/gists{/gist_id}","starred_url":"https://api.github.com/users/crickzhang1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crickzhang1/subscriptions","organizations_url":"https://api.github.com/users/crickzhang1/orgs","repos_url":"https://api.github.com/users/crickzhang1/repos","events_url":"https://api.github.com/users/crickzhang1/events{/privacy}","received_events_url":"https://api.github.com/users/crickzhang1/received_events","type":"User","site_admin":false},"created_at":"2015-03-23T22:14:26Z","updated_at":"2015-03-23T22:14:26Z","body":"Thanks Paul.\n"}}