diff options
author | Eli Schwartz <eschwartz93@gmail.com> | 2023-12-11 01:31:45 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-02-12 18:52:43 -0500 |
commit | e184ef71e5863bcfe2bcd128cf008876afaa8dd3 (patch) | |
tree | cd203bc91ae5b2492b28111245cf139111150ae2 | |
parent | 07c051ed27059f16edae803b9197871225d71193 (diff) | |
download | meson-e184ef71e5863bcfe2bcd128cf008876afaa8dd3.zip meson-e184ef71e5863bcfe2bcd128cf008876afaa8dd3.tar.gz meson-e184ef71e5863bcfe2bcd128cf008876afaa8dd3.tar.bz2 |
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.
-rw-r--r-- | mesonbuild/dependencies/cmake.py | 12 | ||||
-rw-r--r-- | mesonbuild/dependencies/dev.py | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/mesonbuild/dependencies/cmake.py b/mesonbuild/dependencies/cmake.py index 2a98020..66d3319 100644 --- a/mesonbuild/dependencies/cmake.py +++ b/mesonbuild/dependencies/cmake.py @@ -94,10 +94,6 @@ class CMakeDependency(ExternalDependency): super().__init__(DependencyTypeName('cmake'), environment, kwargs, language=language) self.name = name 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 self.cmake_root_dir = environment.scratch_dir @@ -105,14 +101,12 @@ class CMakeDependency(ExternalDependency): # T.List of successfully found modules self.found_modules: T.List[str] = [] - # Initialize with None before the first return to avoid - # AttributeError exceptions in derived classes - self.traceparser: T.Optional[CMakeTraceParser] = None - + # Store a copy of the CMake path on the object itself so it is + # stored in the pickled coredata and recovered. + # # TODO further evaluate always using MachineChoice.BUILD self.cmakebin = CMakeExecutor(environment, CMakeDependency.class_cmake_version, self.for_machine, silent=self.silent) if not self.cmakebin.found(): - self.cmakebin = None msg = f'CMake binary for machine {self.for_machine} not found. Giving up.' if self.required: raise DependencyException(msg) diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index f53b93c..72dbb45 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -407,7 +407,7 @@ class LLVMDependencyCMake(CMakeDependency): super().__init__(name, env, kwargs, language='cpp', force_use_global_compilers=True) - if self.traceparser is None: + if not self.cmakebin.found(): return if not self.is_found: |