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:
parent
e36901ac8a
commit
dbc1a87d84
|
@ -13,7 +13,7 @@ import enum
|
||||||
import errno
|
import errno
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from pathlib import PurePath, Path
|
from pathlib import PurePath, PurePosixPath, Path
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -1554,7 +1554,10 @@ def _manifest_content_at(project, path, rev=QUAL_MANIFEST_REV_BRANCH):
|
||||||
elif ptype == 'tree':
|
elif ptype == 'tree':
|
||||||
# Importing a tree: return the content of the YAML files inside it.
|
# Importing a tree: return the content of the YAML files inside it.
|
||||||
ret = []
|
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)):
|
for f in filter(_is_yml, project.listdir_at(path, rev=rev)):
|
||||||
ret.append(project.read_at(str(pathobj / f),
|
ret.append(project.read_at(str(pathobj / f),
|
||||||
rev=rev).decode('utf-8'))
|
rev=rev).decode('utf-8'))
|
||||||
|
|
Loading…
Reference in New Issue