@@ -5,36 +5,17 @@ load("//python/private:repo_utils.bzl", "repo_utils")
55def _runtime_env_repo_impl (rctx ):
66 pyenv = repo_utils .which_unchecked (rctx , "pyenv" ).binary
77 if pyenv != None :
8- ##main_project_python_version_file = rctx.path(rctx.attr._main_python_version_file)
9- ##if main_project_python_version_file.exists:
10- ## cwd = str(main_project_python_version_file.dirname)
11- ## print("run pyenv in", cwd)
12- ##else:
13- ## cwd = None
148 pyenv_version_file = repo_utils .execute_checked (
159 rctx ,
1610 op = "GetPyenvVersionFile" ,
1711 arguments = [pyenv , "version-file" ],
18- ## working_directory = cwd,
1912 ).stdout .strip ()
2013
2114 # When pyenv is used, the version file is what decided the
2215 # version used. Watch it so we compute the correct value if the
2316 # user changes it.
2417 rctx .watch (pyenv_version_file )
25- print ("watch:" , pyenv_version_file )
26- origin = repo_utils .execute_checked (
27- rctx ,
28- op = "GetPyenvVersionFile" ,
29- arguments = [pyenv , "version-origin" ],
30- ##working_directory = cwd,
31- ).stdout .strip ()
32- print ("origin:" , origin )
33- rctx .getenv ("PYENV_VERSION" )
3418
35- which = rctx .which ("python3" )
36- print ("py3 which:" , which )
37- rctx .execute
3819 version = repo_utils .execute_checked (
3920 rctx ,
4021 op = "GetPythonVersion" ,
@@ -52,13 +33,9 @@ def _runtime_env_repo_impl(rctx):
5233 "PYENV_VERSION" : "" ,
5334 },
5435 ).stdout .strip ()
55- print ("Detected Python version:" , version )
5636 rctx .file ("info.bzl" , "PYTHON_VERSION = '{}'\n " .format (version ))
5737 rctx .file ("BUILD.bazel" , "" )
5838
5939runtime_env_repo = repository_rule (
6040 implementation = _runtime_env_repo_impl ,
61- attrs = {
62- "_main_python_version_file" : attr .label (default = "@//:.python-version" ),
63- },
6441)
0 commit comments