diff options
author | George Koehler <xkernigh@netscape.net> | 2018-06-28 17:26:35 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-08-07 04:19:35 -0700 |
commit | e0ed1ceae2e00d6c6efab39d4712d2522d89e929 (patch) | |
tree | a897b67504f9ccc771d4978b14a111d952c033fb /mesonbuild/mesonlib.py | |
parent | e4a83e47d4402d6fede8b284f079529fb78c2cbb (diff) | |
download | meson-e0ed1ceae2e00d6c6efab39d4712d2522d89e929.zip meson-e0ed1ceae2e00d6c6efab39d4712d2522d89e929.tar.gz meson-e0ed1ceae2e00d6c6efab39d4712d2522d89e929.tar.bz2 |
Refactor getting the host system of a cross compiler
Use mesonlib.for_windows or mesonlib.for_cygwin instead of
reimplementing them.
Add CrossBuildInfo.get_host_system to shorten the repeated the code in
the mesonlib.for_<platform> methods.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index af21a9c..87f50d7 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -299,9 +299,7 @@ def for_windows(is_cross, env): """ if not is_cross: return is_windows() - elif env.cross_info.has_host(): - return env.cross_info.config['host_machine']['system'] == 'windows' - return False + return env.cross_info.get_host_system() == 'windows' def for_cygwin(is_cross, env): """ @@ -311,9 +309,7 @@ def for_cygwin(is_cross, env): """ if not is_cross: return is_cygwin() - elif env.cross_info.has_host(): - return env.cross_info.config['host_machine']['system'] == 'cygwin' - return False + return env.cross_info.get_host_system() == 'cygwin' def for_linux(is_cross, env): """ @@ -323,9 +319,7 @@ def for_linux(is_cross, env): """ if not is_cross: return is_linux() - elif env.cross_info.has_host(): - return env.cross_info.config['host_machine']['system'] == 'linux' - return False + return env.cross_info.get_host_system() == 'linux' def for_darwin(is_cross, env): """ @@ -335,9 +329,7 @@ def for_darwin(is_cross, env): """ if not is_cross: return is_osx() - elif env.cross_info.has_host(): - return env.cross_info.config['host_machine']['system'] in ('darwin', 'ios') - return False + return env.cross_info.get_host_system() in ('darwin', 'ios') def for_android(is_cross, env): """ @@ -347,9 +339,7 @@ def for_android(is_cross, env): """ if not is_cross: return is_android() - elif env.cross_info.has_host(): - return env.cross_info.config['host_machine']['system'] == 'android' - return False + return env.cross_info.get_host_system() == 'android' def for_haiku(is_cross, env): """ @@ -359,9 +349,7 @@ def for_haiku(is_cross, env): """ if not is_cross: return is_haiku() - elif env.cross_info.has_host(): - return env.cross_info.config['host_machine']['system'] == 'haiku' - return False + return env.cross_info.get_host_system() == 'haiku' def for_openbsd(is_cross, env): """ |