diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-05-17 05:10:40 -0400 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-05-17 05:37:02 -0400 |
commit | 83d1c7f06323775c3f75a6bc37b77c348c74de25 (patch) | |
tree | 6bed050893212644b6b03fee73ad5f4bf22cac59 /mesonbuild | |
parent | f8fe9939e4e97aac2c1199cfcc88276d1a571c77 (diff) | |
download | meson-83d1c7f06323775c3f75a6bc37b77c348c74de25.zip meson-83d1c7f06323775c3f75a6bc37b77c348c74de25.tar.gz meson-83d1c7f06323775c3f75a6bc37b77c348c74de25.tar.bz2 |
Rearrange trys to avoid possible undefined vars.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/environment.py | 8 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index c34b2e7..cd35285 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -459,11 +459,11 @@ class Environment: for compiler in compilers: if isinstance(compiler, str): compiler = [compiler] + if 'cl' in compiler or 'cl.exe' in compiler: + arg = '/?' + else: + arg = '--version' try: - if 'cl' in compiler or 'cl.exe' in compiler: - arg = '/?' - else: - arg = '--version' p, out, err = Popen_safe(compiler + [arg]) except OSError as e: popen_exceptions[' '.join(compiler + [arg])] = e diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 4dc539a..b17d931 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -301,12 +301,13 @@ class Resolver: try: import lzma del lzma + except ImportError: + pass + else: try: shutil.register_unpack_format('xztar', ['.tar.xz', '.txz'], shutil._unpack_tarfile, [], "xz'ed tar-file") except shutil.RegistryError: pass - except ImportError: - pass target_dir = os.path.join(self.subdir_root, package.get('directory')) if os.path.isdir(target_dir): return |