WIP more prints

This commit is contained in:
Bruno Oliveira 2021-11-20 11:32:21 -03:00
parent f03e82214f
commit 8fffd0fca5
1 changed files with 7 additions and 0 deletions

View File

@ -327,15 +327,22 @@ if sys.platform == "win32":
source_stat: os.stat_result, source_stat: os.stat_result,
pyc: Path, pyc: Path,
) -> bool: ) -> bool:
track_debug = getattr(sys, "TRACK_REWRITE", False)
try: try:
with atomic_write(os.fspath(pyc), mode="wb", overwrite=True) as fp: with atomic_write(os.fspath(pyc), mode="wb", overwrite=True) as fp:
_write_pyc_fp(fp, source_stat, co) _write_pyc_fp(fp, source_stat, co)
except OSError as e: except OSError as e:
state.trace(f"error writing pyc file at {pyc}: {e}") state.trace(f"error writing pyc file at {pyc}: {e}")
if track_debug:
print(f" write_pyc: error! {e}")
# we ignore any failure to write the cache file # we ignore any failure to write the cache file
# there are many reasons, permission-denied, pycache dir being a # there are many reasons, permission-denied, pycache dir being a
# file etc. # file etc.
return False return False
if track_debug:
print(" write_pyc: success")
return True return True