Merge pull request #1272 from mesonbuild/ignatenko/lint
fix some linting errors
This commit is contained in:
commit
56e2c46ce1
|
@ -23,10 +23,10 @@ libs = glob(os.path.join('build', sdl_dir, 'lib/x86/*'))
|
||||||
# Sorry for this hack but this needs to work during development
|
# Sorry for this hack but this needs to work during development
|
||||||
# when Meson is not in path.
|
# when Meson is not in path.
|
||||||
subprocess.check_call(['python3', r'..\..\meson.py', 'build',
|
subprocess.check_call(['python3', r'..\..\meson.py', 'build',
|
||||||
'--backend=ninja', '--buildtype=release'])
|
'--backend=ninja', '--buildtype=release'])
|
||||||
subprocess.check_call(['ninja'], cwd='build')
|
subprocess.check_call(['ninja'], cwd='build')
|
||||||
shutil.copy('myapp.iss', 'build')
|
shutil.copy('myapp.iss', 'build')
|
||||||
subprocess.check_call([r'\Program Files\Inno Setup 5\ISCC.exe', 'myapp.iss'],
|
subprocess.check_call([r'\Program Files\Inno Setup 5\ISCC.exe', 'myapp.iss'],
|
||||||
cwd = 'build')
|
cwd = 'build')
|
||||||
shutil.copy('build/setup.exe', 'myapp 1.0.exe')
|
shutil.copy('build/setup.exe', 'myapp 1.0.exe')
|
||||||
shutil.rmtree('build')
|
shutil.rmtree('build')
|
||||||
|
|
|
@ -501,7 +501,7 @@ int dummy;
|
||||||
os.makedirs(abs_pdir, exist_ok=True)
|
os.makedirs(abs_pdir, exist_ok=True)
|
||||||
elem.add_item('DEPFILE', rel_dfile)
|
elem.add_item('DEPFILE', rel_dfile)
|
||||||
elem.add_item('COMMAND', cmd)
|
elem.add_item('COMMAND', cmd)
|
||||||
elem.add_item('description', desc.format(target.name, cmd_type))
|
elem.add_item('description', desc.format(target.name, cmd_type))
|
||||||
elem.write(outfile)
|
elem.write(outfile)
|
||||||
self.processed_targets[target.name + target.type_suffix()] = True
|
self.processed_targets[target.name + target.type_suffix()] = True
|
||||||
|
|
||||||
|
@ -1019,7 +1019,7 @@ int dummy;
|
||||||
valac_outputs.append(vapiname)
|
valac_outputs.append(vapiname)
|
||||||
if isinstance(target.vala_gir, str):
|
if isinstance(target.vala_gir, str):
|
||||||
girname = os.path.join(self.get_target_dir(target), target.vala_gir)
|
girname = os.path.join(self.get_target_dir(target), target.vala_gir)
|
||||||
args += ['--gir', os.path.join('..', target.vala_gir)]
|
args += ['--gir', os.path.join('..', target.vala_gir)]
|
||||||
valac_outputs.append(girname)
|
valac_outputs.append(girname)
|
||||||
if self.environment.coredata.get_builtin_option('werror'):
|
if self.environment.coredata.get_builtin_option('werror'):
|
||||||
args += valac.get_werror_args()
|
args += valac.get_werror_args()
|
||||||
|
|
|
@ -203,8 +203,8 @@ base_options = {
|
||||||
'Enable coverage tracking.',
|
'Enable coverage tracking.',
|
||||||
False),
|
False),
|
||||||
'b_colorout': coredata.UserComboOption('b_colorout', 'Use colored output',
|
'b_colorout': coredata.UserComboOption('b_colorout', 'Use colored output',
|
||||||
['auto', 'always', 'never'],
|
['auto', 'always', 'never'],
|
||||||
'always'),
|
'always'),
|
||||||
'b_ndebug': coredata.UserBooleanOption('b_ndebug',
|
'b_ndebug': coredata.UserBooleanOption('b_ndebug',
|
||||||
'Disable asserts',
|
'Disable asserts',
|
||||||
False),
|
False),
|
||||||
|
|
|
@ -43,7 +43,7 @@ class UserStringOption(UserOption):
|
||||||
|
|
||||||
class UserBooleanOption(UserOption):
|
class UserBooleanOption(UserOption):
|
||||||
def __init__(self, name, description, value):
|
def __init__(self, name, description, value):
|
||||||
super().__init__(name, description, [ True, False ])
|
super().__init__(name, description, [True, False])
|
||||||
self.set_value(value)
|
self.set_value(value)
|
||||||
|
|
||||||
def tobool(self, thing):
|
def tobool(self, thing):
|
||||||
|
@ -134,7 +134,7 @@ class CoreData():
|
||||||
def init_builtins(self, options):
|
def init_builtins(self, options):
|
||||||
self.builtins = {}
|
self.builtins = {}
|
||||||
for key in get_builtin_options():
|
for key in get_builtin_options():
|
||||||
args = [key] + builtin_options[key][1:-1] + [ getattr(options, key, get_builtin_option_default(key)) ]
|
args = [key] + builtin_options[key][1:-1] + [getattr(options, key, get_builtin_option_default(key))]
|
||||||
self.builtins[key] = builtin_options[key][0](*args)
|
self.builtins[key] = builtin_options[key][0](*args)
|
||||||
|
|
||||||
def get_builtin_option(self, optname):
|
def get_builtin_option(self, optname):
|
||||||
|
@ -179,7 +179,7 @@ def get_builtin_option_choices(optname):
|
||||||
if builtin_options[optname][0] == UserStringOption:
|
if builtin_options[optname][0] == UserStringOption:
|
||||||
return None
|
return None
|
||||||
elif builtin_options[optname][0] == UserBooleanOption:
|
elif builtin_options[optname][0] == UserBooleanOption:
|
||||||
return [ True, False ]
|
return [True, False]
|
||||||
else:
|
else:
|
||||||
return builtin_options[optname][2]
|
return builtin_options[optname][2]
|
||||||
else:
|
else:
|
||||||
|
@ -227,7 +227,7 @@ builtin_options = {
|
||||||
'localstatedir': [UserStringOption, 'Localstate data directory.', 'var'],
|
'localstatedir': [UserStringOption, 'Localstate data directory.', 'var'],
|
||||||
'sharedstatedir': [UserStringOption, 'Architecture-independent data directory.', 'com'],
|
'sharedstatedir': [UserStringOption, 'Architecture-independent data directory.', 'com'],
|
||||||
'werror': [UserBooleanOption, 'Treat warnings as errors.', False],
|
'werror': [UserBooleanOption, 'Treat warnings as errors.', False],
|
||||||
'warning_level': [UserComboOption, 'Compiler warning level to use.', [ '1', '2', '3' ], '1'],
|
'warning_level': [UserComboOption, 'Compiler warning level to use.', ['1', '2', '3'], '1'],
|
||||||
'layout': [UserComboOption, 'Build directory layout.', ['mirror', 'flat'], 'mirror'],
|
'layout': [UserComboOption, 'Build directory layout.', ['mirror', 'flat'], 'mirror'],
|
||||||
'default_library': [UserComboOption, 'Default library type.', ['shared', 'static'], 'shared'],
|
'default_library': [UserComboOption, 'Default library type.', ['shared', 'static'], 'shared'],
|
||||||
'backend': [UserComboOption, 'Backend to use.', backendlist, 'ninja'],
|
'backend': [UserComboOption, 'Backend to use.', backendlist, 'ninja'],
|
||||||
|
|
|
@ -128,7 +128,7 @@ class Conf:
|
||||||
print('')
|
print('')
|
||||||
print('Core options:')
|
print('Core options:')
|
||||||
carr = []
|
carr = []
|
||||||
for key in [ 'buildtype', 'warning_level', 'werror', 'strip', 'unity', 'default_library' ]:
|
for key in ['buildtype', 'warning_level', 'werror', 'strip', 'unity', 'default_library']:
|
||||||
carr.append([key, coredata.get_builtin_option_description(key),
|
carr.append([key, coredata.get_builtin_option_description(key),
|
||||||
self.coredata.get_builtin_option(key), coredata.get_builtin_option_choices(key)])
|
self.coredata.get_builtin_option(key), coredata.get_builtin_option_choices(key)])
|
||||||
self.print_aligned(carr)
|
self.print_aligned(carr)
|
||||||
|
@ -204,7 +204,7 @@ class Conf:
|
||||||
print('')
|
print('')
|
||||||
print('Testing options:')
|
print('Testing options:')
|
||||||
tarr = []
|
tarr = []
|
||||||
for key in [ 'stdsplit', 'errorlogs' ]:
|
for key in ['stdsplit', 'errorlogs']:
|
||||||
tarr.append([key, coredata.get_builtin_option_description(key),
|
tarr.append([key, coredata.get_builtin_option_description(key),
|
||||||
self.coredata.get_builtin_option(key), coredata.get_builtin_option_choices(key)])
|
self.coredata.get_builtin_option(key), coredata.get_builtin_option_choices(key)])
|
||||||
self.print_aligned(tarr)
|
self.print_aligned(tarr)
|
||||||
|
|
|
@ -29,7 +29,7 @@ default_warning = '1'
|
||||||
def add_builtin_argument(name, **kwargs):
|
def add_builtin_argument(name, **kwargs):
|
||||||
k = kwargs.get('dest', name.replace('-', '_'))
|
k = kwargs.get('dest', name.replace('-', '_'))
|
||||||
c = coredata.get_builtin_option_choices(k)
|
c = coredata.get_builtin_option_choices(k)
|
||||||
b = True if kwargs.get('action', None) in [ 'store_true', 'store_false' ] else False
|
b = True if kwargs.get('action', None) in ['store_true', 'store_false'] else False
|
||||||
h = coredata.get_builtin_option_description(k)
|
h = coredata.get_builtin_option_description(k)
|
||||||
if not b:
|
if not b:
|
||||||
h = h.rstrip('.') + ' (default: %s).' % coredata.get_builtin_option_default(k)
|
h = h.rstrip('.') + ' (default: %s).' % coredata.get_builtin_option_default(k)
|
||||||
|
|
|
@ -593,15 +593,15 @@ can not be used with the current version of glib-compiled-resources, due to
|
||||||
'--id=' + project_id,
|
'--id=' + project_id,
|
||||||
'--sources=' + source_str]
|
'--sources=' + source_str]
|
||||||
pottarget = build.RunTarget('help-' + project_id + '-pot', sys.executable,
|
pottarget = build.RunTarget('help-' + project_id + '-pot', sys.executable,
|
||||||
potargs, [], state.subdir)
|
potargs, [], state.subdir)
|
||||||
|
|
||||||
poargs = [state.environment.get_build_command(), '--internal', 'yelphelper', 'update-po',
|
poargs = [state.environment.get_build_command(), '--internal', 'yelphelper', 'update-po',
|
||||||
'--subdir=' + state.subdir,
|
'--subdir=' + state.subdir,
|
||||||
'--id=' + project_id,
|
'--id=' + project_id,
|
||||||
'--sources=' + source_str,
|
'--sources=' + source_str,
|
||||||
'--langs=' + '@@'.join(langs)]
|
'--langs=' + '@@'.join(langs)]
|
||||||
potarget = build.RunTarget('help-' + project_id + '-update-po', sys.executable,
|
potarget = build.RunTarget('help-' + project_id + '-update-po', sys.executable,
|
||||||
poargs, [], state.subdir)
|
poargs, [], state.subdir)
|
||||||
|
|
||||||
return [inscript, pottarget, potarget]
|
return [inscript, pottarget, potarget]
|
||||||
|
|
||||||
|
@ -1015,8 +1015,7 @@ can not be used with the current version of glib-compiled-resources, due to
|
||||||
for i in inputs:
|
for i in inputs:
|
||||||
if isinstance(i, str):
|
if isinstance(i, str):
|
||||||
cmd.append(os.path.join(source_dir, i))
|
cmd.append(os.path.join(source_dir, i))
|
||||||
elif hasattr(i, 'held_object') \
|
elif hasattr(i, 'held_object') and isinstance(i.held_object, GirTarget):
|
||||||
and isinstance(i.held_object, GirTarget):
|
|
||||||
link_with += self._get_vapi_link_with(i.held_object)
|
link_with += self._get_vapi_link_with(i.held_object)
|
||||||
subdir = os.path.join(state.environment.get_build_dir(),
|
subdir = os.path.join(state.environment.get_build_dir(),
|
||||||
i.held_object.get_subdir())
|
i.held_object.get_subdir())
|
||||||
|
|
|
@ -105,7 +105,7 @@ class I18nModule:
|
||||||
updatepoargs.append(extra_args)
|
updatepoargs.append(extra_args)
|
||||||
updatepotarget = build.RunTarget(packagename + '-update-po', sys.executable, updatepoargs, [], state.subdir)
|
updatepotarget = build.RunTarget(packagename + '-update-po', sys.executable, updatepoargs, [], state.subdir)
|
||||||
|
|
||||||
script = [sys.executable, state.environment.get_build_command()]
|
script = [sys.executable, state.environment.get_build_command()]
|
||||||
args = ['--internal', 'gettext', 'install',
|
args = ['--internal', 'gettext', 'install',
|
||||||
'--subdir=' + state.subdir,
|
'--subdir=' + state.subdir,
|
||||||
'--localedir=' + state.environment.coredata.get_builtin_option('localedir'),
|
'--localedir=' + state.environment.coredata.get_builtin_option('localedir'),
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Qt4Module():
|
||||||
moc_ver = stderr
|
moc_ver = stderr
|
||||||
else:
|
else:
|
||||||
raise MesonException('Moc preprocessor is not for Qt 4. Output:\n%s\n%s' %
|
raise MesonException('Moc preprocessor is not for Qt 4. Output:\n%s\n%s' %
|
||||||
(stdout, stderr))
|
(stdout, stderr))
|
||||||
mlog.log(' moc:', mlog.green('YES'), '(%s, %s)' % \
|
mlog.log(' moc:', mlog.green('YES'), '(%s, %s)' % \
|
||||||
(' '.join(self.moc.fullpath), moc_ver.split()[-1]))
|
(' '.join(self.moc.fullpath), moc_ver.split()[-1]))
|
||||||
else:
|
else:
|
||||||
|
@ -57,7 +57,7 @@ class Qt4Module():
|
||||||
uic_ver = stderr
|
uic_ver = stderr
|
||||||
else:
|
else:
|
||||||
raise MesonException('Uic compiler is not for Qt4. Output:\n%s\n%s' %
|
raise MesonException('Uic compiler is not for Qt4. Output:\n%s\n%s' %
|
||||||
(stdout, stderr))
|
(stdout, stderr))
|
||||||
mlog.log(' uic:', mlog.green('YES'), '(%s, %s)' % \
|
mlog.log(' uic:', mlog.green('YES'), '(%s, %s)' % \
|
||||||
(' '.join(self.uic.fullpath), uic_ver.split()[-1]))
|
(' '.join(self.uic.fullpath), uic_ver.split()[-1]))
|
||||||
else:
|
else:
|
||||||
|
@ -70,7 +70,7 @@ class Qt4Module():
|
||||||
rcc_ver = stderr
|
rcc_ver = stderr
|
||||||
else:
|
else:
|
||||||
raise MesonException('Rcc compiler is not for Qt 4. Output:\n%s\n%s' %
|
raise MesonException('Rcc compiler is not for Qt 4. Output:\n%s\n%s' %
|
||||||
(stdout, stderr))
|
(stdout, stderr))
|
||||||
mlog.log(' rcc:', mlog.green('YES'), '(%s, %s)'\
|
mlog.log(' rcc:', mlog.green('YES'), '(%s, %s)'\
|
||||||
% (' '.join(self.rcc.fullpath), rcc_ver.split()[-1]))
|
% (' '.join(self.rcc.fullpath), rcc_ver.split()[-1]))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Qt5Module():
|
||||||
moc_ver = stdout
|
moc_ver = stdout
|
||||||
else:
|
else:
|
||||||
raise MesonException('Moc preprocessor is not for Qt 5. Output:\n%s\n%s' %
|
raise MesonException('Moc preprocessor is not for Qt 5. Output:\n%s\n%s' %
|
||||||
(stdout, stderr))
|
(stdout, stderr))
|
||||||
mlog.log(' moc:', mlog.green('YES'), '(%s, %s)' % \
|
mlog.log(' moc:', mlog.green('YES'), '(%s, %s)' % \
|
||||||
(' '.join(self.moc.fullpath), moc_ver.split()[-1]))
|
(' '.join(self.moc.fullpath), moc_ver.split()[-1]))
|
||||||
else:
|
else:
|
||||||
|
@ -61,7 +61,7 @@ class Qt5Module():
|
||||||
uic_ver = stdout
|
uic_ver = stdout
|
||||||
else:
|
else:
|
||||||
raise MesonException('Uic compiler is not for Qt 5. Output:\n%s\n%s' %
|
raise MesonException('Uic compiler is not for Qt 5. Output:\n%s\n%s' %
|
||||||
(stdout, stderr))
|
(stdout, stderr))
|
||||||
mlog.log(' uic:', mlog.green('YES'), '(%s, %s)' % \
|
mlog.log(' uic:', mlog.green('YES'), '(%s, %s)' % \
|
||||||
(' '.join(self.uic.fullpath), uic_ver.split()[-1]))
|
(' '.join(self.uic.fullpath), uic_ver.split()[-1]))
|
||||||
else:
|
else:
|
||||||
|
@ -76,7 +76,7 @@ class Qt5Module():
|
||||||
rcc_ver = stdout
|
rcc_ver = stdout
|
||||||
else:
|
else:
|
||||||
raise MesonException('Rcc compiler is not for Qt 5. Output:\n%s\n%s' %
|
raise MesonException('Rcc compiler is not for Qt 5. Output:\n%s\n%s' %
|
||||||
(stdout, stderr))
|
(stdout, stderr))
|
||||||
mlog.log(' rcc:', mlog.green('YES'), '(%s, %s)'\
|
mlog.log(' rcc:', mlog.green('YES'), '(%s, %s)'\
|
||||||
% (' '.join(self.rcc.fullpath), rcc_ver.split()[-1]))
|
% (' '.join(self.rcc.fullpath), rcc_ver.split()[-1]))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -58,7 +58,7 @@ def run_potgen(src_sub, pkgname, datadirs, args):
|
||||||
ofile = os.path.join(src_sub, pkgname + '.pot')
|
ofile = os.path.join(src_sub, pkgname + '.pot')
|
||||||
return subprocess.call(['xgettext', '--package-name=' + pkgname, '-p', src_sub, '-f', listfile,
|
return subprocess.call(['xgettext', '--package-name=' + pkgname, '-p', src_sub, '-f', listfile,
|
||||||
'-D', os.environ['MESON_SOURCE_ROOT'], '-k_', '-o', ofile] + args,
|
'-D', os.environ['MESON_SOURCE_ROOT'], '-k_', '-o', ofile] + args,
|
||||||
env=child_env)
|
env=child_env)
|
||||||
|
|
||||||
def gen_gmo(src_sub, bld_sub, langs):
|
def gen_gmo(src_sub, bld_sub, langs):
|
||||||
for l in langs:
|
for l in langs:
|
||||||
|
|
|
@ -133,9 +133,9 @@ class Resolver:
|
||||||
is_there = True
|
is_there = True
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
raise RuntimeError('%s is not empty but is not a valid '
|
raise RuntimeError('%s is not empty but is not a valid '
|
||||||
'git repository, we can not work with it'
|
'git repository, we can not work with it'
|
||||||
' as a subproject directory.' % (
|
' as a subproject directory.' % (
|
||||||
checkoutdir))
|
checkoutdir))
|
||||||
|
|
||||||
if revno.lower() == 'head':
|
if revno.lower() == 'head':
|
||||||
# Failure to do pull is not a fatal error,
|
# Failure to do pull is not a fatal error,
|
||||||
|
|
Loading…
Reference in New Issue