{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/839","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/839/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/839/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/839/events","html_url":"https://github.com/bazelbuild/bazel/issues/839","id":130767266,"number":839,"title":"pkg_tar fails for non-empty WORKSPACE name","user":{"login":"baranov1ch","id":444371,"avatar_url":"https://avatars.githubusercontent.com/u/444371?v=3","gravatar_id":"","url":"https://api.github.com/users/baranov1ch","html_url":"https://github.com/baranov1ch","followers_url":"https://api.github.com/users/baranov1ch/followers","following_url":"https://api.github.com/users/baranov1ch/following{/other_user}","gists_url":"https://api.github.com/users/baranov1ch/gists{/gist_id}","starred_url":"https://api.github.com/users/baranov1ch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baranov1ch/subscriptions","organizations_url":"https://api.github.com/users/baranov1ch/orgs","repos_url":"https://api.github.com/users/baranov1ch/repos","events_url":"https://api.github.com/users/baranov1ch/events{/privacy}","received_events_url":"https://api.github.com/users/baranov1ch/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bazelbuild/bazel/labels/skylark%20build%20defs","name":"skylark build defs","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-02T18:10:23Z","updated_at":"2016-02-03T11:22:47Z","closed_at":"2016-02-03T11:22:47Z","body":"$ cat ~/.bazelrc\r\n```\r\nbuild --package_path %workspace%:/home/ME/.bazel/base_workspace\r\nfetch --package_path %workspace%:/home/ME/.bazel/base_workspace\r\nquery --package_path %workspace%:/home/ME/.bazel/base_workspace\r\n```\r\n\r\n$ tree testworkspace/\r\n```\r\ntestworkspace/\r\n├── project\r\n│   ├── BUILD\r\n│   └── test.dat\r\n└── WORKSPACE\r\n```\r\n\r\n\r\n$ cat testworkspace/project/BUILD\r\n```\r\nload(\"/tools/build_defs/pkg/pkg\", \"pkg_tar\", \"pkg_deb\")\r\n\r\npkg_tar(\r\n  name = \"mytar\",\r\n  files = [\":test.dat\"],\r\n  mode = \"0644\",\r\n  package_dir = \"/etc\",\r\n  strip_prefix = \".\",\r\n)\r\n```\r\n\r\nif WORKSPACE has no defined name, `bazel build project:mytar` works, but if I add\r\n`workspace(name = \"some_name\")`, I get the following:\r\n\r\n```\r\n$ bazel build project:mytar\r\nINFO: Found 1 target...\r\nINFO: From PackageTar project/mytar.tar:\r\nTraceback (most recent call last):\r\n  File \"/home/ME/.cache/bazel/_bazel_ME/ac5808b3a8506b42e48da403f962b013/testworkspace/bazel-out/host/bin/tools/build_defs/pkg/build_tar.runfiles/some_name/tools/build_defs/pkg/build_tar.py\", line 22, in <module>\r\n    from tools.build_defs.pkg import archive\r\nImportError: No module named tools.build_defs.pkg\r\nERROR: /home/ME/testworkspace/project/BUILD:3:1: null failed: build_tar failed: error executing command bazel-out/host/bin/tools/build_defs/pkg/build_tar '--output=bazel-out/local_linux-fastbuild/bin/project/mytar.tar' '--directory=/etc' '--mode=0644' '--file=project/test.dat=/test.dat'.\r\nTarget //project:mytar failed to build\r\nUse --verbose_failures to see the command lines of failed build steps.\r\n```\r\n\r\nBazel adds `some_name` into **.runfiles** directory, but python binary template does not handle it when setting `PYTHONPATH` (https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt#L45)"},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/179175816","html_url":"https://github.com/bazelbuild/bazel/issues/839#issuecomment-179175816","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/839","id":179175816,"user":{"login":"damienmg","id":3721087,"avatar_url":"https://avatars.githubusercontent.com/u/3721087?v=3","gravatar_id":"","url":"https://api.github.com/users/damienmg","html_url":"https://github.com/damienmg","followers_url":"https://api.github.com/users/damienmg/followers","following_url":"https://api.github.com/users/damienmg/following{/other_user}","gists_url":"https://api.github.com/users/damienmg/gists{/gist_id}","starred_url":"https://api.github.com/users/damienmg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damienmg/subscriptions","organizations_url":"https://api.github.com/users/damienmg/orgs","repos_url":"https://api.github.com/users/damienmg/repos","events_url":"https://api.github.com/users/damienmg/events{/privacy}","received_events_url":"https://api.github.com/users/damienmg/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T11:22:47Z","updated_at":"2016-02-03T11:22:47Z","body":"Closing as this is solved at HEAD"}}