@@ -166,10 +166,12 @@ def sanity_check_step(self, *args, **kwargs):
166
166
"""Custom sanity check for bundle of Python package."""
167
167
168
168
if self .pylibdir is None :
169
- # Python attributes not set up yet, happens e.g. with --sanity-check-only
170
- # Load module first to get the right python command
171
- self .fake_mod_data = self .sanity_check_load_module (extension = kwargs .get ('extension' , False ),
172
- extra_modules = kwargs .get ('extra_modules' , None ))
169
+ # Python attributes not set up yet, happens e.g. with --sanity-check-only, so do it now.
170
+ # This also ensures the exts_filter option for extensions is set correctly.
171
+ # Load module first to get the right python command.
172
+ if not self .sanity_check_module_loaded :
173
+ self .sanity_check_load_module (extension = kwargs .get ('extension' , False ),
174
+ extra_modules = kwargs .get ('extra_modules' , None ))
173
175
self .prepare_python ()
174
176
175
177
# inject directory path that uses %(pyshortver)s template into default value for sanity_check_paths
@@ -183,9 +185,16 @@ def sanity_check_step(self, *args, **kwargs):
183
185
184
186
super (Bundle , self ).sanity_check_step (* args , ** kwargs )
185
187
186
- # After the super-call self.ext_instances is initialized, so we can check the extensions
188
+ def _sanity_check_step_extensions (self ):
189
+ """Run the pip check for extensions if enabled"""
190
+ super (PythonBundle , self )._sanity_check_step_extensions ()
191
+
187
192
sanity_pip_check = self .cfg ['sanity_pip_check' ]
188
193
unversioned_packages = set (self .cfg ['unversioned_packages' ])
194
+
195
+ # The options should be set in the main EC and cannot be different between extensions.
196
+ # For backwards compatibility and to avoid surprises enable the pip-check if it is enabled
197
+ # in the main EC or any extension and build the union of all unversioned_packages.
189
198
has_sanity_pip_check_mismatch = False
190
199
all_unversioned_packages = unversioned_packages .copy ()
191
200
for ext in self .ext_instances :
@@ -201,5 +210,6 @@ def sanity_check_step(self, *args, **kwargs):
201
210
if all_unversioned_packages != unversioned_packages :
202
211
self .log .deprecated ('For bundles of PythonPackage the unversioned_packages option '
203
212
'in the main EasyConfig must be used' , '5.0' )
213
+
204
214
if sanity_pip_check :
205
215
run_pip_check (self .log , self .python_cmd , all_unversioned_packages )
0 commit comments