@@ -110,7 +110,8 @@ def _python_repository_impl(rctx):
110
110
# Make the Python installation read-only.
111
111
if not rctx .attr .ignore_root_user_error :
112
112
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 ])
114
115
if exec_result .return_code != 0 :
115
116
fail_msg = "Failed to make interpreter installation read-only. 'chmod' error msg: {}" .format (
116
117
exec_result .stderr ,
@@ -131,6 +132,29 @@ def _python_repository_impl(rctx):
131
132
132
133
python_bin = "python.exe" if ("windows" in platform ) else "bin/python3"
133
134
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
+
134
158
build_content = """\
135
159
# Generated by python/repositories.bzl
136
160
@@ -141,18 +165,7 @@ package(default_visibility = ["//visibility:public"])
141
165
filegroup(
142
166
name = "files",
143
167
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},
156
169
# Platform-agnostic filegroup can't match on all patterns.
157
170
allow_empty = True,
158
171
exclude = [
@@ -206,6 +219,7 @@ py_runtime_pair(
206
219
py3_runtime = ":py3_runtime",
207
220
)
208
221
""" .format (
222
+ glob_include = repr (glob_include ),
209
223
python_path = python_bin ,
210
224
python_version = python_short_version ,
211
225
)
0 commit comments