manifest: Fix absolute path checking on windows for Python 3.13

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>
This commit is contained in:
Pieter De Gendt 2024-10-11 13:27:56 +02:00 committed by Pieter De Gendt
parent 42c0a5d3d5
commit 85fd5979f2
1 changed files with 4 additions and 1 deletions

View File

@ -2421,7 +2421,10 @@ class Manifest:
# symbolic links. # symbolic links.
ret_norm = os.path.normpath(ret.path) 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 ' self._malformed(f'project "{ret.name}" has absolute path '
f'{ret.path}; this must be relative to the ' f'{ret.path}; this must be relative to the '
f'workspace topdir' + f'workspace topdir' +