Skip to content

Commit

Permalink
Merge pull request #171 from olehermanse/validation
Browse files Browse the repository at this point in the history
Fixed issues when adding modules to missing build key
  • Loading branch information
olehermanse authored Jan 8, 2024
2 parents e67b3bf + c43c23f commit 0dd99d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cfbs/cfbs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def add_with_dependencies(self, module, remote_config=None, dependent=None):
if "dependencies" in module:
for dep in module["dependencies"]:
self.add_with_dependencies(dep, remote_config, module["name"])
if "build" not in self._data:
self._data["build"] = []
self._data["build"].append(module)
if dependent:
print("Added module: %s (Dependency of %s)" % (module["name"], dependent))
Expand Down Expand Up @@ -351,7 +353,7 @@ def add_command(
if not to_add:
user_error("Must specify at least one module to add")

before = {m["name"] for m in self["build"]}
before = {m["name"] for m in self.get("build", [])}

if to_add[0].endswith(SUPPORTED_ARCHIVES) or to_add[0].startswith(
("https://", "git://", "ssh://")
Expand Down
2 changes: 1 addition & 1 deletion cfbs/cfbs_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def get_module_for_build(self, name, dependent):
return None

def _module_is_in_build(self, module):
return module["name"] in (m["name"] for m in self["build"])
return "build" in self and module["name"] in (m["name"] for m in self["build"])

def get_module_from_build(self, module):
for m in self["build"]:
Expand Down

0 comments on commit 0dd99d6

Please sign in to comment.