summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-04 17:30:22 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-10 19:29:58 +0900
commit9fcdb999ced0cfd05b7726ff0e902d9fa4e38340 (patch)
treef9011ed6dbc6b7e395cac44ee3d43fcf789a3fe3 /buildstream
parent0df3d75e9de524b8bc8165b2055b4008724064c1 (diff)
downloadbuildstream-9fcdb999ced0cfd05b7726ff0e902d9fa4e38340.tar.gz
_loader.py: Now takes an OptionPool and processes each loaded file
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/_loader.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/buildstream/_loader.py b/buildstream/_loader.py
index b02750cbf..d1738b92a 100644
--- a/buildstream/_loader.py
+++ b/buildstream/_loader.py
@@ -232,7 +232,7 @@ def extract_depends_from_node(owner, data):
#
class Loader():
- def __init__(self, basedir, filename, host_arch, target_arch):
+ def __init__(self, basedir, filename, options, host_arch, target_arch):
# Ensure we have an absolute path for the base directory
#
@@ -247,12 +247,9 @@ class Loader():
"path to the base project directory: %s" %
(filename, basedir))
- # Base project directory
- self.basedir = basedir
-
- # Target bst filename
- self.target_filename = filename
- self.target = filename
+ self.options = options # Project options (OptionPool)
+ self.basedir = basedir # Base project directory
+ self.target = filename # Target bst element
self.host_arch = host_arch
self.target_arch = target_arch
@@ -280,23 +277,23 @@ class Loader():
# First pass, recursively load files and populate our table of LoadElements
#
- profile_start(Topics.LOAD_PROJECT, self.target_filename)
- target = self.load_file(self.target_filename, rewritable, ticker)
- profile_end(Topics.LOAD_PROJECT, self.target_filename)
+ profile_start(Topics.LOAD_PROJECT, self.target)
+ target = self.load_file(self.target, rewritable, ticker)
+ profile_end(Topics.LOAD_PROJECT, self.target)
#
# Now that we've resolve the dependencies, scan them for circular dependencies
#
- profile_start(Topics.CIRCULAR_CHECK, self.target_filename)
+ profile_start(Topics.CIRCULAR_CHECK, self.target)
self.check_circular_deps(self.target)
- profile_end(Topics.CIRCULAR_CHECK, self.target_filename)
+ profile_end(Topics.CIRCULAR_CHECK, self.target)
#
# Sort direct dependencies of elements by their dependency ordering
#
- profile_start(Topics.SORT_DEPENDENCIES, self.target_filename)
+ profile_start(Topics.SORT_DEPENDENCIES, self.target)
self.sort_dependencies(self.target)
- profile_end(Topics.SORT_DEPENDENCIES, self.target_filename)
+ profile_end(Topics.SORT_DEPENDENCIES, self.target)
# Finally, wrap what we have into LoadElements and return the target
#
@@ -318,10 +315,11 @@ class Loader():
if ticker:
ticker(filename)
+ # Load the data and process any conditional statements therein
fullpath = os.path.join(self.basedir, filename)
-
- # Load the element and track it in our elements table
data = _yaml.load(fullpath, shortname=filename, copy_tree=rewritable)
+ self.options.process_node(data)
+
element = LoadElement(data, filename, self.basedir,
self.host_arch, self.target_arch,
self.elements)