Merge pull request #3205 from sarum9in/use-itertools

pull/3233/head
Jussi Pakkanen 7 years ago committed by GitHub
commit 8d8caef636
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      mesonbuild/backend/ninjabackend.py
  2. 2
      mesonbuild/build.py
  3. 4
      mesonbuild/compilers/c.py
  4. 2
      mesonbuild/coredata.py
  5. 2
      mesonbuild/scripts/meson_install.py
  6. 12
      test cases/common/72 build always/version_gen.py

@ -1084,7 +1084,7 @@ int dummy;
the build directory.
"""
result = OrderedSet()
for dep in target.link_targets + target.link_whole_targets:
for dep in itertools.chain(target.link_targets, target.link_whole_targets):
for i in dep.sources:
if hasattr(i, 'fname'):
i = i.fname

@ -798,7 +798,7 @@ This will become a hard error in a future Meson release.''')
def get_dependencies(self):
transitive_deps = []
for t in self.link_targets + self.link_whole_targets:
for t in itertools.chain(self.link_targets, self.link_whole_targets):
transitive_deps.append(t)
if isinstance(t, StaticLibrary):
transitive_deps += t.get_dependencies()

@ -525,7 +525,7 @@ class CCompiler(Compiler):
elif rtype == 'int':
try:
return int(res.stdout.strip())
except:
except ValueError:
m = 'Return value of {}() is not an int'
raise EnvironmentException(m.format(fname))
@ -1140,7 +1140,7 @@ class VisualStudioCCompiler(CCompiler):
# See boost/config/compiler/visualc.cpp for up to date mapping
try:
version = int(''.join(self.version.split('.')[0:2]))
except:
except ValueError:
return None
if version < 1310:
return '7.0'

@ -111,7 +111,7 @@ class UserIntegerOption(UserOption):
def toint(self, valuestring):
try:
return int(valuestring)
except:
except ValueError:
raise MesonException('Value string "%s" is not convertable to an integer.' % valuestring)
def validate_value(self, value):

@ -283,7 +283,7 @@ def run_install_script(d):
rc = subprocess.call(script + args, env=child_env)
if rc != 0:
sys.exit(rc)
except:
except OSError:
print('Failed to run install script {!r}'.format(name))
sys.exit(1)

@ -6,14 +6,10 @@ def generate(infile, outfile, fallback):
workdir = os.path.split(infile)[0]
if workdir == '':
workdir = '.'
version = fallback
try:
p = subprocess.Popen(['git', 'describe'], cwd=workdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdo, _) = p.communicate()
if p.returncode == 0:
version = stdo.decode().strip()
except:
pass
version = subprocess.check_output(['git', 'describe'], cwd=workdir).decode().strip()
except (subprocess.CalledProcessError, OSError, UnicodeDecodeError):
version = fallback
with open(infile) as f:
newdata = f.read().replace('@VERSION@', version)
try:
@ -21,7 +17,7 @@ def generate(infile, outfile, fallback):
olddata = f.read()
if olddata == newdata:
return
except:
except OSError:
pass
with open(outfile, 'w') as f:
f.write(newdata)

Loading…
Cancel
Save