aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-01-22 12:48:22 -0800
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-01-23 12:48:29 +0100
commit23d3b98fc1ed3b774cc3838da89b2e8f0f91800b (patch)
tree692320a9563026dede9650a56e78fc935cb93c5f /mesonbuild/environment.py
parentadb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6 (diff)
downloadmeson-23d3b98fc1ed3b774cc3838da89b2e8f0f91800b.zip
meson-23d3b98fc1ed3b774cc3838da89b2e8f0f91800b.tar.gz
meson-23d3b98fc1ed3b774cc3838da89b2e8f0f91800b.tar.bz2
split mesonlib into a package
Currently mesonlib does some import tricks to figure out whether it needs to use windows or posix specific functions. This is a little hacky, but works fine. However, the way the typing stubs are implemented for the msvcrt and fnctl modules will cause mypy to fail on the other platform, since the functions are not implemented. To aleviate this (and for slightly cleaner design), I've split mesonlib into a pacakge with three modules. A universal module contains all of the platform agnositc code, a win32 module contains window specific code, a posix module contains the posix specific code, and a platform module contains no-op implementations. Then the package's __init__ file imports all of the universal functions and all of the functions from the approriate platform module, or the no-op versions as fallbacks. This makes mypy happy, and avoids `if`ing all over the code to switch between the platform specific code.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 1a7f3f1..219b0f2 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -867,7 +867,7 @@ class Environment:
# re-initialized with project options by the interpreter during
# build file parsing.
# meson_command is used by the regenchecker script, which runs meson
- self.coredata = coredata.CoreData(options, self.scratch_dir, mesonlib.meson_command)
+ self.coredata = coredata.CoreData(options, self.scratch_dir, mesonlib.get_meson_command())
self.first_invocation = True
def is_cross_build(self, when_building_for: MachineChoice = MachineChoice.HOST) -> bool:
@@ -887,7 +887,7 @@ class Environment:
return self.coredata
def get_build_command(self, unbuffered=False):
- cmd = mesonlib.meson_command[:]
+ cmd = mesonlib.get_meson_command().copy()
if unbuffered and 'python' in os.path.basename(cmd[0]):
cmd.insert(1, '-u')
return cmd