Skip to content

Commit

Permalink
Use Python 2.7 compatible file truncation code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Oct 24, 2024
1 parent 55e19e2 commit f8ba7ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pex/resolve/resolver_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ def __call__(self, parser, namespace, value, option_str=None):
"same `--pip-log` path in concurrent Pex executions is not "
"supported.".format(path=path),
)
os.truncate(path, 0)
# N.B.: This truncates the file in a way compatible with Python 2.7 (os.truncate
# was introduced in 3.3).
open(path, "w").close()
pip_log = PipLog(path=value, user_specified=True)
setattr(namespace, self.dest, pip_log)

Expand Down

0 comments on commit f8ba7ac

Please sign in to comment.