summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-06-11 18:59:50 +0900
committerTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-06-11 19:45:47 +0900
commit2eccea85dc231db70cec6b2598bbfdd78330667d (patch)
tree648aba30db09ed3764a064c14ea6884eaac8591d
parentb29172e0dcc245f26614ec2fc4d4068eadc7617a (diff)
downloadbuildstream-2eccea85dc231db70cec6b2598bbfdd78330667d.tar.gz
_project.py: Reorganize methodstristan/remove-some-internal-api
Add some comments clearly separating public and private methods, and moving the _validate_node() private method into the private section, renaming it _validate_toplevel_node() for better clarity.
-rw-r--r--src/buildstream/_project.py77
1 files changed, 46 insertions, 31 deletions
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index 492330e96..3006e2976 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -179,6 +179,10 @@ class Project:
def source_overrides(self):
return self.config.source_overrides
+ ########################################################
+ # Public Methods #
+ ########################################################
+
# translate_url():
#
# Translates the given url which may be specified with an alias
@@ -320,35 +324,6 @@ class Project:
return path_str
- def _validate_node(self, node):
- node.validate_keys(
- [
- "min-version",
- "element-path",
- "variables",
- "environment",
- "environment-nocache",
- "split-rules",
- "elements",
- "plugins",
- "aliases",
- "name",
- "defaults",
- "artifacts",
- "options",
- "fail-on-overlap",
- "shell",
- "fatal-warnings",
- "ref-storage",
- "sandbox",
- "mirrors",
- "remote-execution",
- "sources",
- "source-caches",
- "(@)",
- ]
- )
-
# create_element()
#
# Instantiate and return an element
@@ -559,6 +534,46 @@ class Project:
return tuple(default_targets)
+ ########################################################
+ # Private Methods #
+ ########################################################
+
+ # _validate_toplevel_node()
+ #
+ # Validates the toplevel project.conf keys
+ #
+ # Args:
+ # node (MappingNode): The toplevel project.conf node
+ #
+ def _validate_toplevel_node(self, node):
+ node.validate_keys(
+ [
+ "min-version",
+ "element-path",
+ "variables",
+ "environment",
+ "environment-nocache",
+ "split-rules",
+ "elements",
+ "plugins",
+ "aliases",
+ "name",
+ "defaults",
+ "artifacts",
+ "options",
+ "fail-on-overlap",
+ "shell",
+ "fatal-warnings",
+ "ref-storage",
+ "sandbox",
+ "mirrors",
+ "remote-execution",
+ "sources",
+ "source-caches",
+ "(@)",
+ ]
+ )
+
# _validate_version()
#
# Asserts that we have a BuildStream installation which is recent
@@ -655,7 +670,7 @@ class Project:
# Assert project's minimum required version early, before validating toplevel keys
self._validate_version(pre_config_node)
- self._validate_node(pre_config_node)
+ self._validate_toplevel_node(pre_config_node)
# The project name, element path and option declarations
# are constant and cannot be overridden by option conditional statements
@@ -715,7 +730,7 @@ class Project:
self._load_pass(config, self.config)
- self._validate_node(config)
+ self._validate_toplevel_node(config)
#
# Now all YAML composition is done, from here on we just load