Rearrange trys to avoid possible undefined vars.

pull/1810/head
Elliott Sales de Andrade 8 years ago
parent f8fe9939e4
commit 83d1c7f063
  1. 8
      mesonbuild/environment.py
  2. 5
      mesonbuild/wrap/wrap.py
  3. 8
      mesontest.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

@ -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

@ -457,11 +457,11 @@ TIMEOUT: %4d
return test.name
def run_tests(self, tests):
executor = None
logfile = None
jsonlogfile = None
futures = []
try:
executor = None
logfile = None
jsonlogfile = None
futures = []
numlen = len('%d' % len(tests))
(logfile, logfilename, jsonlogfile, jsonlogfilename) = self.open_log_files()
wrap = self.get_wrapper()

Loading…
Cancel
Save