Skip to content

Commit d087713

Browse files
committed
cleanup python_bootstrap_template.txt a bit
1 parent fc800e8 commit d087713

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

python/private/python_bootstrap_template.txt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ from __future__ import absolute_import
55
from __future__ import division
66
from __future__ import print_function
77

8-
import sys
8+
# Generated file from @rules_python//python/private:python_bootstrap_template.txt
99

10-
import os
1110
from os.path import dirname, join, basename
12-
import subprocess
13-
import uuid
11+
import os
1412
import shutil
13+
import subprocess
14+
import sys
1515

1616
# NOTE: The sentinel strings are split (e.g., "%stage2" + "_bootstrap%") so that
1717
# the substitution logic won't replace them. This allows runtime detection of
@@ -77,10 +77,7 @@ else:
7777
ADDITIONAL_INTERPRETER_ARGS = os.environ.get("RULES_PYTHON_ADDITIONAL_INTERPRETER_ARGS", "")
7878
EXTRACT_ROOT = os.environ.get("RULES_PYTHON_EXTRACT_ROOT")
7979

80-
def is_running_from_zip():
81-
return IS_ZIPFILE
82-
83-
if is_running_from_zip():
80+
if IS_ZIPFILE:
8481
import shutil
8582
import tempfile
8683
import zipfile
@@ -397,7 +394,7 @@ def runfiles_envvar(runfiles_root):
397394
return ('RUNFILES_DIR', runfiles)
398395

399396
# If running from a zip, there's no manifest file.
400-
if is_running_from_zip():
397+
if IS_ZIPFILE:
401398
return ('RUNFILES_DIR', runfiles_root)
402399

403400
# Look for the runfiles "output" manifest, argv[0] + ".runfiles_manifest"
@@ -531,7 +528,7 @@ def main():
531528

532529
delete_dirs = []
533530

534-
if is_running_from_zip():
531+
if IS_ZIPFILE:
535532
runfiles_root = create_runfiles_root()
536533
# NOTE: dirname() is called because create_runfiles_root() creates a
537534
# sub-directory within a temporary directory, and we want to remove the
@@ -584,7 +581,7 @@ def main():
584581
new_env.update((key, val) for key, val in os.environ.items() if key not in new_env)
585582

586583
workspace = None
587-
if is_running_from_zip():
584+
if IS_ZIPFILE:
588585
# If RUN_UNDER_RUNFILES equals 1, it means we need to
589586
# change directory to the right runfiles directory.
590587
# (So that the data files are accessible)

0 commit comments

Comments
 (0)