@@ -110,7 +110,8 @@ def _python_repository_impl(rctx):
110110 # Make the Python installation read-only.
111111 if not rctx .attr .ignore_root_user_error :
112112 if "windows" not in rctx .os .name :
113- exec_result = rctx .execute (["chmod" , "-R" , "ugo-w" , "lib" ])
113+ lib_dir = "lib" if "windows" not in platform else "Lib"
114+ exec_result = rctx .execute (["chmod" , "-R" , "ugo-w" , lib_dir ])
114115 if exec_result .return_code != 0 :
115116 fail_msg = "Failed to make interpreter installation read-only. 'chmod' error msg: {}" .format (
116117 exec_result .stderr ,
@@ -131,6 +132,29 @@ def _python_repository_impl(rctx):
131132
132133 python_bin = "python.exe" if ("windows" in platform ) else "bin/python3"
133134
135+ if "windows" in platform :
136+ glob_include = [
137+ "*.exe" ,
138+ "*.dll" ,
139+ "bin/**" ,
140+ "DLLs/**" ,
141+ "extensions/**" ,
142+ "include/**" ,
143+ "Lib/**" ,
144+ "libs/**" ,
145+ "Scripts/**" ,
146+ "share/**" ,
147+ ]
148+ else :
149+ glob_include = [
150+ "bin/**" ,
151+ "extensions/**" ,
152+ "include/**" ,
153+ "lib/**" ,
154+ "libs/**" ,
155+ "share/**" ,
156+ ]
157+
134158 build_content = """\
135159 # Generated by python/repositories.bzl
136160
@@ -141,18 +165,7 @@ package(default_visibility = ["//visibility:public"])
141165filegroup(
142166 name = "files",
143167 srcs = glob(
144- include = [
145- "*.exe",
146- "*.dll",
147- "bin/**",
148- "DLLs/**",
149- "extensions/**",
150- "include/**",
151- "lib/**",
152- "libs/**",
153- "Scripts/**",
154- "share/**",
155- ],
168+ include = {glob_include},
156169 # Platform-agnostic filegroup can't match on all patterns.
157170 allow_empty = True,
158171 exclude = [
@@ -206,6 +219,7 @@ py_runtime_pair(
206219 py3_runtime = ":py3_runtime",
207220)
208221""" .format (
222+ glob_include = repr (glob_include ),
209223 python_path = python_bin ,
210224 python_version = python_short_version ,
211225 )
0 commit comments