-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is the generated dpkg_parser having a #!/usr/bin/python3 shebang? #434
Comments
This comment has been minimized.
This comment has been minimized.
Maybe that depends on where you build. Mine has
|
I'll give it to @chanseokoh , I get the same for I explored the issue a little bit more
I searched in the code a little and found the following chain:
Now we need to find how to use another dpkg_parser instead of this one. |
@kovkev ah, you were talking about the par binary stored in the GCS bucket. Now I remember that. I don't know any history behind why it's there or why the repo is using it instead of the generated dpkg_parser. |
I think it might have to do with the fact that, from within the WORSPACE, and from within the repository_rule, it is difficult to generate that file. It might be solveable in a two-step process. First, run a Very handwave-y explanation here, but I hope the general idea lands. |
It's kinda blocking OSX users... |
Someone on OSX on the Distroless Slack channel used some hacky workaround:
And @@ -4,6 +4,7 @@ par_binary(
name = "dpkg_parser",
srcs = glob(["**/*.py"]),
main = "dpkg_parser.py",
+ python_version = "PY2",
visibility = ["//visibility:public"],
deps = [
":parse_metadata", |
Hi! I have the same issue and it is very annoying on MacOS. There is no option to symlink Apple vendored their own certificate bundle for the system python. And now we have no easy way to workaround |
How about reverting that script back to |
@chanseokoh Following your steps, I get
|
According to google/subpar#87, you can override the interpreter when using the |
@chanseokoh @kovkev As an update to the comment made about building the file locally then sourcing it from within the package_manager.bzl file, turns out the http_rule(urls) supports files. If you're testing dpkg_parser locally, you can use something like this def package_manager_repositories():
http_file(
name = "dpkg_parser",
urls = [("file:///Users/cwalker/git/distroless/bazel-bin/package_manager/dpkg_parser.par")],
executable = True
) and ignore the sha256 (as that is a pain to remember to keep up-to-date). |
I did some more digging on this problem, and it seems that it goes deeper than It takes you to this comment: bazelbuild/bazel#4815 (comment) The TL;DR is that it's a lack of appropriate toolchain support for Python 2 and 3 which is truly portable, so there are some workarounds to consider. One approach is, as above, setting the Another way, as that comment says, would be to add a Example
Example
Invoke like so: You have a valid You still need to import |
There's a diagnosis and workaround available for macOS Catalina. |
Hmm, rereading through this thread, people may have different reasons for wanting to use different python installations. If you're trying to use an alternative Python because Bazel makes it difficult to use tools outside of I'm going to close this issue — please open new issues if there are other outstanding reasons for wanting to replace the interpreter. |
Re-opening: it may be that |
Finally, Distroless no longer downloads a pre-built dpkg_parser (#477) but instead will use one locally built from source. With the shebang fix (#479), I expect Mac users will no longer have trouble building Distroless without applying any kind of local hacks. Sync with master and follow the new build instructions in CONTRIBUTING.md. |
I see that |
@mariusgrigoriu it is an unfortunate consequence of this issue (from #477 (comment)):
And check #477 (comment) for the final decision. |
I don't have a file at /usr/bin/python3
The text was updated successfully, but these errors were encountered: