{"action":"created","comment":{"url":"https://api.github.com/repos/pantsbuild/pex/pulls/comments/28362871","id":28362871,"diff_hunk":"@@ -41,6 +41,32 @@ def zipsafe(dist):\n       return False\n \n   @classmethod\n+  def access_zipped_assets(cls, static_module_name, static_path, asset_path, dir_location='.'):\n+    \"\"\"\n+    Create a copy of static resource files as we can't serve\n+    them from within the pex file.\n+\n+    :param static_module_name: Module name containing module to cache in a tempdir\n+    :type static_module_name: string in the form of 'twitter.common.zookeeper'\n+    :param static_path: Module name of the form 'serverset'\n+    :param asset_path: Initially a module name that's the same as the static_path, but will be\n+        changed to walk the directory tree\n+    :param dir_location: directory to create a new temporary directory in\n+    \"\"\"\n+    temp_dir = safe_mkdtemp(dir=dir_location)\n+    for asset in resource_listdir(static_module_name, asset_path):\n+      asset_target = os.path.join(os.path.relpath(asset_path, static_path), asset)[2:]","path":"pex/util.py","position":38,"original_position":30,"commit_id":"94c335ae498a9f5d031b5ba64cd58bdf3ffe9a97","original_commit_id":"354064e85f799dc48e099ad5106483d9b1514c8d","user":{"login":"Yasumoto","id":48383,"avatar_url":"https://avatars.githubusercontent.com/u/48383?v=3","gravatar_id":"","url":"https://api.github.com/users/Yasumoto","html_url":"https://github.com/Yasumoto","followers_url":"https://api.github.com/users/Yasumoto/followers","following_url":"https://api.github.com/users/Yasumoto/following{/other_user}","gists_url":"https://api.github.com/users/Yasumoto/gists{/gist_id}","starred_url":"https://api.github.com/users/Yasumoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yasumoto/subscriptions","organizations_url":"https://api.github.com/users/Yasumoto/orgs","repos_url":"https://api.github.com/users/Yasumoto/repos","events_url":"https://api.github.com/users/Yasumoto/events{/privacy}","received_events_url":"https://api.github.com/users/Yasumoto/received_events","type":"User","site_admin":false},"body":"It's gotta remote a `./` which prepends the file name. It looks like this before/after the `[2:]`\r\n```\r\n./mod.py\r\nmod.py\r\n./mod.pyc\r\nmod.pyc\r\n./__init__.py\r\n__init__.py\r\n```\r\n\r\nI've swapped this to use `os.path.normpath` to get what I'm actually looking for here.\r\n\r\nHappy for other suggestions though.","created_at":"2015-04-14T19:43:21Z","updated_at":"2015-04-14T19:43:21Z","html_url":"https://github.com/pantsbuild/pex/pull/20#discussion_r28362871","pull_request_url":"https://api.github.com/repos/pantsbuild/pex/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/pantsbuild/pex/pulls/comments/28362871"},"html":{"href":"https://github.com/pantsbuild/pex/pull/20#discussion_r28362871"},"pull_request":{"href":"https://api.github.com/repos/pantsbuild/pex/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/pantsbuild/pex/pulls/20","id":22974117,"html_url":"https://github.com/pantsbuild/pex/pull/20","diff_url":"https://github.com/pantsbuild/pex/pull/20.diff","patch_url":"https://github.com/pantsbuild/pex/pull/20.patch","issue_url":"https://api.github.com/repos/pantsbuild/pex/issues/20","number":20,"state":"open","locked":false,"title":"Helper method to access files within a zipped pex","user":{"login":"Yasumoto","id":48383,"avatar_url":"https://avatars.githubusercontent.com/u/48383?v=3","gravatar_id":"","url":"https://api.github.com/users/Yasumoto","html_url":"https://github.com/Yasumoto","followers_url":"https://api.github.com/users/Yasumoto/followers","following_url":"https://api.github.com/users/Yasumoto/following{/other_user}","gists_url":"https://api.github.com/users/Yasumoto/gists{/gist_id}","starred_url":"https://api.github.com/users/Yasumoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yasumoto/subscriptions","organizations_url":"https://api.github.com/users/Yasumoto/orgs","repos_url":"https://api.github.com/users/Yasumoto/repos","events_url":"https://api.github.com/users/Yasumoto/events{/privacy}","received_events_url":"https://api.github.com/users/Yasumoto/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-18T22:59:37Z","updated_at":"2015-04-14T19:43:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b203cd8139c353d02efcfc7a83d4e8b651b8b9e0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pantsbuild/pex/pulls/20/commits","review_comments_url":"https://api.github.com/repos/pantsbuild/pex/pulls/20/comments","review_comment_url":"https://api.github.com/repos/pantsbuild/pex/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pantsbuild/pex/issues/20/comments","statuses_url":"https://api.github.com/repos/pantsbuild/pex/statuses/94c335ae498a9f5d031b5ba64cd58bdf3ffe9a97","head":{"label":"Yasumoto:jsmith/access_zipped_assets","ref":"jsmith/access_zipped_assets","sha":"94c335ae498a9f5d031b5ba64cd58bdf3ffe9a97","user":{"login":"Yasumoto","id":48383,"avatar_url":"https://avatars.githubusercontent.com/u/48383?v=3","gravatar_id":"","url":"https://api.github.com/users/Yasumoto","html_url":"https://github.com/Yasumoto","followers_url":"https://api.github.com/users/Yasumoto/followers","following_url":"https://api.github.com/users/Yasumoto/following{/other_user}","gists_url":"https://api.github.com/users/Yasumoto/gists{/gist_id}","starred_url":"https://api.github.com/users/Yasumoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yasumoto/subscriptions","organizations_url":"https://api.github.com/users/Yasumoto/orgs","repos_url":"https://api.github.com/users/Yasumoto/repos","events_url":"https://api.github.com/users/Yasumoto/events{/privacy}","received_events_url":"https://api.github.com/users/Yasumoto/received_events","type":"User","site_admin":false},"repo":{"id":24120087,"name":"pex","full_name":"Yasumoto/pex","owner":{"login":"Yasumoto","id":48383,"avatar_url":"https://avatars.githubusercontent.com/u/48383?v=3","gravatar_id":"","url":"https://api.github.com/users/Yasumoto","html_url":"https://github.com/Yasumoto","followers_url":"https://api.github.com/users/Yasumoto/followers","following_url":"https://api.github.com/users/Yasumoto/following{/other_user}","gists_url":"https://api.github.com/users/Yasumoto/gists{/gist_id}","starred_url":"https://api.github.com/users/Yasumoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yasumoto/subscriptions","organizations_url":"https://api.github.com/users/Yasumoto/orgs","repos_url":"https://api.github.com/users/Yasumoto/repos","events_url":"https://api.github.com/users/Yasumoto/events{/privacy}","received_events_url":"https://api.github.com/users/Yasumoto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Yasumoto/pex","description":"A library and tool for generating .pex (Python EXecutable) files","fork":true,"url":"https://api.github.com/repos/Yasumoto/pex","forks_url":"https://api.github.com/repos/Yasumoto/pex/forks","keys_url":"https://api.github.com/repos/Yasumoto/pex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yasumoto/pex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yasumoto/pex/teams","hooks_url":"https://api.github.com/repos/Yasumoto/pex/hooks","issue_events_url":"https://api.github.com/repos/Yasumoto/pex/issues/events{/number}","events_url":"https://api.github.com/repos/Yasumoto/pex/events","assignees_url":"https://api.github.com/repos/Yasumoto/pex/assignees{/user}","branches_url":"https://api.github.com/repos/Yasumoto/pex/branches{/branch}","tags_url":"https://api.github.com/repos/Yasumoto/pex/tags","blobs_url":"https://api.github.com/repos/Yasumoto/pex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yasumoto/pex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yasumoto/pex/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yasumoto/pex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yasumoto/pex/statuses/{sha}","languages_url":"https://api.github.com/repos/Yasumoto/pex/languages","stargazers_url":"https://api.github.com/repos/Yasumoto/pex/stargazers","contributors_url":"https://api.github.com/repos/Yasumoto/pex/contributors","subscribers_url":"https://api.github.com/repos/Yasumoto/pex/subscribers","subscription_url":"https://api.github.com/repos/Yasumoto/pex/subscription","commits_url":"https://api.github.com/repos/Yasumoto/pex/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yasumoto/pex/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yasumoto/pex/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yasumoto/pex/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yasumoto/pex/contents/{+path}","compare_url":"https://api.github.com/repos/Yasumoto/pex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yasumoto/pex/merges","archive_url":"https://api.github.com/repos/Yasumoto/pex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yasumoto/pex/downloads","issues_url":"https://api.github.com/repos/Yasumoto/pex/issues{/number}","pulls_url":"https://api.github.com/repos/Yasumoto/pex/pulls{/number}","milestones_url":"https://api.github.com/repos/Yasumoto/pex/milestones{/number}","notifications_url":"https://api.github.com/repos/Yasumoto/pex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yasumoto/pex/labels{/name}","releases_url":"https://api.github.com/repos/Yasumoto/pex/releases{/id}","created_at":"2014-09-16T22:21:22Z","updated_at":"2015-03-11T15:52:34Z","pushed_at":"2015-04-14T19:36:50Z","git_url":"git://github.com/Yasumoto/pex.git","ssh_url":"git@github.com:Yasumoto/pex.git","clone_url":"https://github.com/Yasumoto/pex.git","svn_url":"https://github.com/Yasumoto/pex","homepage":"","size":623,"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":"pantsbuild:master","ref":"master","sha":"0edb470996718a4c6b6662827c929017974ee682","user":{"login":"pantsbuild","id":3065172,"avatar_url":"https://avatars.githubusercontent.com/u/3065172?v=3","gravatar_id":"","url":"https://api.github.com/users/pantsbuild","html_url":"https://github.com/pantsbuild","followers_url":"https://api.github.com/users/pantsbuild/followers","following_url":"https://api.github.com/users/pantsbuild/following{/other_user}","gists_url":"https://api.github.com/users/pantsbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/pantsbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pantsbuild/subscriptions","organizations_url":"https://api.github.com/users/pantsbuild/orgs","repos_url":"https://api.github.com/users/pantsbuild/repos","events_url":"https://api.github.com/users/pantsbuild/events{/privacy}","received_events_url":"https://api.github.com/users/pantsbuild/received_events","type":"Organization","site_admin":false},"repo":{"id":22072746,"name":"pex","full_name":"pantsbuild/pex","owner":{"login":"pantsbuild","id":3065172,"avatar_url":"https://avatars.githubusercontent.com/u/3065172?v=3","gravatar_id":"","url":"https://api.github.com/users/pantsbuild","html_url":"https://github.com/pantsbuild","followers_url":"https://api.github.com/users/pantsbuild/followers","following_url":"https://api.github.com/users/pantsbuild/following{/other_user}","gists_url":"https://api.github.com/users/pantsbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/pantsbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pantsbuild/subscriptions","organizations_url":"https://api.github.com/users/pantsbuild/orgs","repos_url":"https://api.github.com/users/pantsbuild/repos","events_url":"https://api.github.com/users/pantsbuild/events{/privacy}","received_events_url":"https://api.github.com/users/pantsbuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pantsbuild/pex","description":"A library and tool for generating .pex (Python EXecutable) files","fork":false,"url":"https://api.github.com/repos/pantsbuild/pex","forks_url":"https://api.github.com/repos/pantsbuild/pex/forks","keys_url":"https://api.github.com/repos/pantsbuild/pex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pantsbuild/pex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pantsbuild/pex/teams","hooks_url":"https://api.github.com/repos/pantsbuild/pex/hooks","issue_events_url":"https://api.github.com/repos/pantsbuild/pex/issues/events{/number}","events_url":"https://api.github.com/repos/pantsbuild/pex/events","assignees_url":"https://api.github.com/repos/pantsbuild/pex/assignees{/user}","branches_url":"https://api.github.com/repos/pantsbuild/pex/branches{/branch}","tags_url":"https://api.github.com/repos/pantsbuild/pex/tags","blobs_url":"https://api.github.com/repos/pantsbuild/pex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pantsbuild/pex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pantsbuild/pex/git/refs{/sha}","trees_url":"https://api.github.com/repos/pantsbuild/pex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pantsbuild/pex/statuses/{sha}","languages_url":"https://api.github.com/repos/pantsbuild/pex/languages","stargazers_url":"https://api.github.com/repos/pantsbuild/pex/stargazers","contributors_url":"https://api.github.com/repos/pantsbuild/pex/contributors","subscribers_url":"https://api.github.com/repos/pantsbuild/pex/subscribers","subscription_url":"https://api.github.com/repos/pantsbuild/pex/subscription","commits_url":"https://api.github.com/repos/pantsbuild/pex/commits{/sha}","git_commits_url":"https://api.github.com/repos/pantsbuild/pex/git/commits{/sha}","comments_url":"https://api.github.com/repos/pantsbuild/pex/comments{/number}","issue_comment_url":"https://api.github.com/repos/pantsbuild/pex/issues/comments{/number}","contents_url":"https://api.github.com/repos/pantsbuild/pex/contents/{+path}","compare_url":"https://api.github.com/repos/pantsbuild/pex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pantsbuild/pex/merges","archive_url":"https://api.github.com/repos/pantsbuild/pex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pantsbuild/pex/downloads","issues_url":"https://api.github.com/repos/pantsbuild/pex/issues{/number}","pulls_url":"https://api.github.com/repos/pantsbuild/pex/pulls{/number}","milestones_url":"https://api.github.com/repos/pantsbuild/pex/milestones{/number}","notifications_url":"https://api.github.com/repos/pantsbuild/pex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pantsbuild/pex/labels{/name}","releases_url":"https://api.github.com/repos/pantsbuild/pex/releases{/id}","created_at":"2014-07-21T17:06:12Z","updated_at":"2015-04-14T18:59:32Z","pushed_at":"2015-04-14T19:36:50Z","git_url":"git://github.com/pantsbuild/pex.git","ssh_url":"git@github.com:pantsbuild/pex.git","clone_url":"https://github.com/pantsbuild/pex.git","svn_url":"https://github.com/pantsbuild/pex","homepage":"","size":1225,"stargazers_count":84,"watchers_count":84,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":26,"forks":21,"open_issues":26,"watchers":84,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pantsbuild/pex/pulls/20"},"html":{"href":"https://github.com/pantsbuild/pex/pull/20"},"issue":{"href":"https://api.github.com/repos/pantsbuild/pex/issues/20"},"comments":{"href":"https://api.github.com/repos/pantsbuild/pex/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/pantsbuild/pex/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/pantsbuild/pex/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pantsbuild/pex/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/pantsbuild/pex/statuses/94c335ae498a9f5d031b5ba64cd58bdf3ffe9a97"}}}}