{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/42723583","id":42723583,"diff_hunk":"@@ -69,20 +72,34 @@ class CleanCommand(Clean):\n \n     def run(self):\n         Clean.run(self)\n+        # Remove c files if we are not within a sdist package\n+        cwd = os.path.abspath(os.path.dirname(__file__))\n+        remove_c_files = not os.path.exists(os.path.join(cwd, 'PKG-INFO'))\n+        if remove_c_files:\n+            print('Will remove generated .c files')\n         if os.path.exists('build'):\n             shutil.rmtree('build')\n         for dirpath, dirnames, filenames in os.walk('sklearn'):\n             for filename in filenames:\n-                if (filename.endswith('.so') or filename.endswith('.pyd')\n-                        or filename.endswith('.dll')\n-                        or filename.endswith('.pyc')):\n+                if any(filename.endswith(suffix) for suffix in\n+                        (\".so\", \".pyd\", \".dll\", \".pyc\")):\n                     os.unlink(os.path.join(dirpath, filename))\n+                if remove_c_files:\n+                    extension = os.path.splitext(filename)[1]\n+                    if extension in ['.c', '.cpp']:\n+                        pyx_file = replace(filename, extension, '.pyx')\n+                        if os.path.exists(os.path.join(dirpath, pyx_file)):\n+                            os.unlink(os.path.join(dirpath, filename))\n             for dirname in dirnames:\n                 if dirname == '__pycache__':\n                     shutil.rmtree(os.path.join(dirpath, dirname))\n+            if remove_c_files:","path":"setup.py","position":61,"original_position":61,"commit_id":"716014f0627ae3f518618f3bbc252df42e0615b9","original_commit_id":"716014f0627ae3f518618f3bbc252df42e0615b9","user":{"login":"arjoly","id":1274722,"avatar_url":"https://avatars.githubusercontent.com/u/1274722?v=3","gravatar_id":"","url":"https://api.github.com/users/arjoly","html_url":"https://github.com/arjoly","followers_url":"https://api.github.com/users/arjoly/followers","following_url":"https://api.github.com/users/arjoly/following{/other_user}","gists_url":"https://api.github.com/users/arjoly/gists{/gist_id}","starred_url":"https://api.github.com/users/arjoly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arjoly/subscriptions","organizations_url":"https://api.github.com/users/arjoly/orgs","repos_url":"https://api.github.com/users/arjoly/repos","events_url":"https://api.github.com/users/arjoly/events{/privacy}","received_events_url":"https://api.github.com/users/arjoly/received_events","type":"User","site_admin":false},"body":"Could it be done just after print('Will remove generated .c files')?","created_at":"2015-10-22T08:39:46Z","updated_at":"2015-10-22T08:39:46Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/5492#discussion_r42723583","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/42723583"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5492#discussion_r42723583"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492","id":48214437,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/5492","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/5492.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/5492.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5492","number":5492,"state":"open","locked":false,"title":"[MRG] Removing generated C files, adding build cache to Travis","user":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"body":"Still to do :\r\n- [x] add cache to travis so that it does not cythonize + build at every commit in each PR","created_at":"2015-10-20T15:13:06Z","updated_at":"2015-10-22T08:39:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89e7cfb6ec193ee1476f97ff42c7c95130563559","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492/comments","review_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5492/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/716014f0627ae3f518618f3bbc252df42e0615b9","head":{"label":"arthurmensch:remove_cython","ref":"remove_cython","sha":"716014f0627ae3f518618f3bbc252df42e0615b9","user":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"repo":{"id":36289937,"name":"scikit-learn","full_name":"arthurmensch/scikit-learn","owner":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arthurmensch/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/arthurmensch/scikit-learn","forks_url":"https://api.github.com/repos/arthurmensch/scikit-learn/forks","keys_url":"https://api.github.com/repos/arthurmensch/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arthurmensch/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arthurmensch/scikit-learn/teams","hooks_url":"https://api.github.com/repos/arthurmensch/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/arthurmensch/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/arthurmensch/scikit-learn/events","assignees_url":"https://api.github.com/repos/arthurmensch/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/arthurmensch/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/arthurmensch/scikit-learn/tags","blobs_url":"https://api.github.com/repos/arthurmensch/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arthurmensch/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arthurmensch/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/arthurmensch/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arthurmensch/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/arthurmensch/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/arthurmensch/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/arthurmensch/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/arthurmensch/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/arthurmensch/scikit-learn/subscription","commits_url":"https://api.github.com/repos/arthurmensch/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/arthurmensch/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/arthurmensch/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/arthurmensch/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/arthurmensch/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/arthurmensch/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arthurmensch/scikit-learn/merges","archive_url":"https://api.github.com/repos/arthurmensch/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arthurmensch/scikit-learn/downloads","issues_url":"https://api.github.com/repos/arthurmensch/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/arthurmensch/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/arthurmensch/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/arthurmensch/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arthurmensch/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/arthurmensch/scikit-learn/releases{/id}","created_at":"2015-05-26T10:53:11Z","updated_at":"2015-05-26T10:53:18Z","pushed_at":"2015-10-22T08:33:10Z","git_url":"git://github.com/arthurmensch/scikit-learn.git","ssh_url":"git@github.com:arthurmensch/scikit-learn.git","clone_url":"https://github.com/arthurmensch/scikit-learn.git","svn_url":"https://github.com/arthurmensch/scikit-learn","homepage":"http://scikit-learn.org","size":70064,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"c45075123a9a35a8e68abe22f0fed21d6f0630db","user":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"repo":{"id":843222,"name":"scikit-learn","full_name":"scikit-learn/scikit-learn","owner":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-learn/scikit-learn","description":"scikit-learn: machine learning in Python","fork":false,"url":"https://api.github.com/repos/scikit-learn/scikit-learn","forks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/forks","keys_url":"https://api.github.com/repos/scikit-learn/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-learn/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-learn/scikit-learn/teams","hooks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/events","assignees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-learn/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/tags","blobs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-learn/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscription","commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-learn/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-learn/scikit-learn/merges","archive_url":"https://api.github.com/repos/scikit-learn/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-learn/scikit-learn/downloads","issues_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-learn/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/scikit-learn/scikit-learn/releases{/id}","created_at":"2010-08-17T09:43:38Z","updated_at":"2015-10-22T08:19:56Z","pushed_at":"2015-10-22T08:37:18Z","git_url":"git://github.com/scikit-learn/scikit-learn.git","ssh_url":"git@github.com:scikit-learn/scikit-learn.git","clone_url":"https://github.com/scikit-learn/scikit-learn.git","svn_url":"https://github.com/scikit-learn/scikit-learn","homepage":"http://scikit-learn.org","size":139081,"stargazers_count":7937,"watchers_count":7937,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4729,"mirror_url":null,"open_issues_count":775,"forks":4729,"open_issues":775,"watchers":7937,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/5492"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5492"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/5492/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/5492/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/716014f0627ae3f518618f3bbc252df42e0615b9"}}}}