-
-
Notifications
You must be signed in to change notification settings - Fork 610
Fix download of Windows Python toolchain on Linux #769
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
Fix download of Windows Python toolchain on Linux #769
Conversation
I may need some help with the CI failure. The error is from
I don't see how this PR could have caused this, and I don't have a mac to test it on. |
Perhaps this is a flake? But MacOS is a case-insensitive filesystem by default so it can't distinguish the difference between |
Isn't that what this PR does? https://github.com/bazelbuild/rules_python/pull/769/files#diff-2772f4c795e29614d2ca3c7f3302d558abe63bae2379d65285bcdf12e4ea469fR112 |
Ah yes, I misread the lines changed. Would you be willing to rebase and see if the failure is a flake? |
I think I found the issue and it's that if you glob for diff --git a/python/repositories.bzl b/python/repositories.bzl
index 8bb8a9c..a1fd4cd 100644
--- a/python/repositories.bzl
+++ b/python/repositories.bzl
@@ -131,6 +131,29 @@ def _python_repository_impl(rctx):
python_bin = "python.exe" if ("windows" in platform) else "bin/python3"
+ if "windows" in platform:
+ glob_include = [
+ "*.exe",
+ "*.dll",
+ "bin/**",
+ "DLLs/**",
+ "extensions/**",
+ "include/**",
+ "Lib/**",
+ "libs/**",
+ "Scripts/**",
+ "share/**",
+ ]
+ else:
+ glob_include = [
+ "bin/**",
+ "extensions/**",
+ "include/**",
+ "lib/**",
+ "libs/**",
+ "share/**",
+ ]
+
build_content = """\
# Generated by python/repositories.bzl
@@ -141,18 +164,7 @@ package(default_visibility = ["//visibility:public"])
filegroup(
name = "files",
srcs = glob(
- include = [
- "*.exe",
- "*.dll",
- "bin/**",
- "DLLs/**",
- "extensions/**",
- "include/**",
- "lib/**",
- "libs/**",
- "Scripts/**",
- "share/**",
- ],
+ include = {glob_include},
# Platform-agnostic filegroup can't match on all patterns.
allow_empty = True,
exclude = [
@@ -206,6 +218,7 @@ py_runtime_pair(
py3_runtime = ":py3_runtime",
)
""".format(
+ glob_include = json.encode(glob_include),
python_path = python_bin,
python_version = python_short_version,
)
|
8507872
to
50ab2c6
Compare
…g up lib twice (as Lib) on macOS
@UebelAndre Good spot. That fixed it. Thanks! |
@groodt Do you have time to take a look at this one this week as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
python_repository
rule crashes with:Failed to make interpreter installation read-only. 'chmod' error msg: chmod: cannot access 'lib': No such file or directory
because thelib
directory is actually calledLib
Lib
directory causing no builtin libraries to be found when running the cross compiledpy_binary
.Issue Number: N/A
What is the new behavior?
python_repository
rule implementation doesn't crash.Lib
directory is included correctly.Does this PR introduce a breaking change?
Other information