manifest: fix _manifest_content_at() on Windows

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 <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-02-05 10:16:44 -08:00 committed by Marti Bolivar
parent e36901ac8a
commit dbc1a87d84
1 changed files with 5 additions and 2 deletions

View File

@ -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'))