{"action":"created","comment":{"url":"https://api.github.com/repos/sympy/sympy/pulls/comments/23327513","id":23327513,"diff_hunk":"@@ -174,15 +175,20 @@ def finalize_options(self):\n \n     def run(self):\n         import os\n-        os.system(\"find . -name '*.pyc' | xargs rm -f\")\n-        os.system(\"rm -f python-build-stamp-2.4\")\n-        os.system(\"rm -f MANIFEST\")\n-        os.system(\"rm -rf build\")\n-        os.system(\"rm -rf dist\")\n-        os.system(\"rm -rf doc/_build\")\n-        os.system(\"rm -f sample.tex\")\n-\n-\n+        \n+        for root, dirs, files in os.walk(os.path.dirname(os.path.realpath(__file__))):\n+            for file in files:\n+                if file.endswith('.pyc') and os.path.isfile:\n+                    os.remove(os.path.join(root, file))\n+\n+        if os.path.isfile(\"python-build-stamp-2.4\"): os.remove(\"python-build-stamp-2.4\")","path":"setup.py","position":27,"original_position":27,"commit_id":"ebde81670115d9b2b051d60e374f4a5e69270634","original_commit_id":"ebde81670115d9b2b051d60e374f4a5e69270634","user":{"login":"moorepants","id":276007,"avatar_url":"https://avatars.githubusercontent.com/u/276007?v=3","gravatar_id":"","url":"https://api.github.com/users/moorepants","html_url":"https://github.com/moorepants","followers_url":"https://api.github.com/users/moorepants/followers","following_url":"https://api.github.com/users/moorepants/following{/other_user}","gists_url":"https://api.github.com/users/moorepants/gists{/gist_id}","starred_url":"https://api.github.com/users/moorepants/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moorepants/subscriptions","organizations_url":"https://api.github.com/users/moorepants/orgs","repos_url":"https://api.github.com/users/moorepants/repos","events_url":"https://api.github.com/users/moorepants/events{/privacy}","received_events_url":"https://api.github.com/users/moorepants/received_events","type":"User","site_admin":false},"body":"Well, say you are in your home directory `~` and you have sympy in this directory `~/sympy/`. If I run `python ~/sympy/setup.py clean` from my home directory, it may delete every single `pyc` file in my home directory. Maybe disutils/setuptools prevent this, but it is always smart to be careful about `rm` commands, as you don't want to accidentally delete peoples files. It is worth checking that you can't delete files you don't intend to.\r\n\r\nAlso, how about a loop for this:\r\n\r\n```python\r\nfilenames = [...]\r\nfor f in names:\r\n    if os.path.isfile(f):\r\n        os.remove(f)\r\n    elif os.path.isdir(f):\r\n        shutil.rmtree(f)\r\n```","created_at":"2015-01-21T19:40:15Z","updated_at":"2015-01-21T19:40:15Z","html_url":"https://github.com/sympy/sympy/pull/8865#discussion_r23327513","pull_request_url":"https://api.github.com/repos/sympy/sympy/pulls/8865","_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments/23327513"},"html":{"href":"https://github.com/sympy/sympy/pull/8865#discussion_r23327513"},"pull_request":{"href":"https://api.github.com/repos/sympy/sympy/pulls/8865"}}},"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/8865","id":27778094,"html_url":"https://github.com/sympy/sympy/pull/8865","diff_url":"https://github.com/sympy/sympy/pull/8865.diff","patch_url":"https://github.com/sympy/sympy/pull/8865.patch","issue_url":"https://api.github.com/repos/sympy/sympy/issues/8865","number":8865,"state":"open","locked":false,"title":"Add cross-platform support","user":{"login":"darshanime","id":6951919,"avatar_url":"https://avatars.githubusercontent.com/u/6951919?v=3","gravatar_id":"","url":"https://api.github.com/users/darshanime","html_url":"https://github.com/darshanime","followers_url":"https://api.github.com/users/darshanime/followers","following_url":"https://api.github.com/users/darshanime/following{/other_user}","gists_url":"https://api.github.com/users/darshanime/gists{/gist_id}","starred_url":"https://api.github.com/users/darshanime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darshanime/subscriptions","organizations_url":"https://api.github.com/users/darshanime/orgs","repos_url":"https://api.github.com/users/darshanime/repos","events_url":"https://api.github.com/users/darshanime/events{/privacy}","received_events_url":"https://api.github.com/users/darshanime/received_events","type":"User","site_admin":false},"body":"Fixes [#8857](https://github.com/sympy/sympy/issues/8857)\r\nAdded cross platform support for setup.py","created_at":"2015-01-21T17:26:08Z","updated_at":"2015-01-21T19:40:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee27d0615577284a607dcf2f9c97418741dcb40a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sympy/sympy/pulls/8865/commits","review_comments_url":"https://api.github.com/repos/sympy/sympy/pulls/8865/comments","review_comment_url":"https://api.github.com/repos/sympy/sympy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/8865/comments","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/ebde81670115d9b2b051d60e374f4a5e69270634","head":{"label":"darshanime:cross-platform-setup.py","ref":"cross-platform-setup.py","sha":"ebde81670115d9b2b051d60e374f4a5e69270634","user":{"login":"darshanime","id":6951919,"avatar_url":"https://avatars.githubusercontent.com/u/6951919?v=3","gravatar_id":"","url":"https://api.github.com/users/darshanime","html_url":"https://github.com/darshanime","followers_url":"https://api.github.com/users/darshanime/followers","following_url":"https://api.github.com/users/darshanime/following{/other_user}","gists_url":"https://api.github.com/users/darshanime/gists{/gist_id}","starred_url":"https://api.github.com/users/darshanime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darshanime/subscriptions","organizations_url":"https://api.github.com/users/darshanime/orgs","repos_url":"https://api.github.com/users/darshanime/repos","events_url":"https://api.github.com/users/darshanime/events{/privacy}","received_events_url":"https://api.github.com/users/darshanime/received_events","type":"User","site_admin":false},"repo":{"id":29032038,"name":"sympy","full_name":"darshanime/sympy","owner":{"login":"darshanime","id":6951919,"avatar_url":"https://avatars.githubusercontent.com/u/6951919?v=3","gravatar_id":"","url":"https://api.github.com/users/darshanime","html_url":"https://github.com/darshanime","followers_url":"https://api.github.com/users/darshanime/followers","following_url":"https://api.github.com/users/darshanime/following{/other_user}","gists_url":"https://api.github.com/users/darshanime/gists{/gist_id}","starred_url":"https://api.github.com/users/darshanime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darshanime/subscriptions","organizations_url":"https://api.github.com/users/darshanime/orgs","repos_url":"https://api.github.com/users/darshanime/repos","events_url":"https://api.github.com/users/darshanime/events{/privacy}","received_events_url":"https://api.github.com/users/darshanime/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/darshanime/sympy","description":"A computer algebra system written in pure Python","fork":true,"url":"https://api.github.com/repos/darshanime/sympy","forks_url":"https://api.github.com/repos/darshanime/sympy/forks","keys_url":"https://api.github.com/repos/darshanime/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/darshanime/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/darshanime/sympy/teams","hooks_url":"https://api.github.com/repos/darshanime/sympy/hooks","issue_events_url":"https://api.github.com/repos/darshanime/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/darshanime/sympy/events","assignees_url":"https://api.github.com/repos/darshanime/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/darshanime/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/darshanime/sympy/tags","blobs_url":"https://api.github.com/repos/darshanime/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/darshanime/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/darshanime/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/darshanime/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/darshanime/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/darshanime/sympy/languages","stargazers_url":"https://api.github.com/repos/darshanime/sympy/stargazers","contributors_url":"https://api.github.com/repos/darshanime/sympy/contributors","subscribers_url":"https://api.github.com/repos/darshanime/sympy/subscribers","subscription_url":"https://api.github.com/repos/darshanime/sympy/subscription","commits_url":"https://api.github.com/repos/darshanime/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/darshanime/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/darshanime/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/darshanime/sympy/issues/comments/{number}","contents_url":"https://api.github.com/repos/darshanime/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/darshanime/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/darshanime/sympy/merges","archive_url":"https://api.github.com/repos/darshanime/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/darshanime/sympy/downloads","issues_url":"https://api.github.com/repos/darshanime/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/darshanime/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/darshanime/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/darshanime/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/darshanime/sympy/labels{/name}","releases_url":"https://api.github.com/repos/darshanime/sympy/releases{/id}","created_at":"2015-01-09T19:37:46Z","updated_at":"2015-01-09T19:37:52Z","pushed_at":"2015-01-21T18:05:20Z","git_url":"git://github.com/darshanime/sympy.git","ssh_url":"git@github.com:darshanime/sympy.git","clone_url":"https://github.com/darshanime/sympy.git","svn_url":"https://github.com/darshanime/sympy","homepage":"http://sympy.org/","size":65729,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"sympy:master","ref":"master","sha":"998a9100f3c8493a2b6f1ff10c02024f36d48811","user":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"repo":{"id":640534,"name":"sympy","full_name":"sympy/sympy","owner":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sympy/sympy","description":"A computer algebra system written in pure Python","fork":false,"url":"https://api.github.com/repos/sympy/sympy","forks_url":"https://api.github.com/repos/sympy/sympy/forks","keys_url":"https://api.github.com/repos/sympy/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sympy/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sympy/sympy/teams","hooks_url":"https://api.github.com/repos/sympy/sympy/hooks","issue_events_url":"https://api.github.com/repos/sympy/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/sympy/sympy/events","assignees_url":"https://api.github.com/repos/sympy/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/sympy/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/sympy/sympy/tags","blobs_url":"https://api.github.com/repos/sympy/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sympy/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sympy/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sympy/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/sympy/sympy/languages","stargazers_url":"https://api.github.com/repos/sympy/sympy/stargazers","contributors_url":"https://api.github.com/repos/sympy/sympy/contributors","subscribers_url":"https://api.github.com/repos/sympy/sympy/subscribers","subscription_url":"https://api.github.com/repos/sympy/sympy/subscription","commits_url":"https://api.github.com/repos/sympy/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sympy/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sympy/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sympy/sympy/issues/comments/{number}","contents_url":"https://api.github.com/repos/sympy/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/sympy/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sympy/sympy/merges","archive_url":"https://api.github.com/repos/sympy/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sympy/sympy/downloads","issues_url":"https://api.github.com/repos/sympy/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/sympy/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/sympy/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/sympy/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sympy/sympy/labels{/name}","releases_url":"https://api.github.com/repos/sympy/sympy/releases{/id}","created_at":"2010-04-30T20:37:14Z","updated_at":"2015-01-21T17:17:56Z","pushed_at":"2015-01-21T17:17:56Z","git_url":"git://github.com/sympy/sympy.git","ssh_url":"git@github.com:sympy/sympy.git","clone_url":"https://github.com/sympy/sympy.git","svn_url":"https://github.com/sympy/sympy","homepage":"http://sympy.org/","size":137584,"stargazers_count":1881,"watchers_count":1881,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":895,"mirror_url":null,"open_issues_count":1807,"forks":895,"open_issues":1807,"watchers":1881,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/8865"},"html":{"href":"https://github.com/sympy/sympy/pull/8865"},"issue":{"href":"https://api.github.com/repos/sympy/sympy/issues/8865"},"comments":{"href":"https://api.github.com/repos/sympy/sympy/issues/8865/comments"},"review_comments":{"href":"https://api.github.com/repos/sympy/sympy/pulls/8865/comments"},"review_comment":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/sympy/sympy/pulls/8865/commits"},"statuses":{"href":"https://api.github.com/repos/sympy/sympy/statuses/ebde81670115d9b2b051d60e374f4a5e69270634"}}}}