Skip to content

Commit

Permalink
manifest: Fix absolute path checking on windows for Python 3.13
Browse files Browse the repository at this point in the history
Python 3.13 changed the behavior for os.path.isabs
https://docs.python.org/3/library/os.path.html#os.path.isabs

Prevent absolute paths that start with a '/'.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
  • Loading branch information
pdgendt committed Oct 15, 2024
1 parent 42c0a5d commit 85fd597
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/west/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2421,7 +2421,10 @@ def _load_project(self, pd: Dict, url_bases: Dict[str, str],
# symbolic links.
ret_norm = os.path.normpath(ret.path)

if os.path.isabs(ret_norm):
# To be "really" absolute, a Windows path must include the "drive" like C:\\, D:\\.
# But here we also want to block drive-less "half-breeds".
# Note this question has confused Python which changed the `.isabs()` behavior in 3.13
if ret_norm[0] in '/\\' or os.path.isabs(ret_norm):
self._malformed(f'project "{ret.name}" has absolute path '
f'{ret.path}; this must be relative to the '
f'workspace topdir' +
Expand Down

0 comments on commit 85fd597

Please sign in to comment.