{"action":"created","comment":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/comments/50632877","id":50632877,"diff_hunk":"@@ -182,6 +182,46 @@ def copy_static_entry(source, targetdir, builder, context={},\n                               exclude_matchers=exclude_matchers)\n \n \n+def copy_extra_entry(source, targetdir, builder, exclude_matchers=()):\n+    \"\"\"Copy a HTML builder extra_path entry from source to targetdir.\n+\n+    Handles all possible cases of files, directories and subdirectories.\n+    \"\"\"\n+    def excluded(root, entry):\n+        relroot = relative_path(os.path.dirname(source), root)\n+        path = os.path.join(relroot, entry)\n+        for matcher in exclude_matchers:\n+            if matcher(path):\n+                return True\n+        else:\n+            return False\n+\n+    if os.path.isfile(source):\n+        if not excluded(source, ''):\n+            target = os.path.join(targetdir, os.path.basename(source))\n+            copyfile(source, target)\n+        return\n+\n+    excluded_dir = []\n+    for root, dirs, files in os.walk(source):\n+        if root in excluded_dir:\n+            continue\n+\n+        relroot = relative_path(source, root)\n+        for dir in dirs:\n+            if excluded(root, dir):\n+                excluded_dir.append(os.path.join(root, dir))\n+            else:\n+                target = os.path.join(targetdir, relroot, dir)\n+                if not path.exists(target):\n+                    os.mkdir(target)\n+        for file in files:\n+            if not excluded(root, file):\n+                srcpath = os.path.join(root, file)\n+                target = os.path.join(targetdir, relroot, file)\n+                copyfile(srcpath, target)\n+\n+","path":"sphinx/util/__init__.py","position":43,"original_position":43,"commit_id":"c55cc06fb55d436bedfdcade4a46216c54597bb1","original_commit_id":"c55cc06fb55d436bedfdcade4a46216c54597bb1","user":{"login":"tk0miya","id":748828,"avatar_url":"https://avatars.githubusercontent.com/u/748828?v=3","gravatar_id":"","url":"https://api.github.com/users/tk0miya","html_url":"https://github.com/tk0miya","followers_url":"https://api.github.com/users/tk0miya/followers","following_url":"https://api.github.com/users/tk0miya/following{/other_user}","gists_url":"https://api.github.com/users/tk0miya/gists{/gist_id}","starred_url":"https://api.github.com/users/tk0miya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tk0miya/subscriptions","organizations_url":"https://api.github.com/users/tk0miya/orgs","repos_url":"https://api.github.com/users/tk0miya/repos","events_url":"https://api.github.com/users/tk0miya/events{/privacy}","received_events_url":"https://api.github.com/users/tk0miya/received_events","type":"User","site_admin":false},"body":"It does not work fine. It raises error if there are any files in excluded directories.\r\n`os.walk()` always traverses all subdirectories and files, but we have to prune traversal if subdirectories are excluded.\r\nI think `os.walk()` is not good for this case.","created_at":"2016-01-24T09:33:25Z","updated_at":"2016-01-24T09:33:25Z","html_url":"https://github.com/sphinx-doc/sphinx/pull/2237#discussion_r50632877","pull_request_url":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237","_links":{"self":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/comments/50632877"},"html":{"href":"https://github.com/sphinx-doc/sphinx/pull/2237#discussion_r50632877"},"pull_request":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237"}}},"pull_request":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237","id":56161540,"html_url":"https://github.com/sphinx-doc/sphinx/pull/2237","diff_url":"https://github.com/sphinx-doc/sphinx/pull/2237.diff","patch_url":"https://github.com/sphinx-doc/sphinx/pull/2237.patch","issue_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2237","number":2237,"state":"open","locked":false,"title":"Fix #2022: html_extra_path also copies dotfiles and refers exclude_patterns","user":{"login":"tk0miya","id":748828,"avatar_url":"https://avatars.githubusercontent.com/u/748828?v=3","gravatar_id":"","url":"https://api.github.com/users/tk0miya","html_url":"https://github.com/tk0miya","followers_url":"https://api.github.com/users/tk0miya/followers","following_url":"https://api.github.com/users/tk0miya/following{/other_user}","gists_url":"https://api.github.com/users/tk0miya/gists{/gist_id}","starred_url":"https://api.github.com/users/tk0miya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tk0miya/subscriptions","organizations_url":"https://api.github.com/users/tk0miya/orgs","repos_url":"https://api.github.com/users/tk0miya/repos","events_url":"https://api.github.com/users/tk0miya/events{/privacy}","received_events_url":"https://api.github.com/users/tk0miya/received_events","type":"User","site_admin":false},"body":"This is fix for #2022.\r\n@shimizukawa could you review this please?","created_at":"2016-01-15T12:02:46Z","updated_at":"2016-01-24T09:33:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a717271641b80520243019cada496e8317ac5d4","assignee":{"login":"tk0miya","id":748828,"avatar_url":"https://avatars.githubusercontent.com/u/748828?v=3","gravatar_id":"","url":"https://api.github.com/users/tk0miya","html_url":"https://github.com/tk0miya","followers_url":"https://api.github.com/users/tk0miya/followers","following_url":"https://api.github.com/users/tk0miya/following{/other_user}","gists_url":"https://api.github.com/users/tk0miya/gists{/gist_id}","starred_url":"https://api.github.com/users/tk0miya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tk0miya/subscriptions","organizations_url":"https://api.github.com/users/tk0miya/orgs","repos_url":"https://api.github.com/users/tk0miya/repos","events_url":"https://api.github.com/users/tk0miya/events{/privacy}","received_events_url":"https://api.github.com/users/tk0miya/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/milestones/7","html_url":"https://github.com/sphinx-doc/sphinx/milestones/1.4","labels_url":"https://api.github.com/repos/sphinx-doc/sphinx/milestones/7/labels","id":920214,"number":7,"title":"1.4","description":"","creator":{"login":"shimizukawa","id":151623,"avatar_url":"https://avatars.githubusercontent.com/u/151623?v=3","gravatar_id":"","url":"https://api.github.com/users/shimizukawa","html_url":"https://github.com/shimizukawa","followers_url":"https://api.github.com/users/shimizukawa/followers","following_url":"https://api.github.com/users/shimizukawa/following{/other_user}","gists_url":"https://api.github.com/users/shimizukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/shimizukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shimizukawa/subscriptions","organizations_url":"https://api.github.com/users/shimizukawa/orgs","repos_url":"https://api.github.com/users/shimizukawa/repos","events_url":"https://api.github.com/users/shimizukawa/events{/privacy}","received_events_url":"https://api.github.com/users/shimizukawa/received_events","type":"User","site_admin":false},"open_issues":50,"closed_issues":32,"state":"open","created_at":"2015-01-03T02:03:41Z","updated_at":"2016-01-24T06:49:46Z","due_on":"2016-02-07T15:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237/commits","review_comments_url":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237/comments","review_comment_url":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2237/comments","statuses_url":"https://api.github.com/repos/sphinx-doc/sphinx/statuses/c55cc06fb55d436bedfdcade4a46216c54597bb1","head":{"label":"tk0miya:2022_copy_dotfiles_in_html_extra_path","ref":"2022_copy_dotfiles_in_html_extra_path","sha":"c55cc06fb55d436bedfdcade4a46216c54597bb1","user":{"login":"tk0miya","id":748828,"avatar_url":"https://avatars.githubusercontent.com/u/748828?v=3","gravatar_id":"","url":"https://api.github.com/users/tk0miya","html_url":"https://github.com/tk0miya","followers_url":"https://api.github.com/users/tk0miya/followers","following_url":"https://api.github.com/users/tk0miya/following{/other_user}","gists_url":"https://api.github.com/users/tk0miya/gists{/gist_id}","starred_url":"https://api.github.com/users/tk0miya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tk0miya/subscriptions","organizations_url":"https://api.github.com/users/tk0miya/orgs","repos_url":"https://api.github.com/users/tk0miya/repos","events_url":"https://api.github.com/users/tk0miya/events{/privacy}","received_events_url":"https://api.github.com/users/tk0miya/received_events","type":"User","site_admin":false},"repo":{"id":48524066,"name":"sphinx","full_name":"tk0miya/sphinx","owner":{"login":"tk0miya","id":748828,"avatar_url":"https://avatars.githubusercontent.com/u/748828?v=3","gravatar_id":"","url":"https://api.github.com/users/tk0miya","html_url":"https://github.com/tk0miya","followers_url":"https://api.github.com/users/tk0miya/followers","following_url":"https://api.github.com/users/tk0miya/following{/other_user}","gists_url":"https://api.github.com/users/tk0miya/gists{/gist_id}","starred_url":"https://api.github.com/users/tk0miya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tk0miya/subscriptions","organizations_url":"https://api.github.com/users/tk0miya/orgs","repos_url":"https://api.github.com/users/tk0miya/repos","events_url":"https://api.github.com/users/tk0miya/events{/privacy}","received_events_url":"https://api.github.com/users/tk0miya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tk0miya/sphinx","description":"Main repository for the Sphinx documentation builder","fork":true,"url":"https://api.github.com/repos/tk0miya/sphinx","forks_url":"https://api.github.com/repos/tk0miya/sphinx/forks","keys_url":"https://api.github.com/repos/tk0miya/sphinx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tk0miya/sphinx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tk0miya/sphinx/teams","hooks_url":"https://api.github.com/repos/tk0miya/sphinx/hooks","issue_events_url":"https://api.github.com/repos/tk0miya/sphinx/issues/events{/number}","events_url":"https://api.github.com/repos/tk0miya/sphinx/events","assignees_url":"https://api.github.com/repos/tk0miya/sphinx/assignees{/user}","branches_url":"https://api.github.com/repos/tk0miya/sphinx/branches{/branch}","tags_url":"https://api.github.com/repos/tk0miya/sphinx/tags","blobs_url":"https://api.github.com/repos/tk0miya/sphinx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tk0miya/sphinx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tk0miya/sphinx/git/refs{/sha}","trees_url":"https://api.github.com/repos/tk0miya/sphinx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tk0miya/sphinx/statuses/{sha}","languages_url":"https://api.github.com/repos/tk0miya/sphinx/languages","stargazers_url":"https://api.github.com/repos/tk0miya/sphinx/stargazers","contributors_url":"https://api.github.com/repos/tk0miya/sphinx/contributors","subscribers_url":"https://api.github.com/repos/tk0miya/sphinx/subscribers","subscription_url":"https://api.github.com/repos/tk0miya/sphinx/subscription","commits_url":"https://api.github.com/repos/tk0miya/sphinx/commits{/sha}","git_commits_url":"https://api.github.com/repos/tk0miya/sphinx/git/commits{/sha}","comments_url":"https://api.github.com/repos/tk0miya/sphinx/comments{/number}","issue_comment_url":"https://api.github.com/repos/tk0miya/sphinx/issues/comments{/number}","contents_url":"https://api.github.com/repos/tk0miya/sphinx/contents/{+path}","compare_url":"https://api.github.com/repos/tk0miya/sphinx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tk0miya/sphinx/merges","archive_url":"https://api.github.com/repos/tk0miya/sphinx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tk0miya/sphinx/downloads","issues_url":"https://api.github.com/repos/tk0miya/sphinx/issues{/number}","pulls_url":"https://api.github.com/repos/tk0miya/sphinx/pulls{/number}","milestones_url":"https://api.github.com/repos/tk0miya/sphinx/milestones{/number}","notifications_url":"https://api.github.com/repos/tk0miya/sphinx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tk0miya/sphinx/labels{/name}","releases_url":"https://api.github.com/repos/tk0miya/sphinx/releases{/id}","deployments_url":"https://api.github.com/repos/tk0miya/sphinx/deployments","created_at":"2015-12-24T04:03:04Z","updated_at":"2015-12-24T04:03:06Z","pushed_at":"2016-01-20T01:41:47Z","git_url":"git://github.com/tk0miya/sphinx.git","ssh_url":"git@github.com:tk0miya/sphinx.git","clone_url":"https://github.com/tk0miya/sphinx.git","svn_url":"https://github.com/tk0miya/sphinx","homepage":"http://sphinx-doc.org","size":13810,"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":"sphinx-doc:master","ref":"master","sha":"b0e02b4a12873409ee11040ebfbd6b88e7b24dbd","user":{"login":"sphinx-doc","id":9928167,"avatar_url":"https://avatars.githubusercontent.com/u/9928167?v=3","gravatar_id":"","url":"https://api.github.com/users/sphinx-doc","html_url":"https://github.com/sphinx-doc","followers_url":"https://api.github.com/users/sphinx-doc/followers","following_url":"https://api.github.com/users/sphinx-doc/following{/other_user}","gists_url":"https://api.github.com/users/sphinx-doc/gists{/gist_id}","starred_url":"https://api.github.com/users/sphinx-doc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphinx-doc/subscriptions","organizations_url":"https://api.github.com/users/sphinx-doc/orgs","repos_url":"https://api.github.com/users/sphinx-doc/repos","events_url":"https://api.github.com/users/sphinx-doc/events{/privacy}","received_events_url":"https://api.github.com/users/sphinx-doc/received_events","type":"Organization","site_admin":false},"repo":{"id":28710753,"name":"sphinx","full_name":"sphinx-doc/sphinx","owner":{"login":"sphinx-doc","id":9928167,"avatar_url":"https://avatars.githubusercontent.com/u/9928167?v=3","gravatar_id":"","url":"https://api.github.com/users/sphinx-doc","html_url":"https://github.com/sphinx-doc","followers_url":"https://api.github.com/users/sphinx-doc/followers","following_url":"https://api.github.com/users/sphinx-doc/following{/other_user}","gists_url":"https://api.github.com/users/sphinx-doc/gists{/gist_id}","starred_url":"https://api.github.com/users/sphinx-doc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphinx-doc/subscriptions","organizations_url":"https://api.github.com/users/sphinx-doc/orgs","repos_url":"https://api.github.com/users/sphinx-doc/repos","events_url":"https://api.github.com/users/sphinx-doc/events{/privacy}","received_events_url":"https://api.github.com/users/sphinx-doc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sphinx-doc/sphinx","description":"Main repository for the Sphinx documentation builder","fork":false,"url":"https://api.github.com/repos/sphinx-doc/sphinx","forks_url":"https://api.github.com/repos/sphinx-doc/sphinx/forks","keys_url":"https://api.github.com/repos/sphinx-doc/sphinx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sphinx-doc/sphinx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sphinx-doc/sphinx/teams","hooks_url":"https://api.github.com/repos/sphinx-doc/sphinx/hooks","issue_events_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/events{/number}","events_url":"https://api.github.com/repos/sphinx-doc/sphinx/events","assignees_url":"https://api.github.com/repos/sphinx-doc/sphinx/assignees{/user}","branches_url":"https://api.github.com/repos/sphinx-doc/sphinx/branches{/branch}","tags_url":"https://api.github.com/repos/sphinx-doc/sphinx/tags","blobs_url":"https://api.github.com/repos/sphinx-doc/sphinx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sphinx-doc/sphinx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sphinx-doc/sphinx/git/refs{/sha}","trees_url":"https://api.github.com/repos/sphinx-doc/sphinx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sphinx-doc/sphinx/statuses/{sha}","languages_url":"https://api.github.com/repos/sphinx-doc/sphinx/languages","stargazers_url":"https://api.github.com/repos/sphinx-doc/sphinx/stargazers","contributors_url":"https://api.github.com/repos/sphinx-doc/sphinx/contributors","subscribers_url":"https://api.github.com/repos/sphinx-doc/sphinx/subscribers","subscription_url":"https://api.github.com/repos/sphinx-doc/sphinx/subscription","commits_url":"https://api.github.com/repos/sphinx-doc/sphinx/commits{/sha}","git_commits_url":"https://api.github.com/repos/sphinx-doc/sphinx/git/commits{/sha}","comments_url":"https://api.github.com/repos/sphinx-doc/sphinx/comments{/number}","issue_comment_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/comments{/number}","contents_url":"https://api.github.com/repos/sphinx-doc/sphinx/contents/{+path}","compare_url":"https://api.github.com/repos/sphinx-doc/sphinx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sphinx-doc/sphinx/merges","archive_url":"https://api.github.com/repos/sphinx-doc/sphinx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sphinx-doc/sphinx/downloads","issues_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues{/number}","pulls_url":"https://api.github.com/repos/sphinx-doc/sphinx/pulls{/number}","milestones_url":"https://api.github.com/repos/sphinx-doc/sphinx/milestones{/number}","notifications_url":"https://api.github.com/repos/sphinx-doc/sphinx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sphinx-doc/sphinx/labels{/name}","releases_url":"https://api.github.com/repos/sphinx-doc/sphinx/releases{/id}","deployments_url":"https://api.github.com/repos/sphinx-doc/sphinx/deployments","created_at":"2015-01-02T10:53:28Z","updated_at":"2016-01-23T09:35:53Z","pushed_at":"2016-01-24T08:32:26Z","git_url":"git://github.com/sphinx-doc/sphinx.git","ssh_url":"git@github.com:sphinx-doc/sphinx.git","clone_url":"https://github.com/sphinx-doc/sphinx.git","svn_url":"https://github.com/sphinx-doc/sphinx","homepage":"http://sphinx-doc.org","size":16193,"stargazers_count":526,"watchers_count":526,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":273,"mirror_url":null,"open_issues_count":486,"forks":273,"open_issues":486,"watchers":526,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237"},"html":{"href":"https://github.com/sphinx-doc/sphinx/pull/2237"},"issue":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2237"},"comments":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2237/comments"},"review_comments":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237/comments"},"review_comment":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/pulls/2237/commits"},"statuses":{"href":"https://api.github.com/repos/sphinx-doc/sphinx/statuses/c55cc06fb55d436bedfdcade4a46216c54597bb1"}}}}