cmake dependency: avoid setting property to None as a workaround
It's an improper object model, but was used to signal to a subclass that self.traceparser did not exist. However, since it is always initialized from self.cmakebin, we can just check that instead.
This commit is contained in:
parent
07c051ed27
commit
e184ef71e5
|
@ -94,10 +94,6 @@ class CMakeDependency(ExternalDependency):
|
||||||
super().__init__(DependencyTypeName('cmake'), environment, kwargs, language=language)
|
super().__init__(DependencyTypeName('cmake'), environment, kwargs, language=language)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.is_libtool = False
|
self.is_libtool = False
|
||||||
# Store a copy of the CMake path on the object itself so it is
|
|
||||||
# stored in the pickled coredata and recovered.
|
|
||||||
self.cmakebin: T.Optional[CMakeExecutor] = None
|
|
||||||
self.cmakeinfo: T.Optional[CMakeInfo] = None
|
|
||||||
|
|
||||||
# Where all CMake "build dirs" are located
|
# Where all CMake "build dirs" are located
|
||||||
self.cmake_root_dir = environment.scratch_dir
|
self.cmake_root_dir = environment.scratch_dir
|
||||||
|
@ -105,14 +101,12 @@ class CMakeDependency(ExternalDependency):
|
||||||
# T.List of successfully found modules
|
# T.List of successfully found modules
|
||||||
self.found_modules: T.List[str] = []
|
self.found_modules: T.List[str] = []
|
||||||
|
|
||||||
# Initialize with None before the first return to avoid
|
# Store a copy of the CMake path on the object itself so it is
|
||||||
# AttributeError exceptions in derived classes
|
# stored in the pickled coredata and recovered.
|
||||||
self.traceparser: T.Optional[CMakeTraceParser] = None
|
#
|
||||||
|
|
||||||
# TODO further evaluate always using MachineChoice.BUILD
|
# TODO further evaluate always using MachineChoice.BUILD
|
||||||
self.cmakebin = CMakeExecutor(environment, CMakeDependency.class_cmake_version, self.for_machine, silent=self.silent)
|
self.cmakebin = CMakeExecutor(environment, CMakeDependency.class_cmake_version, self.for_machine, silent=self.silent)
|
||||||
if not self.cmakebin.found():
|
if not self.cmakebin.found():
|
||||||
self.cmakebin = None
|
|
||||||
msg = f'CMake binary for machine {self.for_machine} not found. Giving up.'
|
msg = f'CMake binary for machine {self.for_machine} not found. Giving up.'
|
||||||
if self.required:
|
if self.required:
|
||||||
raise DependencyException(msg)
|
raise DependencyException(msg)
|
||||||
|
|
|
@ -407,7 +407,7 @@ class LLVMDependencyCMake(CMakeDependency):
|
||||||
|
|
||||||
super().__init__(name, env, kwargs, language='cpp', force_use_global_compilers=True)
|
super().__init__(name, env, kwargs, language='cpp', force_use_global_compilers=True)
|
||||||
|
|
||||||
if self.traceparser is None:
|
if not self.cmakebin.found():
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.is_found:
|
if not self.is_found:
|
||||||
|
|
Loading…
Reference in New Issue