@@ -123,45 +123,6 @@ def _python_repository_impl(rctx):
123123 logger = logger ,
124124 )
125125
126- # Make the Python installation read-only. This is to prevent issues due to
127- # pycs being generated at runtime:
128- # * The pycs are not deterministic (they contain timestamps)
129- # * Multiple processes trying to write the same pycs can result in errors.
130- #
131- # Note, when on Windows the `chmod` may not work
132- if "windows" not in platform and "windows" != repo_utils .get_platforms_os_name (rctx ):
133- repo_utils .execute_checked (
134- rctx ,
135- op = "python_repository.MakeReadOnly" ,
136- arguments = [repo_utils .which_checked (rctx , "chmod" ), "-R" , "ugo-w" , "lib" ],
137- logger = logger ,
138- )
139-
140- # If the user is not ignoring the warnings, then proceed to run a check,
141- # otherwise these steps can be skipped, as they both result in some warning.
142- if not rctx .attr .ignore_root_user_error :
143- exec_result = repo_utils .execute_unchecked (
144- rctx ,
145- op = "python_repository.TestReadOnly" ,
146- arguments = [repo_utils .which_checked (rctx , "touch" ), "lib/.test" ],
147- logger = logger ,
148- )
149-
150- # The issue with running as root is the installation is no longer
151- # read-only, so the problems due to pyc can resurface.
152- if exec_result .return_code == 0 :
153- stdout = repo_utils .execute_checked_stdout (
154- rctx ,
155- op = "python_repository.GetUserId" ,
156- arguments = [repo_utils .which_checked (rctx , "id" ), "-u" ],
157- logger = logger ,
158- )
159- uid = int (stdout .strip ())
160- if uid == 0 :
161- logger .warn ("The current user is root, which can cause spurious cache misses or build failures with the hermetic Python interpreter. See https://github.com/bazel-contrib/rules_python/pull/713." )
162- else :
163- logger .warn ("The current user has CAP_DAC_OVERRIDE set, which can cause spurious cache misses or build failures with the hermetic Python interpreter. See https://github.com/bazel-contrib/rules_python/pull/713." )
164-
165126 python_bin = "python.exe" if ("windows" in platform ) else "bin/python3"
166127
167128 if "linux" in platform :
@@ -186,17 +147,15 @@ def _python_repository_impl(rctx):
186147 break
187148
188149 glob_include = []
189- glob_exclude = []
190- if rctx .attr .ignore_root_user_error or "windows" in platform :
191- glob_exclude += [
192- # These pycache files are created on first use of the associated python files.
193- # Exclude them from the glob because otherwise between the first time and second time a python toolchain is used,"
194- # the definition of this filegroup will change, and depending rules will get invalidated."
195- # See https://github.com/bazel-contrib/rules_python/issues/1008 for unconditionally adding these to toolchains so we can stop ignoring them."
196- # pyc* is ignored because pyc creation creates temporary .pyc.NNNN files
197- "**/__pycache__/*.pyc*" ,
198- "**/__pycache__/*.pyo*" ,
199- ]
150+ glob_exclude = [
151+ # These pycache files are created on first use of the associated python files.
152+ # Exclude them from the glob because otherwise between the first time and second time a python toolchain is used,"
153+ # the definition of this filegroup will change, and depending rules will get invalidated."
154+ # See https://github.com/bazel-contrib/rules_python/issues/1008 for unconditionally adding these to toolchains so we can stop ignoring them."
155+ # pyc* is ignored because pyc creation creates temporary .pyc.NNNN files
156+ "**/__pycache__/*.pyc*" ,
157+ "**/__pycache__/*.pyo*" ,
158+ ]
200159
201160 if "windows" in platform :
202161 glob_include += [
@@ -249,7 +208,6 @@ define_hermetic_runtime_toolchain_impl(
249208 "coverage_tool" : rctx .attr .coverage_tool ,
250209 "distutils" : rctx .attr .distutils ,
251210 "distutils_content" : rctx .attr .distutils_content ,
252- "ignore_root_user_error" : rctx .attr .ignore_root_user_error ,
253211 "name" : rctx .attr .name ,
254212 "netrc" : rctx .attr .netrc ,
255213 "patch_strip" : rctx .attr .patch_strip ,
@@ -299,7 +257,7 @@ For more information see {attr}`py_runtime.coverage_tool`.
299257 ),
300258 "ignore_root_user_error" : attr .bool (
301259 default = True ,
302- doc = "Whether the check for root should be ignored or not. This causes cache misses with .pyc files. " ,
260+ doc = "Noop, will be removed in the next major release " ,
303261 mandatory = False ,
304262 ),
305263 "netrc" : attr .string (
0 commit comments