diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-01-22 12:48:22 -0800 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-01-23 12:48:29 +0100 |
commit | 23d3b98fc1ed3b774cc3838da89b2e8f0f91800b (patch) | |
tree | 692320a9563026dede9650a56e78fc935cb93c5f /mesonbuild/mdist.py | |
parent | adb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6 (diff) | |
download | meson-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/mdist.py')
-rw-r--r-- | mesonbuild/mdist.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py index 3ca13e5..5471505 100644 --- a/mesonbuild/mdist.py +++ b/mesonbuild/mdist.py @@ -245,7 +245,7 @@ def run(options): b = build.load(options.wd) # This import must be load delayed, otherwise it will get the default # value of None. - from mesonbuild.mesonlib import meson_command + from mesonbuild.mesonlib import get_meson_command src_root = b.environment.source_dir bld_root = b.environment.build_dir priv_dir = os.path.join(bld_root, 'meson-private') @@ -279,7 +279,7 @@ def run(options): rc = 0 if not options.no_tests: # Check only one. - rc = check_dist(names[0], meson_command, extra_meson_args, bld_root, priv_dir) + rc = check_dist(names[0], get_meson_command(), extra_meson_args, bld_root, priv_dir) if rc == 0: for name in names: create_hash(name) |