summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-12-22 10:05:17 -0800
committerDylan Baker <dylan@pnwbakers.com>2023-12-22 11:31:48 -0800
commit6ccd708f30e3649f6d531eebb8301132cb0f0759 (patch)
tree924efc690142069f24d4a9eaa6fb5598e2fb54c0
parent7cbaa6613a84b0a1e4b37926950bf7879eb4776d (diff)
downloadmeson-6ccd708f30e3649f6d531eebb8301132cb0f0759.tar.gz
modules: get rid of the .*machine variables
They're hardly used, and can be gotten directly from the Environment instead
-rw-r--r--mesonbuild/modules/__init__.py4
-rw-r--r--mesonbuild/modules/cuda.py2
-rw-r--r--mesonbuild/modules/external_project.py8
-rw-r--r--mesonbuild/modules/python3.py2
4 files changed, 5 insertions, 11 deletions
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py
index 5580acbb4..90a7f09b5 100644
--- a/mesonbuild/modules/__init__.py
+++ b/mesonbuild/modules/__init__.py
@@ -16,7 +16,6 @@ from ..programs import ExternalProgram
if T.TYPE_CHECKING:
from ..interpreter import Interpreter
from ..interpreter.interpreter import ProgramVersionFunc
- from ..interpreter.interpreterobjects import MachineHolder
from ..interpreterbase import TYPE_var, TYPE_kwargs
from ..programs import OverrideProgram
from ..wrap import WrapMode
@@ -52,9 +51,6 @@ class ModuleState:
self.man = interpreter.build.get_man()
self.global_args = interpreter.build.global_args.host
self.project_args = interpreter.build.projects_args.host.get(interpreter.subproject, {})
- self.build_machine = T.cast('MachineHolder', interpreter.builtin['build_machine']).held_object
- self.host_machine = T.cast('MachineHolder', interpreter.builtin['host_machine']).held_object
- self.target_machine = T.cast('MachineHolder', interpreter.builtin['target_machine']).held_object
self.current_node = interpreter.current_node
def get_include_args(self, include_dirs: T.Iterable[T.Union[str, build.IncludeDirs]], prefix: str = '-I') -> T.List[str]:
diff --git a/mesonbuild/modules/cuda.py b/mesonbuild/modules/cuda.py
index a5b1f7b83..525010839 100644
--- a/mesonbuild/modules/cuda.py
+++ b/mesonbuild/modules/cuda.py
@@ -82,7 +82,7 @@ class CudaModule(NewExtensionModule):
driver_version = 'unknown'
for d in driver_version_table:
if version_compare(cuda_version, d['cuda_version']):
- driver_version = d.get(state.host_machine.system, d['linux'])
+ driver_version = d.get(state.environment.machines.host.system, d['linux'])
break
return driver_version
diff --git a/mesonbuild/modules/external_project.py b/mesonbuild/modules/external_project.py
index bf482e217..5fdb0214c 100644
--- a/mesonbuild/modules/external_project.py
+++ b/mesonbuild/modules/external_project.py
@@ -65,8 +65,6 @@ class ExternalProject(NewExtensionModule):
self.project_version = state.project_version
self.subproject = state.subproject
self.env = state.environment
- self.build_machine = state.build_machine
- self.host_machine = state.host_machine
self.configure_command = configure_command
self.configure_options = configure_options
self.cross_configure_options = cross_configure_options
@@ -126,10 +124,10 @@ class ExternalProject(NewExtensionModule):
configure_cmd += self._format_options(self.configure_options, d)
if self.env.is_cross_build():
- host = '{}-{}-{}'.format(self.host_machine.cpu,
- 'pc' if self.host_machine.cpu_family in {"x86", "x86_64"}
+ host = '{}-{}-{}'.format(state.environment.machines.host.cpu,
+ 'pc' if state.environment.machines.host.cpu_family in {"x86", "x86_64"}
else 'unknown',
- self.host_machine.system)
+ state.environment.machines.host.system)
d = [('HOST', None, host)]
configure_cmd += self._format_options(self.cross_configure_options, d)
diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py
index a5e9cca01..45ad850aa 100644
--- a/mesonbuild/modules/python3.py
+++ b/mesonbuild/modules/python3.py
@@ -41,7 +41,7 @@ class Python3Module(ExtensionModule):
@typed_pos_args('python3.extension_module', str, varargs=(str, mesonlib.File, CustomTarget, CustomTargetIndex, GeneratedList, StructuredSources, ExtractedObjects, BuildTarget))
@typed_kwargs('python3.extension_module', *_MOD_KWARGS, allow_unknown=True)
def extension_module(self, state: ModuleState, args: T.Tuple[str, T.List[BuildTargetSource]], kwargs: SharedModuleKW):
- host_system = state.host_machine.system
+ host_system = state.environment.machines.host.system
if host_system == 'darwin':
# Default suffix is 'dylib' but Python does not use it for extensions.
suffix = 'so'