manifest: adding manifest_path to kwargs when calling Manifest.__init__

If Manifest.from_file(topdir=<topdir>) is called with topdir then
Manifest is instantiated with topdir, source_file, and manifest_path.

However, if Manifest.from_file() is called without providing topdir,
then Manifest is instantiated with topdir and source_file only.

This causes the path to manifest repo to become None in later calls and
results in: https://github.com/nrfconnect/sdk-zephyr/pull/341

This is now fixed by ensure `manifest_path` is used for instantiating
Manifest class when using Manifest.from_file().

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2020-08-11 11:35:54 +02:00 committed by Marti Bolivar
parent 05106d4f9b
commit 60d9c4a399
2 changed files with 4 additions and 3 deletions

View File

@ -932,10 +932,11 @@ class Manifest:
# neither source_file nor topdir: search the filesystem
# for the workspace and use its manifest.path.
topdir = util.west_topdir()
mpath = _mpath(topdir=topdir)
kwargs.update({
'topdir': topdir,
'source_file': os.path.join(topdir, _mpath(topdir=topdir),
_WEST_YML)
'source_file': os.path.join(topdir, mpath, _WEST_YML),
'manifest_path': mpath
})
else:
# Just source_file: find topdir starting there.

View File

@ -1041,7 +1041,7 @@ def test_as_dict_and_yaml(manifest_repo):
'path': 'project-two',
'clone-depth': 1,
'west-commands': 'commands.yml'}],
'self': {}}}
'self': {'path': os.path.basename(manifest_repo)}}}
with open(manifest_repo / 'west.yml', 'w') as f:
f.write(content_str)