Skip to content

Commit 0357dad

Browse files
committed
cleanup
1 parent 44ce289 commit 0357dad

4 files changed

Lines changed: 4 additions & 38 deletions

File tree

python/private/py_executable.bzl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,6 @@ def _create_venv(ctx, output_prefix, imports, runtime_details, add_runfiles_root
526526
venvs_use_declare_symlink_enabled = (
527527
VenvsUseDeclareSymlinkFlag.get_value(ctx) == VenvsUseDeclareSymlinkFlag.YES
528528
)
529-
530-
# todo: default this to True for bootstrap=system_python ?
531529
recreate_venv_at_runtime = False
532530

533531
if runtime.interpreter:
@@ -549,12 +547,7 @@ def _create_venv(ctx, output_prefix, imports, runtime_details, add_runfiles_root
549547
# File object to figure out some paths.
550548
interpreter = ctx.actions.declare_file("{}/{}".format(bin_dir, py_exe_basename))
551549

552-
# todo: system_python not handling this case
553-
##ctx.actions.write(interpreter, "actual:{}".format(interpreter_actual_path))
554-
ctx.actions.write(
555-
interpreter,
556-
"#!/bin/sh\necho 'ERROR: tried to use build-time venv when it should recreate venv'; exit 1",
557-
)
550+
ctx.actions.write(interpreter, "actual:{}".format(interpreter_actual_path))
558551

559552
elif runtime.interpreter:
560553
# Even though ctx.actions.symlink() is used, using

python/private/python_bootstrap_template.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ print(site.getsitepackages(["{venv}"])[-1])
280280
output = output.strip().split("\n")
281281
python_exe_actual = output[0]
282282
venv_site_packages = output[1]
283-
os.makedirs(dirname(venv_site_package), exist_ok=True)
283+
os.makedirs(dirname(venv_site_packages), exist_ok=True)
284284
runfiles_venv_site_packages = join(runfiles_venv, VENV_REL_SITE_PACKAGES)
285285
else:
286286
python_exe_actual = FindBinary(runfiles_root, PYTHON_BINARY_ACTUAL)
@@ -362,7 +362,8 @@ def ExecuteFile(python_program, main_filename, args, env, runfiles_root,
362362
runfiles_root: (str) Path to the module space/runfiles tree directory
363363
workspace: (str|None) Name of the workspace to execute in. This is expected to be a
364364
directory under the runfiles tree.
365-
delete_dirs: (list[str])
365+
delete_dirs: (list[str]) directories that should be deleted after the user
366+
program has finished running.
366367
"""
367368
argv = [python_program]
368369
argv.extend(INTERPRETER_ARGS)

python/private/runtime_env_repo.bzl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,17 @@ load("//python/private:repo_utils.bzl", "repo_utils")
55
def _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

5939
runtime_env_repo = repository_rule(
6040
implementation = _runtime_env_repo_impl,
61-
attrs = {
62-
"_main_python_version_file": attr.label(default = "@//:.python-version"),
63-
},
6441
)

tests/runtime_env_toolchain/BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,12 @@ load(":runtime_env_toolchain_tests.bzl", "runtime_env_toolchain_test_suite")
1919

2020
runtime_env_toolchain_test_suite(name = "runtime_env_toolchain_tests")
2121

22-
print(PYTHON_VERSION)
23-
2422
py_reconfig_test(
2523
name = "toolchain_runs_test",
2624
srcs = ["toolchain_runs_test.py"],
2725
data = [
2826
"//tests/support:current_build_settings",
2927
],
30-
env = {
31-
"RULES_PYTHON_BOOTSTRAP_VERBOSE": "1",
32-
},
3328
extra_toolchains = [
3429
"//python/runtime_env_toolchains:all",
3530
# Necessary for RBE CI

0 commit comments

Comments
 (0)