From d9254599f9bb47632313ecb90c5f281ceca5da3a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 19 Feb 2020 22:36:26 -0500 Subject: manifest/tests: get them passing under Windows We also need to check more things in the manifest/project handlers, and use platform_utils in a few places to address Windows behavior. Drop Python 2.7 from Windows testing as it definitely doesn't work and we won't be fixing it. Change-Id: I83d00ee9f1612312bb3f7147cb9535fc61268245 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256113 Tested-by: Mike Frysinger Reviewed-by: Jonathan Nieder Reviewed-by: David Pursehouse --- project.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'project.py') diff --git a/project.py b/project.py index 2112ee32..99ef238f 100644 --- a/project.py +++ b/project.py @@ -275,7 +275,12 @@ def _SafeExpandPath(base, subpath, skipfinal=False): NB: We rely on a number of paths already being filtered out while parsing the manifest. See the validation logic in manifest_xml.py for more details. """ - components = subpath.split(os.path.sep) + # Split up the path by its components. We can't use os.path.sep exclusively + # as some platforms (like Windows) will convert / to \ and that bypasses all + # our constructed logic here. Especially since manifest authors only use + # / in their paths. + resep = re.compile(r'[/%s]' % re.escape(os.path.sep)) + components = resep.split(subpath) if skipfinal: # Whether the caller handles the final component itself. finalpart = components.pop() -- cgit v1.2.3-54-g00ecf