From dbc1a87d84f68c5679cc3a25f07bb8107755189d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 5 Feb 2020 10:16:44 -0800 Subject: [PATCH] manifest: fix _manifest_content_at() on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git is returning empty content for dir\file.yml on Windows. Using PurePosixPath fixes it there, and can't possibly break anything on Unix. Signed-off-by: Martí Bolívar --- src/west/manifest.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/west/manifest.py b/src/west/manifest.py index 47cd034..d506451 100644 --- a/src/west/manifest.py +++ b/src/west/manifest.py @@ -13,7 +13,7 @@ import enum import errno import logging import os -from pathlib import PurePath, Path +from pathlib import PurePath, PurePosixPath, Path import shlex import subprocess @@ -1554,7 +1554,10 @@ def _manifest_content_at(project, path, rev=QUAL_MANIFEST_REV_BRANCH): elif ptype == 'tree': # Importing a tree: return the content of the YAML files inside it. ret = [] - pathobj = PurePath(path) + # Use a PurePosixPath because that's the form git seems to + # store internally, even on Windows. This breaks on Windows if + # you use PurePath. + pathobj = PurePosixPath(path) for f in filter(_is_yml, project.listdir_at(path, rev=rev)): ret.append(project.read_at(str(pathobj / f), rev=rev).decode('utf-8'))