@@ -55,11 +55,12 @@ class ComposeElement(Element):
5555 BST_FORBID_SOURCES = True
5656
5757 def configure (self , node ):
58- node .validate_keys (["integrate" , "include" , "exclude" , "include-orphans" ])
58+ node .validate_keys (["integrate" , "filter-whilst-staging" , " include" , "exclude" , "include-orphans" ])
5959
6060 # We name this variable 'integration' only to avoid
6161 # collision with the Element.integrate() method.
6262 self .integration = node .get_bool ("integrate" )
63+ self .filter_whilst_staging = node .get_bool ("filter-whilst-staging" )
6364 self .include = node .get_str_list ("include" )
6465 self .exclude = node .get_str_list ("exclude" )
6566 self .include_orphans = node .get_bool ("include-orphans" )
@@ -72,7 +73,14 @@ def preflight(self):
7273 pass
7374
7475 def get_unique_key (self ):
75- key = {"integrate" : self .integration , "include" : sorted (self .include ), "orphans" : self .include_orphans }
76+ key = {
77+ "integrate" : self .integration ,
78+ "include" : sorted (self .include ),
79+ "orphans" : self .include_orphans ,
80+ }
81+
82+ if self .filter_whilst_staging :
83+ key ["filter-whilst-staging" ] = self .filter_whilst_staging
7684
7785 if self .exclude :
7886 key ["exclude" ] = sorted (self .exclude )
@@ -86,12 +94,24 @@ def stage(self, sandbox):
8694
8795 # Stage deps in the sandbox root
8896 with self .timed_activity ("Staging dependencies" , silent_nested = True ):
89- self .stage_dependency_artifacts (sandbox )
97+ if self .filter_whilst_staging :
98+ self .stage_dependency_artifacts (
99+ sandbox ,
100+ include = self .include ,
101+ exclude = self .exclude ,
102+ orphans = self .include_orphans ,
103+ )
104+ else :
105+ self .stage_dependency_artifacts (sandbox )
90106
91107 def assemble (self , sandbox ):
92108 manifest = set ()
93109
94- require_split = self .include or self .exclude or not self .include_orphans
110+ require_split = (
111+ not self .filter_whilst_staging
112+ and (self .include or self .exclude or not self .include_orphans )
113+ )
114+
95115 if require_split :
96116 with self .timed_activity ("Computing split" , silent_nested = True ):
97117 for dep in self .dependencies ():
0 commit comments