@@ -452,47 +452,27 @@ def get_config(cls):
452452
453453 def check (self ):
454454 """
455- Do not override this method!
455+ Check whether ``setup.cfg`` requests this package to be installed.
456456
457- For custom dependency checks override self.check_requirements().
458- Two things are checked: Configuration file and requirements.
457+ May be overridden by subclasses for additional checks.
459458 """
460459 # Check configuration file
461460 conf = self .get_config ()
462461 # Default "auto" state or install forced by user
463462 if conf in [True , 'auto' ]:
464- message = "installing"
465463 # Set non-optional if user sets `True` in config
466464 if conf is True :
467465 self .optional = False
466+ return "installing"
468467 # Configuration opt-out by user
469468 else :
470469 # Some backend extensions (e.g. Agg) need to be built for certain
471470 # other GUI backends (e.g. TkAgg) even when manually disabled
472471 if self .force is True :
473- message = "installing forced (config override)"
472+ return "installing forced (config override)"
474473 else :
475474 raise CheckFailed ("skipping due to configuration" )
476475
477- # Check requirements and add extra information (if any) to message.
478- # If requirements are not met a CheckFailed should be raised in there.
479- additional_info = self .check_requirements ()
480- if additional_info :
481- message += ", " + additional_info
482-
483- # No CheckFailed raised until now, return install message.
484- return message
485-
486- def check_requirements (self ):
487- """
488- Override this method to do custom dependency checks.
489-
490- - Raise CheckFailed() if requirements are not met.
491- - Return message with additional information, or an empty string
492- (or None) for no additional information.
493- """
494- return ""
495-
496476
497477class OptionalBackendPackage (OptionalPackage ):
498478 config_category = "gui_support"
@@ -979,11 +959,10 @@ def add_flags(self, ext):
979959class BackendMacOSX (OptionalBackendPackage ):
980960 name = 'macosx'
981961
982- def check_requirements (self ):
962+ def check (self ):
983963 if sys .platform != 'darwin' :
984964 raise CheckFailed ("Mac OS-X only" )
985-
986- return 'darwin'
965+ return super ().check ()
987966
988967 def get_extension (self ):
989968 sources = [
@@ -1008,9 +987,10 @@ class Dlls(OptionalPackageData):
1008987 """
1009988 name = "dlls"
1010989
1011- def check_requirements (self ):
990+ def check (self ):
1012991 if sys .platform != 'win32' :
1013992 raise CheckFailed ("Microsoft Windows only" )
993+ return super ().check ()
1014994
1015995 def get_package_data (self ):
1016996 return {'' : ['*.dll' ]}
0 commit comments