Skip to content

Commit 93cae4a

Browse files
author
Jincheng
committed
Fix: Use os.readlink instead of Path.readlink before Python 3.9.
`Path.readlink` is not available before Python 3.9, which is causing the tool to complain in a project I'm working on. This code was implemented as `os.readlink()` before rules_python was introduced (per 0e5b1aa), but didn't seem to be reverted when rules_python was reverted. Verified locally that this fixes the issue for me.
1 parent 33658ba commit 93cae4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

refresh.template.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ def _ensure_external_workspaces_link_exists():
13051305
# This seemed to be the cleanest way to detect both.
13061306
# Note that os.path.islink doesn't detect junctions.
13071307
try:
1308-
current_dest = source.readlink() # MIN_PY=3.9 source.readlink()
1308+
current_dest = os.readlink(source) # MIN_PY=3.9 source.readlink()
13091309
except OSError:
13101310
log_error(f">>> //external already exists, but it isn't a {'junction' if is_windows else 'symlink'}. //external is reserved by Bazel and needed for this tool. Please rename or delete your existing //external and rerun. More details in the README if you want them.") # Don't auto delete in case the user has something important there.
13111311
sys.exit(1)

0 commit comments

Comments
 (0)