Skip to content

Commit 98aa09d

Browse files
committed
remove chmod+w, cleanup print_verbose
1 parent 4ac1c81 commit 98aa09d

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

python/private/zipapp/zip_main_template.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,28 @@
4747

4848

4949
def print_verbose(*args, mapping=None, values=None):
50-
if bool(os.environ.get("RULES_PYTHON_BOOTSTRAP_VERBOSE")):
51-
if mapping is not None:
52-
for key, value in sorted((mapping or {}).items()):
53-
print(
54-
"bootstrap: stage 1:",
55-
*args,
56-
f"{key}={value!r}",
57-
file=sys.stderr,
58-
flush=True,
59-
)
60-
elif values is not None:
61-
for i, v in enumerate(values):
62-
print(
63-
"bootstrap: stage 1:",
64-
*args,
65-
f"[{i}] {v!r}",
66-
file=sys.stderr,
67-
flush=True,
68-
)
69-
else:
70-
print("bootstrap: stage 1:", *args, file=sys.stderr, flush=True)
50+
if not bool(os.environ.get("RULES_PYTHON_BOOTSTRAP_VERBOSE")):
51+
return
52+
if mapping is not None:
53+
for key, value in sorted((mapping or {}).items()):
54+
print(
55+
"bootstrap: stage 1:",
56+
*args,
57+
f"{key}={value!r}",
58+
file=sys.stderr,
59+
flush=True,
60+
)
61+
elif values is not None:
62+
for i, v in enumerate(values):
63+
print(
64+
"bootstrap: stage 1:",
65+
*args,
66+
f"[{i}] {v!r}",
67+
file=sys.stderr,
68+
flush=True,
69+
)
70+
else:
71+
print("bootstrap: stage 1:", *args, file=sys.stderr, flush=True)
7172

7273

7374

@@ -180,7 +181,7 @@ def extract_zip(zip_path, dest_dir):
180181
elif attrs != 0: # Rumor has it these can be 0 for zips created on Windows.
181182
# Add the write bit to ensure the files can be deleted during cleanup and
182183
# overwritten by subsequent invocations.
183-
os.chmod(file_path, (attrs & 0o7777) | stat.S_IWRITE)
184+
os.chmod(file_path, attrs & 0o7777)
184185

185186

186187
# Create the runfiles tree by extracting the zip file

0 commit comments

Comments
 (0)