diff options
32 files changed, 295 insertions, 295 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 9cb44c9..7e3f936 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -34,7 +34,7 @@ class CleanTrees(): class InstallData(): def __init__(self, source_dir, build_dir, prefix): self.source_dir = source_dir - self.build_dir= build_dir + self.build_dir = build_dir self.prefix = prefix self.targets = [] self.headers = [] @@ -648,8 +648,8 @@ class Backend(): def run_postconf_scripts(self): env = {'MESON_SOURCE_ROOT': self.environment.get_source_dir(), - 'MESON_BUILD_ROOT': self.environment.get_build_dir() - } + 'MESON_BUILD_ROOT': self.environment.get_build_dir(), + } child_env = os.environ.copy() child_env.update(env) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 70ef254..4be6641 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -484,11 +484,11 @@ int dummy; # a serialized executable wrapper for that and check if the # CustomTarget command needs extra paths first. if target.capture or (mesonlib.is_windows() and - self.determine_windows_extra_paths(target.command[0])): + self.determine_windows_extra_paths(target.command[0])): exe_data = self.serialise_executable(target.command[0], cmd[1:], - # All targets are built from the build dir - self.environment.get_build_dir(), - capture=ofilenames[0] if target.capture else None) + # All targets are built from the build dir + self.environment.get_build_dir(), + capture=ofilenames[0] if target.capture else None) cmd = [sys.executable, self.environment.get_build_command(), '--internal', 'exe', exe_data] cmd_type = 'meson_exe.py custom' @@ -732,7 +732,7 @@ int dummy; elem.write(outfile) # And then benchmarks. - cmd = [sys.executable, test_exe, '--benchmark','--logbase', + cmd = [sys.executable, test_exe, '--benchmark', '--logbase', 'benchmarklog', '--num-processes=1', '--no-rebuild'] elem = NinjaBuildElement(self.all_outputs, 'benchmark', 'CUSTOM_COMMAND', ['all', 'PHONY']) elem.add_item('COMMAND', cmd) @@ -763,11 +763,11 @@ int dummy; outfile.write(' restat = 1\n\n') outfile.write('rule REGENERATE_BUILD\n') c = (quote_char + ninja_quote(sys.executable) + quote_char, - quote_char + ninja_quote(self.environment.get_build_command()) + quote_char, + quote_char + ninja_quote(self.environment.get_build_command()) + quote_char, '--internal', 'regenerate', - quote_char + ninja_quote(self.environment.get_source_dir()) + quote_char, - quote_char + ninja_quote(self.environment.get_build_dir()) + quote_char) + quote_char + ninja_quote(self.environment.get_source_dir()) + quote_char, + quote_char + ninja_quote(self.environment.get_build_dir()) + quote_char) outfile.write(" command = %s %s %s %s %s %s --backend ninja\n" % c) outfile.write(' description = Regenerating build files\n') outfile.write(' generator = 1\n\n') @@ -796,7 +796,7 @@ int dummy; class_list.append(plain_class_path) class_dep_list = [os.path.join(self.get_target_private_dir(target), i) for i in class_list] jar_rule = 'java_LINKER' - commands = [c+m+e+f] + commands = [c + m + e + f] if e != '': commands.append(main_class) commands.append(self.get_target_filename(target)) @@ -1200,7 +1200,7 @@ int dummy; elem.write(outfile) if isinstance(target, build.StaticLibrary): elem = self.generate_link(target, outfile, self.get_target_filename(target), - rel_objects, self.build.static_linker) + rel_objects, self.build.static_linker) elem.write(outfile) elif isinstance(target, build.Executable): elem = NinjaBuildElement(self.all_outputs, self.get_target_filename(target), 'swift_COMPILER', []) @@ -1623,7 +1623,7 @@ rule FORTRAN_DEP_HACK mod_files = [] usere = re.compile(r"\s*use\s+(\w+)", re.IGNORECASE) dirname = self.get_target_private_dir(target) - tdeps= self.fortran_deps[target.get_basename()] + tdeps = self.fortran_deps[target.get_basename()] with open(src) as f: for line in f: usematch = usere.match(line) @@ -1769,7 +1769,7 @@ rule FORTRAN_DEP_HACK curdir = target.get_subdir() tmppath = os.path.normpath(os.path.join(self.build_to_src, curdir)) src_inc = compiler.get_include_args(tmppath, False) - if curdir == '': + if curdir == '': curdir = '.' build_inc = compiler.get_include_args(curdir, False) commands += build_inc + src_inc @@ -1781,7 +1781,7 @@ rule FORTRAN_DEP_HACK for i in target.get_include_dirs(): basedir = i.get_curdir() for d in i.get_incdirs(): - expdir = os.path.join(basedir, d) + expdir = os.path.join(basedir, d) srctreedir = os.path.join(self.build_to_src, expdir) # There may be include dirs where a build directory has not been # created for some source dir. For example if someone does this: @@ -1850,7 +1850,7 @@ rule FORTRAN_DEP_HACK if idir not in custom_target_include_dirs: custom_target_include_dirs.append(idir) for i in custom_target_include_dirs: - commands+= compiler.get_include_args(i, False) + commands += compiler.get_include_args(i, False) if self.environment.coredata.base_options.get('b_pch', False): commands += self.get_pch_include_args(compiler, target) @@ -2086,7 +2086,6 @@ rule FORTRAN_DEP_HACK return self.get_target_filename(t) def generate_shlib_aliases(self, target, outdir): - basename = target.get_filename() aliases = target.get_aliases() for alias, to in aliases.items(): aliasfile = os.path.join(self.environment.get_build_dir(), outdir, alias) @@ -2106,7 +2105,6 @@ rule FORTRAN_DEP_HACK d = CleanTrees(self.environment.get_build_dir(), trees) d_file = os.path.join(self.environment.get_scratch_dir(), 'cleantrees.dat') script_root = self.environment.get_script_dir() - clean_script = os.path.join(script_root, 'cleantrees.py') e.add_item('COMMAND', [sys.executable, self.environment.get_build_command(), '--internal', 'cleantrees', d_file]) diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index b28262d..e9d7389 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -320,7 +320,7 @@ class Vs2010Backend(backends.Backend): return '' directories = os.path.normpath(target.subdir).split(os.sep) - return os.sep.join(['..']*len(directories)) + return os.sep.join(['..'] * len(directories)) def special_quote(self, arr): return ['"%s"' % i for i in arr] @@ -334,7 +334,7 @@ class Vs2010Backend(backends.Backend): prjconf = ET.SubElement(confitems, 'ProjectConfiguration', {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') - p.text= self.buildtype + p.text = self.buildtype pl = ET.SubElement(prjconf, 'Platform') pl.text = self.platform globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals') @@ -343,8 +343,8 @@ class Vs2010Backend(backends.Backend): kw = ET.SubElement(globalgroup, 'Keyword') kw.text = self.platform + 'Proj' p = ET.SubElement(globalgroup, 'Platform') - p.text= self.platform - pname= ET.SubElement(globalgroup, 'ProjectName') + p.text = self.platform + pname = ET.SubElement(globalgroup, 'ProjectName') pname.text = project_name ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') @@ -380,7 +380,7 @@ class Vs2010Backend(backends.Backend): cmd += i.fullpath else: cmd.append(i) - cmd_templ = '''"%s" '''*len(cmd) + cmd_templ = '''"%s" ''' * len(cmd) ET.SubElement(customstep, 'Command').text = cmd_templ % tuple(cmd) ET.SubElement(customstep, 'Message').text = 'Running custom command.' ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') @@ -395,7 +395,7 @@ class Vs2010Backend(backends.Backend): # from the target dir, not the build root. target.absolute_paths = True (srcs, ofilenames, cmd) = self.eval_custom_target_command(target, True) - cmd_templ = '''"%s" '''*len(cmd) + cmd_templ = '''"%s" ''' * len(cmd) ET.SubElement(customstep, 'Command').text = cmd_templ % tuple(cmd) ET.SubElement(customstep, 'Outputs').text = ';'.join(ofilenames) ET.SubElement(customstep, 'Inputs').text = ';'.join(srcs) @@ -462,18 +462,18 @@ class Vs2010Backend(backends.Backend): def escape_preprocessor_define(define): # See: https://msdn.microsoft.com/en-us/library/bb383819.aspx table = str.maketrans({'%': '%25', '$': '%24', '@': '%40', - "'": '%27', ';': '%3B', '?': '%3F', '*': '%2A', - # We need to escape backslash because it'll be un-escaped by - # Windows during process creation when it parses the arguments - # Basically, this converts `\` to `\\`. - '\\': '\\\\'}) + "'": '%27', ';': '%3B', '?': '%3F', '*': '%2A', + # We need to escape backslash because it'll be un-escaped by + # Windows during process creation when it parses the arguments + # Basically, this converts `\` to `\\`. + '\\': '\\\\'}) return define.translate(table) @staticmethod def escape_additional_option(option): # See: https://msdn.microsoft.com/en-us/library/bb383819.aspx table = str.maketrans({'%': '%25', '$': '%24', '@': '%40', - "'": '%27', ';': '%3B', '?': '%3F', '*': '%2A', ' ': '%20',}) + "'": '%27', ';': '%3B', '?': '%3F', '*': '%2A', ' ': '%20'}) option = option.translate(table) # Since we're surrounding the option with ", if it ends in \ that will # escape the " when the process arguments are parsed and the starting @@ -565,7 +565,7 @@ class Vs2010Backend(backends.Backend): prjconf = ET.SubElement(confitems, 'ProjectConfiguration', {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') - p.text= self.buildtype + p.text = self.buildtype pl = ET.SubElement(prjconf, 'Platform') pl.text = self.platform # Globals @@ -577,8 +577,8 @@ class Vs2010Backend(backends.Backend): ns = ET.SubElement(globalgroup, 'RootNamespace') ns.text = target_name p = ET.SubElement(globalgroup, 'Platform') - p.text= self.platform - pname= ET.SubElement(globalgroup, 'ProjectName') + p.text = self.platform + pname = ET.SubElement(globalgroup, 'ProjectName') pname.text = project_name ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') # Start configuration @@ -931,7 +931,7 @@ class Vs2010Backend(backends.Backend): prjconf = ET.SubElement(confitems, 'ProjectConfiguration', {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') - p.text= self.buildtype + p.text = self.buildtype pl = ET.SubElement(prjconf, 'Platform') pl.text = self.platform globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals') @@ -941,7 +941,7 @@ class Vs2010Backend(backends.Backend): kw.text = self.platform + 'Proj' p = ET.SubElement(globalgroup, 'Platform') p.text = self.platform - pname= ET.SubElement(globalgroup, 'ProjectName') + pname = ET.SubElement(globalgroup, 'ProjectName') pname.text = project_name ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') @@ -1010,7 +1010,7 @@ if %%errorlevel%% neq 0 goto :VCEnd''' prjconf = ET.SubElement(confitems, 'ProjectConfiguration', {'Include': self.buildtype + '|' + self.platform}) p = ET.SubElement(prjconf, 'Configuration') - p.text= self.buildtype + p.text = self.buildtype pl = ET.SubElement(prjconf, 'Platform') pl.text = self.platform globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals') @@ -1019,8 +1019,8 @@ if %%errorlevel%% neq 0 goto :VCEnd''' kw = ET.SubElement(globalgroup, 'Keyword') kw.text = self.platform + 'Proj' p = ET.SubElement(globalgroup, 'Platform') - p.text= self.platform - pname= ET.SubElement(globalgroup, 'ProjectName') + p.text = self.platform + pname = ET.SubElement(globalgroup, 'ProjectName') pname.text = project_name ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') @@ -1070,5 +1070,5 @@ if %%errorlevel%% neq 0 goto :VCEnd''' tree = ET.ElementTree(root) tree.write(ofname, encoding='utf-8', xml_declaration=True) # ElementTree can not do prettyprinting so do it manually - #doc = xml.dom.minidom.parse(ofname) - #open(ofname, 'w').write(doc.toprettyxml()) + # doc = xml.dom.minidom.parse(ofname) + # open(ofname, 'w').write(doc.toprettyxml()) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 03efaf9..7ab3813 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -42,7 +42,7 @@ class XCodeBackend(backends.Backend): 'inc': 'sourcecode.c.h', 'dylib': 'compiled.mach-o.dylib', 'o': 'compiled.mach-o.objfile', - } + } self.maingroup_id = self.gen_id() self.all_id = self.gen_id() self.all_buildconf_id = self.gen_id() @@ -60,7 +60,7 @@ class XCodeBackend(backends.Backend): return dirname def write_line(self, text): - self.ofile.write(self.indent*self.indent_level + text) + self.ofile.write(self.indent * self.indent_level + text) if not text.endswith('\n'): self.ofile.write('\n') @@ -186,35 +186,35 @@ class XCodeBackend(backends.Backend): def generate_pbx_aggregate_target(self): self.ofile.write('\n/* Begin PBXAggregateTarget section */\n') self.write_line('%s /* ALL_BUILD */ = {' % self.all_id) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXAggregateTarget;') self.write_line('buildConfigurationList = %s;' % self.all_buildconf_id) self.write_line('buildPhases = (') self.write_line(');') self.write_line('dependencies = (') - self.indent_level+=1 + self.indent_level += 1 for t in self.build.targets: self.write_line('%s /* PBXTargetDependency */,' % self.pbx_dep_map[t]) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('name = ALL_BUILD;') self.write_line('productName = ALL_BUILD;') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.write_line('%s /* RUN_TESTS */ = {' % self.test_id) - self.indent_level +=1 + self.indent_level += 1 self.write_line('isa = PBXAggregateTarget;') self.write_line('buildConfigurationList = %s;' % self.test_buildconf_id) self.write_line('buildPhases = (') - self.indent_level+=1 + self.indent_level += 1 self.write_line('%s /* test run command */,' % self.test_command_id) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('dependencies = (') self.write_line(');') self.write_line('name = RUN_TESTS;') self.write_line('productName = RUN_TESTS;') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End PBXAggregateTarget section */\n') @@ -270,7 +270,7 @@ class XCodeBackend(backends.Backend): self.write_line('proxyType = 1;') self.write_line('remoteGlobalIDString = %s;' % self.native_targets[t]) self.write_line('remoteInfo = "%s";' % t) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End PBXContainerItemProxy section */\n') @@ -311,14 +311,14 @@ class XCodeBackend(backends.Backend): resources_id = self.gen_id() products_id = self.gen_id() self.write_line('%s = {' % self.maingroup_id) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXGroup;') self.write_line('children = (') - self.indent_level+=1 + self.indent_level += 1 self.write_line('%s /* Sources */,' % sources_id) self.write_line('%s /* Resources */,' % resources_id) self.write_line('%s /* Products */,' % products_id) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('sourceTree = "<group>";') self.indent_level -= 1 @@ -326,48 +326,48 @@ class XCodeBackend(backends.Backend): # Sources self.write_line('%s /* Sources */ = {' % sources_id) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXGroup;') self.write_line('children = (') - self.indent_level+=1 + self.indent_level += 1 for t in self.build.targets: self.write_line('%s /* %s */,' % (groupmap[t], t)) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('name = Sources;') self.write_line('sourcetree = "<group>";') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.write_line('%s /* Resources */ = {' % resources_id) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXGroup;') self.write_line('children = (') self.write_line(');') self.write_line('name = Resources;') self.write_line('sourceTree = "<group>";') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') # Targets for t in self.build.targets: self.write_line('%s /* %s */ = {' % (groupmap[t], t)) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXGroup;') self.write_line('children = (') - self.indent_level+=1 + self.indent_level += 1 self.write_line('%s /* Source files */,' % target_src_map[t]) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('name = "%s";' % t) self.write_line('sourceTree = "<group>";') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.write_line('%s /* Source files */ = {' % target_src_map[t]) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXGroup;') self.write_line('children = (') - self.indent_level+=1 + self.indent_level += 1 for s in self.build.targets[t].sources: s = os.path.join(s.subdir, s.fname) if isinstance(s, str): @@ -375,26 +375,26 @@ class XCodeBackend(backends.Backend): for o in self.build.targets[t].objects: o = os.path.join(self.build.targets[t].subdir, o) self.write_line('%s /* %s */,' % (self.filemap[o], o)) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('name = "Source files";') self.write_line('sourceTree = "<group>";') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') # And finally products self.write_line('%s /* Products */ = {' % products_id) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXGroup;') self.write_line('children = (') - self.indent_level+=1 + self.indent_level += 1 for t in self.build.targets: self.write_line('%s /* %s */,' % (self.target_filemap[t], t)) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('name = Products;') self.write_line('sourceTree = "<group>";') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End PBXGroup section */\n') @@ -403,25 +403,25 @@ class XCodeBackend(backends.Backend): for tname, idval in self.native_targets.items(): t = self.build.targets[tname] self.write_line('%s /* %s */ = {' % (idval, tname)) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXNativeTarget;') self.write_line('buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;'\ % (self.buildconflistmap[tname], tname)) self.write_line('buildPhases = (') - self.indent_level+=1 + self.indent_level += 1 self.write_line('%s /* Sources */,' % self.buildphasemap[tname]) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('buildRules = (') self.write_line(');') self.write_line('dependencies = (') - self.indent_level+=1 + self.indent_level += 1 for lt in self.build.targets[tname].link_targets: # NOT DOCUMENTED, may need to make different links # to same target have different targetdependency item. idval = self.pbx_dep_map[lt.get_id()] self.write_line('%s /* PBXTargetDependency */,' % idval) - self.indent_level -=1 + self.indent_level -= 1 self.write_line(");") self.write_line('name = "%s";' % tname) self.write_line('productName = "%s";' % tname) @@ -435,7 +435,7 @@ class XCodeBackend(backends.Backend): else: raise MesonException('Unknown target type for %s' % tname) self.write_line('productType = "%s";' % typestr) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End PBXNativeTarget section */\n') @@ -496,7 +496,7 @@ class XCodeBackend(backends.Backend): cmdstr = ' '.join(["'%s'" % i for i in cmd]) self.write_line('shellScript = "%s";' % cmdstr) self.write_line('showEnvVarsInLog = 0;') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End PBXShellScriptBuildPhase section */\n') @@ -504,19 +504,19 @@ class XCodeBackend(backends.Backend): self.ofile.write('\n/* Begin PBXSourcesBuildPhase section */\n') for name, phase_id in self.source_phase.items(): self.write_line('%s /* Sources */ = {' % self.buildphasemap[name]) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = PBXSourcesBuildPhase;') self.write_line('buildActionMask = 2147483647;') self.write_line('files = (') - self.indent_level+=1 + self.indent_level += 1 for s in self.build.targets[name].sources: s = os.path.join(s.subdir, s.fname) if not self.environment.is_header(s): self.write_line('%s /* %s */,' % (self.buildmap[s], os.path.join(self.environment.get_source_dir(), s))) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('runOnlyForDeploymentPostprocessing = 0;') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End PBXSourcesBuildPhase section */\n') @@ -529,7 +529,7 @@ class XCodeBackend(backends.Backend): self.write_line('isa = PBXTargetDependency;') self.write_line('target = %s /* %s */;' % (self.native_targets[t], t)) self.write_line('targetProxy = %s /* PBXContainerItemProxy */;' % self.containerproxy_map[t]) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End PBXTargetDependency section */\n') @@ -538,24 +538,24 @@ class XCodeBackend(backends.Backend): # First the setup for the toplevel project. for buildtype in self.buildtypes: self.write_line('%s /* %s */ = {' % (self.project_configurations[buildtype], buildtype)) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = XCBuildConfiguration;') self.write_line('buildSettings = {') - self.indent_level+=1 + self.indent_level += 1 self.write_line('ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";') self.write_line('ONLY_ACTIVE_ARCH = YES;') self.write_line('SDKROOT = "macosx";') self.write_line('SYMROOT = "%s/build";' % self.environment.get_build_dir()) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.write_line('name = "%s";' % buildtype) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') # Then the all target. for buildtype in self.buildtypes: self.write_line('%s /* %s */ = {' % (self.buildall_configurations[buildtype], buildtype)) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = XCBuildConfiguration;') self.write_line('buildSettings = {') self.indent_level += 1 @@ -574,16 +574,16 @@ class XCodeBackend(backends.Backend): self.write_line('SYMROOT = "%s";' % self.environment.get_build_dir()) self.write_line('USE_HEADERMAP = NO;') self.write_line('WARNING_CFLAGS = ("-Wmost", "-Wno-four-char-constants", "-Wno-unknown-pragmas", );') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.write_line('name = "%s";' % buildtype) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') # Then the test target. for buildtype in self.buildtypes: self.write_line('%s /* %s */ = {' % (self.test_configurations[buildtype], buildtype)) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = XCBuildConfiguration;') self.write_line('buildSettings = {') self.indent_level += 1 @@ -602,10 +602,10 @@ class XCodeBackend(backends.Backend): self.write_line('SYMROOT = "%s";' % self.environment.get_build_dir()) self.write_line('USE_HEADERMAP = NO;') self.write_line('WARNING_CFLAGS = ("-Wmost", "-Wno-four-char-constants", "-Wno-unknown-pragmas", );') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.write_line('name = "%s";' % buildtype) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') # Now finally targets. @@ -654,7 +654,7 @@ class XCodeBackend(backends.Backend): langargs[langnamemap[lang]] = args symroot = os.path.join(self.environment.get_build_dir(), target.subdir) self.write_line('%s /* %s */ = {' % (valid, buildtype)) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = XCBuildConfiguration;') self.write_line('buildSettings = {') self.indent_level += 1 @@ -689,57 +689,57 @@ class XCodeBackend(backends.Backend): self.write_line('SYMROOT = "%s";' % symroot) self.write_line('USE_HEADERMAP = NO;') self.write_line('WARNING_CFLAGS = ("-Wmost", "-Wno-four-char-constants", "-Wno-unknown-pragmas", );') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.write_line('name = "%s";' % buildtype) - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') self.ofile.write('/* End XCBuildConfiguration section */\n') def generate_xc_configurationList(self): self.ofile.write('\n/* Begin XCConfigurationList section */\n') self.write_line('%s /* Build configuration list for PBXProject "%s" */ = {' % (self.project_conflist, self.build.project_name)) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = XCConfigurationList;') self.write_line('buildConfigurations = (') - self.indent_level+=1 + self.indent_level += 1 for buildtype in self.buildtypes: self.write_line('%s /* %s */,' % (self.project_configurations[buildtype], buildtype)) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('defaultConfigurationIsVisible = 0;') self.write_line('defaultConfigurationName = debug;') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') # Now the all target self.write_line('%s /* Build configuration list for PBXAggregateTarget "ALL_BUILD" */ = {' % self.all_buildconf_id) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = XCConfigurationList;') self.write_line('buildConfigurations = (') - self.indent_level+=1 + self.indent_level += 1 for buildtype in self.buildtypes: self.write_line('%s /* %s */,' % (self.buildall_configurations[buildtype], buildtype)) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('defaultConfigurationIsVisible = 0;') self.write_line('defaultConfigurationName = debug;') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') # Test target self.write_line('%s /* Build configuration list for PBXAggregateTarget "ALL_BUILD" */ = {' % self.test_buildconf_id) - self.indent_level+=1 + self.indent_level += 1 self.write_line('isa = XCConfigurationList;') self.write_line('buildConfigurations = (') - self.indent_level+=1 + self.indent_level += 1 for buildtype in self.buildtypes: self.write_line('%s /* %s */,' % (self.test_configurations[buildtype], buildtype)) - self.indent_level-=1 + self.indent_level -= 1 self.write_line(');') self.write_line('defaultConfigurationIsVisible = 0;') self.write_line('defaultConfigurationName = debug;') - self.indent_level-=1 + self.indent_level -= 1 self.write_line('};') for target_name in self.build.targets: diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 304dd40..449afe7 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -44,7 +44,7 @@ known_basic_kwargs = {'install': True, 'sources': True, 'objects': True, 'native': True, - } + } # These contain kwargs supported by both static and shared libraries. These are # combined here because a library() call might be shared_library() or @@ -61,7 +61,7 @@ known_lib_kwargs.update({'version': True, # Only for shared libs 'vala_vapi': True, 'vala_gir': True, 'pic': True, # Only for static libs - }) + }) class InvalidArguments(MesonException): @@ -241,7 +241,7 @@ class EnvironmentVariables(): def prepend(self, env, name, values, kwargs): sep, value = self.get_value(name, values, kwargs) if name in env: - return value + sep + env[name] + return value + sep + env[name] return value @@ -330,7 +330,7 @@ class BuildTarget(): if isinstance(s, (str, File, ExtractedObjects)): self.objects.append(s) elif isinstance(s, (GeneratedList, CustomTarget)): - msg = 'Generated files are not allowed in the \'objects\' kwarg ' + \ + msg = 'Generated files are not allowed in the \'objects\' kwarg ' + \ 'for target {!r}.\nIt is meant only for '.format(self.name) + \ 'pre-built object files that are shipped with the\nsource ' + \ 'tree. Try adding it in the list of sources.' @@ -731,12 +731,12 @@ class BuildTarget(): # This should be reliable enough. if hasattr(dep, 'subproject'): raise InvalidArguments('Tried to use subproject object as a dependency.\n' - 'You probably wanted to use a dependency declared in it instead.\n' - 'Access it by calling get_variable() on the subproject object.') + 'You probably wanted to use a dependency declared in it instead.\n' + 'Access it by calling get_variable() on the subproject object.') raise InvalidArguments('Argument is of an unacceptable type {!r}.\nMust be ' - 'either an external dependency (returned by find_library() or ' - 'dependency()) or an internal dependency (returned by ' - 'declare_dependency()).'.format(type(dep).__name__)) + 'either an external dependency (returned by find_library() or ' + 'dependency()) or an internal dependency (returned by ' + 'declare_dependency()).'.format(type(dep).__name__)) def get_external_deps(self): return self.external_deps @@ -1433,7 +1433,7 @@ class RunTarget: class Jar(BuildTarget): def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs): - super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs); + super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs) for s in self.sources: if not s.endswith('.java'): raise InvalidArguments('Jar source %s is not a java file.' % s) diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 0a3f8cb..e9bad66 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -103,23 +103,19 @@ msvc_buildtype_args = {'plain': [], 'minsize': ["/MD", "/Zi", "/Os", "/Ob1"], } -gnulike_buildtype_linker_args = {} - - -if mesonlib.is_osx(): - gnulike_buildtype_linker_args.update({'plain': [], - 'debug': [], - 'debugoptimized': [], - 'release': [], - 'minsize': [], - }) -else: - gnulike_buildtype_linker_args.update({'plain': [], - 'debug': [], - 'debugoptimized': [], - 'release': ['-Wl,-O1'], - 'minsize': [], - }) +apple_buildtype_linker_args = {'plain': [], + 'debug': [], + 'debugoptimized': [], + 'release': [], + 'minsize': [], + } + +gnulike_buildtype_linker_args = {'plain': [], + 'debug': [], + 'debugoptimized': [], + 'release': ['-Wl,-O1'], + 'minsize': [], + } msvc_buildtype_linker_args = {'plain': [], 'debug': [], @@ -147,21 +143,21 @@ d_gdc_buildtype_args = {'plain': [], 'debugoptimized': ['-g', '-O'], 'release': ['-O3', '-frelease'], 'minsize': [], - } + } d_ldc_buildtype_args = {'plain': [], 'debug': ['-g', '-O0'], 'debugoptimized': ['-g', '-O'], 'release': ['-O3', '-release'], 'minsize': [], - } + } d_dmd_buildtype_args = {'plain': [], 'debug': ['-g'], 'debugoptimized': ['-g', '-O'], 'release': ['-O', '-release'], 'minsize': [], - } + } mono_buildtype_args = {'plain': [], 'debug': ['-debug'], @@ -286,12 +282,12 @@ def get_base_link_args(options, linker, is_shared_module): except KeyError: pass try: - if not is_shared_module and options['b_lundef'].value: + if not is_shared_module and 'b_lundef' in linker.base_options and options['b_lundef'].value: args.append('-Wl,--no-undefined') except KeyError: pass try: - if options['b_asneeded'].value: + if 'b_asneeded' in linker.base_options and options['b_asneeded'].value: args.append('-Wl,--as-needed') except KeyError: pass @@ -307,7 +303,7 @@ def build_unix_rpath_args(build_dir, rpath_paths, install_rpath): return [] paths = ':'.join([os.path.join(build_dir, p) for p in rpath_paths]) if len(paths) < len(install_rpath): - padding = 'X'*(len(install_rpath) - len(paths)) + padding = 'X' * (len(install_rpath) - len(paths)) if len(paths) == 0: paths = padding else: @@ -651,7 +647,7 @@ class CCompiler(Compiler): return os.path.split(header_name)[-1] + '.' + self.get_pch_suffix() def get_linker_search_args(self, dirname): - return ['-L'+dirname] + return ['-L' + dirname] def gen_import_library_args(self, implibname): """ @@ -1654,7 +1650,7 @@ class DCompiler(Compiler): return [] paths = ':'.join([os.path.join(build_dir, p) for p in rpath_paths]) if len(paths) < len(install_rpath): - padding = 'X'*(len(install_rpath) - len(paths)) + padding = 'X' * (len(install_rpath) - len(paths)) if len(paths) == 0: paths = padding else: @@ -1671,7 +1667,7 @@ class DCompiler(Compiler): if arg == '-pthread': continue if arg.startswith('-Wl,'): - linkargs = arg[arg.index(',')+1:].split(',') + linkargs = arg[arg.index(',') + 1:].split(',') for la in linkargs: dcargs.append('-L' + la.strip()) continue @@ -1716,7 +1712,7 @@ class GnuDCompiler(DCompiler): return ['-Werror'] def get_linker_search_args(self, dirname): - return ['-L'+dirname] + return ['-L' + dirname] def get_buildtype_args(self, buildtype): return d_gdc_buildtype_args[buildtype] @@ -1774,7 +1770,7 @@ class LLVMDCompiler(DCompiler): # -L is recognized as "add this to the search path" by the linker, # while the compiler recognizes it as "pass to linker". So, the first # -L is for the compiler, telling it to pass the second -L to the linker. - return ['-L-L'+dirname] + return ['-L-L' + dirname] def unix_link_flags_to_native(self, args): return self.translate_args_to_nongnu(args) @@ -1820,7 +1816,7 @@ class DmdDCompiler(DCompiler): # -L is recognized as "add this to the search path" by the linker, # while the compiler recognizes it as "pass to linker". So, the first # -L is for the compiler, telling it to pass the second -L to the linker. - return ['-L-L'+dirname] + return ['-L-L' + dirname] def get_buildtype_args(self, buildtype): return d_dmd_buildtype_args[buildtype] @@ -1836,7 +1832,7 @@ class DmdDCompiler(DCompiler): class VisualStudioCCompiler(CCompiler): std_warn_args = ['/W3'] - std_opt_args= ['/O2'] + std_opt_args = ['/O2'] def __init__(self, exelist, version, is_cross, exe_wrap): CCompiler.__init__(self, exelist, version, is_cross, exe_wrap) @@ -1997,7 +1993,7 @@ class VisualStudioCCompiler(CCompiler): def has_multi_arguments(self, args, env): warning_text = '9002' code = 'int i;\n' - (fd, srcname) = tempfile.mkstemp(suffix='.'+self.default_suffix) + (fd, srcname) = tempfile.mkstemp(suffix='.' + self.default_suffix) os.close(fd) with open(srcname, 'w') as ofile: ofile.write(code) @@ -2128,6 +2124,8 @@ class GnuCompiler: return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): + if self.gcc_type == GCC_OSX: + return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] def get_always_args(self): @@ -2226,7 +2224,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): # too strict without this and always fails. return self.get_no_optimization_args() + ['-fpermissive'] -class GnuObjCCompiler(GnuCompiler,ObjCCompiler): +class GnuObjCCompiler(GnuCompiler, ObjCCompiler): def __init__(self, exelist, version, is_cross, exe_wrapper=None, defines=None): ObjCCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) @@ -2275,6 +2273,8 @@ class ClangCompiler(): return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): + if self.clang_type == CLANG_OSX: + return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] def get_pch_suffix(self): @@ -2329,7 +2329,7 @@ class ClangCCompiler(ClangCompiler, CCompiler): def get_options(self): return {'c_std': coredata.UserComboOption('c_std', 'C language standard to use', ['none', 'c89', 'c99', 'c11', - 'gnu89', 'gnu99', 'gnu11',], + 'gnu89', 'gnu99', 'gnu11'], 'none')} def get_option_compile_args(self, options): @@ -2435,6 +2435,8 @@ end program prog return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): + if mesonlib.is_osx(): + return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] def split_shlib_to_parts(self, fname): @@ -2446,7 +2448,7 @@ end program prog def get_dependency_gen_args(self, outtarget, outfile): # Disabled until this is fixed: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62162 - #return ['-cpp', '-MMD', '-MQ', outtarget] + # return ['-cpp', '-MMD', '-MQ', outtarget] return [] def get_output_args(self, target): @@ -2523,7 +2525,7 @@ class G95FortranCompiler(FortranCompiler): self.id = 'g95' def get_module_outdir_args(self, path): - return ['-fmod='+path] + return ['-fmod=' + path] def get_always_args(self): return ['-pipe'] @@ -2555,7 +2557,7 @@ class SunFortranCompiler(FortranCompiler): return [] def get_module_outdir_args(self, path): - return ['-moddir='+path] + return ['-moddir=' + path] class IntelFortranCompiler(FortranCompiler): std_warn_args = ['-warn', 'all'] diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 376319d..cc242f4 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -158,8 +158,8 @@ def load(filename): if not isinstance(obj, CoreData): raise MesonException(load_fail_msg) if obj.version != version: - raise MesonException('Build directory has been generated with Meson version %s, which is incompatible with current version %s.\nPlease delete this build directory AND create a new one.'% - (obj.version, version)) + raise MesonException('Build directory has been generated with Meson version %s, which is incompatible with current version %s.\nPlease delete this build directory AND create a new one.' % + (obj.version, version)) return obj def save(obj, filename): @@ -253,4 +253,4 @@ forbidden_target_names = {'clean': None, 'build.ninja': None, 'scan-build': None, 'reconfigure': None, - } + } diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index c0e8851..4daa296 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -965,7 +965,7 @@ class QtBaseDependency(Dependency): if not self.qmake.found(): continue # Check that the qmake is for qt5 - pc, stdo = Popen_safe(self.qmake.fullpath + ['-v'])[0:2] + pc, stdo = Popen_safe(self.qmake.fullpath + ['-v'])[0:2] if pc.returncode != 0: continue if not 'Qt version ' + self.qtver in stdo: @@ -978,7 +978,7 @@ class QtBaseDependency(Dependency): return self.version = re.search(self.qtver + '(\.\d+)+', stdo).group(0) # Query library path, header path, and binary path - stdo = Popen_safe(self.qmake.fullpath + ['-query'])[1] + stdo = Popen_safe(self.qmake.fullpath + ['-query'])[1] qvars = {} for line in stdo.split('\n'): line = line.strip() @@ -1463,4 +1463,4 @@ packages = {'boost': BoostDependency, 'gl': GLDependency, 'threads': ThreadDependency, 'python3': Python3Dependency, - } + } diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index d95f6f9..2e5387d 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -386,7 +386,7 @@ class Environment(): version = self.get_gnu_version_from_defines(defines) return GnuCCompiler(ccache + [compiler], version, gtype, is_cross, exe_wrap, defines) if 'clang' in out: - if 'Apple' in out: + if 'Apple' in out or for_darwin(want_cross, self): cltype = CLANG_OSX else: cltype = CLANG_STANDARD @@ -680,7 +680,7 @@ class Environment(): if evar in os.environ: linker = os.environ[evar].strip() elif isinstance(compiler, VisualStudioCCompiler): - linker= self.vs_static_linker + linker = self.vs_static_linker else: linker = self.default_static_linker basename = os.path.basename(linker).lower() @@ -793,9 +793,12 @@ def get_args_from_envvars(compiler): return ([], []) # Compile flags - cflags_mapping = {'c': 'CFLAGS', 'cpp': 'CXXFLAGS', - 'objc': 'OBJCFLAGS', 'objcpp': 'OBJCXXFLAGS', - 'fortran': 'FFLAGS', 'd': 'DFLAGS'} + cflags_mapping = {'c': 'CFLAGS', + 'cpp': 'CXXFLAGS', + 'objc': 'OBJCFLAGS', + 'objcpp': 'OBJCXXFLAGS', + 'fortran': 'FFLAGS', + 'd': 'DFLAGS'} compile_flags = os.environ.get(cflags_mapping[lang], '') log_var(cflags_mapping[lang], compile_flags) compile_flags = compile_flags.split() diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index b4c724e..ac15401 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -53,7 +53,7 @@ class TryRunResultHolder(InterpreterObject): 'compiled': self.compiled_method, 'stdout': self.stdout_method, 'stderr': self.stderr_method, - }) + }) def returncode_method(self, args, kwargs): return self.res.returncode @@ -76,7 +76,7 @@ class RunProcess(InterpreterObject): self.methods.update({'returncode': self.returncode_method, 'stdout': self.stdout_method, 'stderr': self.stderr_method, - }) + }) def run_command(self, command_array, source_dir, build_dir, subdir, in_builddir): cmd_name = command_array[0] @@ -130,7 +130,7 @@ class EnvironmentVariablesHolder(MutableInterpreterObject): self.methods.update({'set': self.set_method, 'append': self.append_method, 'prepend': self.prepend_method, - }) + }) @stringArgs def add_var(self, method, args, kwargs): @@ -162,7 +162,7 @@ class ConfigurationDataHolder(MutableInterpreterObject): 'set10': self.set10_method, 'set_quoted': self.set_quoted_method, 'has': self.has_method, - }) + }) def is_used(self): return self.used @@ -346,7 +346,7 @@ class BuildMachine(InterpreterObject): 'cpu_family': self.cpu_family_method, 'cpu': self.cpu_method, 'endian': self.endian_method, - }) + }) def cpu_family_method(self, args, kwargs): return environment.detect_cpu_family(self.compilers) @@ -375,7 +375,7 @@ class CrossMachineInfo(InterpreterObject): 'cpu': self.cpu_method, 'cpu_family': self.cpu_family_method, 'endian': self.endian_method, - }) + }) def system_method(self, args, kwargs): return self.info['system'] @@ -499,7 +499,7 @@ class BuildTargetHolder(InterpreterObject): def private_dir_include_method(self, args, kwargs): return IncludeDirsHolder(build.IncludeDirs('', [], False, - [self.interpreter.backend.get_target_private_dir(self.held_object)])) + [self.interpreter.backend.get_target_private_dir(self.held_object)])) def full_path_method(self, args, kwargs): return self.interpreter.backend.get_target_filename_abs(self.held_object) @@ -588,7 +588,7 @@ class SubprojectHolder(InterpreterObject): super().__init__() self.held_object = subinterpreter self.methods.update({'get_variable': self.get_variable_method, - }) + }) def get_variable_method(self, args, kwargs): if len(args) != 1: @@ -623,7 +623,7 @@ class CompilerHolder(InterpreterObject): 'first_supported_argument': self.first_supported_argument_method, 'unittest_args': self.unittest_args_method, 'symbols_have_underscore_prefix': self.symbols_have_underscore_prefix_method, - }) + }) def version_method(self, args, kwargs): return self.compiler.version @@ -1012,7 +1012,7 @@ class MesonMain(InterpreterObject): 'project_name': self.project_name_method, 'get_cross_property': self.get_cross_property_method, 'backend': self.backend_method, - }) + }) def _find_source_script(self, name, args): # Prefer scripts in the current source directory @@ -1774,8 +1774,8 @@ requirements use the version keyword argument instead.''') # exception; let the caller handle things. except: mlog.log('Also couldn\'t find a fallback subproject in', - mlog.bold(os.path.join(self.subproject_dir, dirname)), - 'for the dependency', mlog.bold(name)) + mlog.bold(os.path.join(self.subproject_dir, dirname)), + 'for the dependency', mlog.bold(name)) return None try: dep = self.subprojects[dirname].get_variable_method([varname], {}) @@ -1792,8 +1792,8 @@ requirements use the version keyword argument instead.''') found = dep.version_method([], {}) if found == 'undefined' or not mesonlib.version_compare(found, wanted): mlog.log('Subproject', mlog.bold(dirname), 'dependency', - mlog.bold(varname), 'version is', mlog.bold(found), - 'but', mlog.bold(wanted), 'is required.') + mlog.bold(varname), 'version is', mlog.bold(found), + 'but', mlog.bold(wanted), 'is required.') return None mlog.log('Found a', mlog.green('fallback'), 'subproject', mlog.bold(os.path.join(self.subproject_dir, dirname)), 'for', diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py index d660f4c..db694c0 100644 --- a/mesonbuild/interpreterbase.py +++ b/mesonbuild/interpreterbase.py @@ -610,7 +610,7 @@ class InterpreterBase: # @noKwargs def func_get_variable(self, node, args, kwargs): - if len(args)<1 or len(args)>2: + if len(args) < 1 or len(args) > 2: raise InvalidCode('Get_variable takes one or two arguments.') varname = args[0] if not isinstance(varname, str): diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 027dd58..8ddf4fe 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -67,8 +67,8 @@ class Conf: if longest_possible_value > 0: titles[3] = 'Possible Values' - print(' %s%s %s%s %s%s %s' % (titles[0], ' '*(longest_name - len(titles[0])), titles[1], ' '*(longest_descr - len(titles[1])), titles[2], ' '*(longest_value - len(titles[2])), titles[3])) - print(' %s%s %s%s %s%s %s' % ('-'*len(titles[0]), ' '*(longest_name - len(titles[0])), '-'*len(titles[1]), ' '*(longest_descr - len(titles[1])), '-'*len(titles[2]), ' '*(longest_value - len(titles[2])), '-'*len(titles[3]))) + print(' %s%s %s%s %s%s %s' % (titles[0], ' ' * (longest_name - len(titles[0])), titles[1], ' ' * (longest_descr - len(titles[1])), titles[2], ' ' * (longest_value - len(titles[2])), titles[3])) + print(' %s%s %s%s %s%s %s' % ('-' * len(titles[0]), ' ' * (longest_name - len(titles[0])), '-' * len(titles[1]), ' ' * (longest_descr - len(titles[1])), '-' * len(titles[2]), ' ' * (longest_value - len(titles[2])), '-' * len(titles[3]))) for i in arr: name = i[0] descr = i[1] @@ -80,9 +80,9 @@ class Conf: possible_values = '[%s]' % ', '.join(map(str, i[3])) elif i[3]: possible_values = i[3] if isinstance(i[3], str) else str(i[3]).lower() - namepad = ' '*(longest_name - len(name)) - descrpad = ' '*(longest_descr - len(descr)) - valuepad = ' '*(longest_value - len(str(value))) + namepad = ' ' * (longest_name - len(name)) + descrpad = ' ' * (longest_descr - len(descr)) + valuepad = ' ' * (longest_value - len(str(value))) f = ' %s%s %s%s %s%s %s' % (name, namepad, descr, descrpad, value, valuepad, possible_values) print(f) @@ -130,7 +130,7 @@ class Conf: carr = [] for key in [ 'buildtype', 'warning_level', 'werror', 'strip', 'unity', 'default_library' ]: 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) print('') print('Base options:') @@ -178,9 +178,9 @@ class Conf: 'sysconfdir', 'localstatedir', 'sharedstatedir', - ]: + ]: parr.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(parr) print('') print('Project options:') @@ -195,10 +195,10 @@ class Conf: opt = options[key] if (opt.choices is None) or (len(opt.choices) == 0): # Zero length list or string - choices = ''; + choices = '' else: # A non zero length list or string, convert to string - choices = str(opt.choices); + choices = str(opt.choices) optarr.append([key, opt.description, opt.value, choices]) self.print_aligned(optarr) print('') @@ -206,7 +206,7 @@ class Conf: tarr = [] for key in [ 'stdsplit', 'errorlogs' ]: 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) def run(args): diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 892770c..3c462c7 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -111,11 +111,11 @@ def list_target_files(target_name, coredata, builddata): print(json.dumps(sources)) def list_buildoptions(coredata, builddata): - buildtype= {'choices': ['plain', 'debug', 'debugoptimized', 'release', 'minsize'], - 'type': 'combo', - 'value': coredata.get_builtin_option('buildtype'), - 'description': 'Build type', - 'name': 'type'} + buildtype = {'choices': ['plain', 'debug', 'debugoptimized', 'release', 'minsize'], + 'type': 'combo', + 'value': coredata.get_builtin_option('buildtype'), + 'description': 'Build type', + 'name': 'type'} strip = {'value': coredata.get_builtin_option('strip'), 'type': 'boolean', 'description': 'Strip on install', diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 95113a0..3f88585 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -260,9 +260,9 @@ can not be used with the current version of glib-compiled-resources, due to link_command = ['-l%s' % lib.name] if isinstance(lib, build.SharedLibrary): libdir = os.path.join(state.environment.get_build_dir(), lib.subdir) - link_command += ['-L%s' %libdir] + link_command += ['-L%s' % libdir] if include_rpath: - link_command += ['-Wl,-rpath %s' %libdir] + link_command += ['-Wl,-rpath %s' % libdir] if depends: depends.append(lib) return link_command @@ -292,7 +292,7 @@ can not be used with the current version of glib-compiled-resources, due to for source in dep.sources: if hasattr(source, 'held_object') and isinstance(source.held_object, GirTarget): gi_includes.update([os.path.join(state.environment.get_build_dir(), - source.held_object.get_subdir())]) + source.held_object.get_subdir())]) # This should be any dependency other than an internal one. elif isinstance(dep, Dependency): cflags.update(dep.get_compile_args()) @@ -362,7 +362,7 @@ can not be used with the current version of glib-compiled-resources, due to scan_command = giscanner.get_command() + ['@INPUT@'] scan_command += pkgargs - scan_command += ['--no-libtool', '--namespace='+ns, '--nsversion=' + nsversion, '--warn-all', + scan_command += ['--no-libtool', '--namespace=' + ns, '--nsversion=' + nsversion, '--warn-all', '--output', '@OUTPUT@'] extra_args = mesonlib.stringlistify(kwargs.pop('extra_args', [])) @@ -506,12 +506,11 @@ can not be used with the current version of glib-compiled-resources, due to scankwargs = {'output': girfile, 'input': libsources, 'command': scan_command, - 'depends': depends, - } + 'depends': depends} if kwargs.get('install'): scankwargs['install'] = kwargs['install'] scankwargs['install_dir'] = kwargs.get('install_dir_gir', - os.path.join(state.environment.get_datadir(), 'gir-1.0')) + os.path.join(state.environment.get_datadir(), 'gir-1.0')) scan_target = GirTarget(girfile, state.subdir, scankwargs) typelib_output = '%s-%s.typelib' % (ns, nsversion) @@ -528,7 +527,7 @@ can not be used with the current version of glib-compiled-resources, due to if kwargs.get('install'): typelib_kwargs['install'] = kwargs['install'] typelib_kwargs['install_dir'] = kwargs.get('install_dir_typelib', - os.path.join(state.environment.get_libdir(), 'girepository-1.0')) + os.path.join(state.environment.get_libdir(), 'girepository-1.0')) typelib_target = TypelibTarget(typelib_output, state.subdir, typelib_kwargs) return [scan_target, typelib_target] @@ -575,13 +574,12 @@ can not be used with the current version of glib-compiled-resources, due to script = [sys.executable, state.environment.get_build_command()] args = ['--internal', - 'yelphelper', - 'install', - '--subdir=' + state.subdir, - '--id=' + project_id, - '--installdir=' + os.path.join(state.environment.get_datadir(), 'help'), - '--sources=' + source_str, - ] + 'yelphelper', + 'install', + '--subdir=' + state.subdir, + '--id=' + project_id, + '--installdir=' + os.path.join(state.environment.get_datadir(), 'help'), + '--sources=' + source_str] if symlinks: args.append('--symlinks=true') if media: @@ -1035,8 +1033,8 @@ can not be used with the current version of glib-compiled-resources, due to 'depends': vapi_depends, } install_dir = kwargs.get('install_dir', - os.path.join(state.environment.coredata.get_builtin_option('datadir'), - 'vala', 'vapi')) + os.path.join(state.environment.coredata.get_builtin_option('datadir'), + 'vala', 'vapi')) if kwargs.get('install'): custom_kwargs['install'] = kwargs['install'] custom_kwargs['install_dir'] = install_dir diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index 6c59f52..aaf0746 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -48,7 +48,7 @@ class PkgConfigModule: # '${prefix}' is ignored if the second path is absolute (see # 'os.path.join' for details) ofile.write('libdir=%s\n' % os.path.join('${prefix}', coredata.get_builtin_option('libdir'))) - ofile.write('includedir=%s\n' % os.path.join('${prefix}', coredata.get_builtin_option('includedir'))) + ofile.write('includedir=%s\n' % os.path.join('${prefix}', coredata.get_builtin_option('includedir'))) ofile.write('\n') ofile.write('Name: %s\n' % name) if len(description) > 0: @@ -130,7 +130,7 @@ class PkgConfigModule: priv_reqs = mesonlib.stringlistify(kwargs.get('requires_private', [])) conflicts = mesonlib.stringlistify(kwargs.get('conflicts', [])) pcfile = filebase + '.pc' - pkgroot = kwargs.get('install_dir',None) + pkgroot = kwargs.get('install_dir', None) if pkgroot is None: pkgroot = os.path.join(state.environment.coredata.get_builtin_option('libdir'), 'pkgconfig') if not isinstance(pkgroot, str): diff --git a/mesonbuild/modules/qt4.py b/mesonbuild/modules/qt4.py index 95932d9..8670533 100644 --- a/mesonbuild/modules/qt4.py +++ b/mesonbuild/modules/qt4.py @@ -130,8 +130,7 @@ class Qt4Module(): rcc_kwargs = {'input': rcc_files, 'output': name + '.cpp', 'command': [self.rcc, '-o', '@OUTPUT@', '@INPUT@'], - 'depend_files': qrc_deps, - } + 'depend_files': qrc_deps} res_target = build.CustomTarget(name, state.subdir, rcc_kwargs) sources.append(res_target) if len(ui_files) > 0: diff --git a/mesonbuild/modules/qt5.py b/mesonbuild/modules/qt5.py index eb467f7..7a9f8f5 100644 --- a/mesonbuild/modules/qt5.py +++ b/mesonbuild/modules/qt5.py @@ -136,8 +136,7 @@ class Qt5Module(): rcc_kwargs = {'input': rcc_files, 'output': name + '.cpp', 'command': [self.rcc, '-o', '@OUTPUT@', '@INPUT@'], - 'depend_files': qrc_deps, - } + 'depend_files': qrc_deps} res_target = build.CustomTarget(name, state.subdir, rcc_kwargs) sources.append(res_target) if len(ui_files) > 0: diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index ad1fedd..6b1c8ee 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -76,7 +76,7 @@ class Lexer: def lex(self, code, subdir): lineno = 1 line_start = 0 - loc = 0; + loc = 0 par_count = 0 bracket_count = 0 col = 0 @@ -87,7 +87,7 @@ class Lexer: mo = reg.match(code, loc) if mo: curline = lineno - col = mo.start()-line_start + col = mo.start() - line_start matched = True span_start = loc loc = mo.end() @@ -177,7 +177,7 @@ class ArrayNode: class EmptyNode: def __init__(self): - self.subdir ='' + self.subdir = '' self.lineno = 0 self.colno = 0 self.value = None @@ -207,7 +207,7 @@ class ComparisonNode: self.ctype = ctype class ArithmeticNode: - def __init__(self,operation, left, right): + def __init__(self, operation, left, right): self.subdir = left.subdir self.lineno = left.lineno self.colno = left.colno @@ -519,7 +519,7 @@ class Parser: def e9(self): t = self.current if self.accept('true'): - return BooleanNode(t, True); + return BooleanNode(t, True) if self.accept('false'): return BooleanNode(t, False) if self.accept('id'): diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index b8f57ab..ac23fe8 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -65,7 +65,7 @@ def ComboParser(name, description, kwargs): option_types = {'string': StringParser, 'boolean': BooleanParser, 'combo': ComboParser, - } + } class OptionInterpreter: def __init__(self, subproject, command_line_options): diff --git a/mesonbuild/scripts/commandrunner.py b/mesonbuild/scripts/commandrunner.py index 695301b..cf2770d 100644 --- a/mesonbuild/scripts/commandrunner.py +++ b/mesonbuild/scripts/commandrunner.py @@ -20,8 +20,8 @@ import sys, os, subprocess, shutil def run_command(source_dir, build_dir, subdir, command, arguments): env = {'MESON_SOURCE_ROOT': source_dir, 'MESON_BUILD_ROOT': build_dir, - 'MESON_SUBDIR': subdir - } + 'MESON_SUBDIR': subdir, + } cwd = os.path.join(source_dir, subdir) child_env = os.environ.copy() child_env.update(env) @@ -35,7 +35,7 @@ def run_command(source_dir, build_dir, subdir, command, arguments): fullpath = os.path.join(source_dir, subdir, command) command_array = [fullpath] + arguments try: - return subprocess.Popen(command_array,env=child_env, cwd=cwd) + return subprocess.Popen(command_array, env=child_env, cwd=cwd) except FileNotFoundError: print('Could not execute command "%s".' % command) sys.exit(1) diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py index baa401e..c9ee36c 100644 --- a/mesonbuild/scripts/depfixer.py +++ b/mesonbuild/scripts/depfixer.py @@ -29,25 +29,25 @@ class DataSizes(): p = '<' else: p = '>' - self.Half = p+'h' + self.Half = p + 'h' self.HalfSize = 2 - self.Word = p+'I' + self.Word = p + 'I' self.WordSize = 4 - self.Sword = p+'i' + self.Sword = p + 'i' self.SwordSize = 4 if ptrsize == 64: - self.Addr = p+'Q' + self.Addr = p + 'Q' self.AddrSize = 8 - self.Off = p+'Q' + self.Off = p + 'Q' self.OffSize = 8 - self.XWord = p+'Q' + self.XWord = p + 'Q' self.XWordSize = 8 - self.Sxword = p+'q' + self.Sxword = p + 'q' self.SxwordSize = 8 else: - self.Addr = p+'I' + self.Addr = p + 'I' self.AddrSize = 4 - self.Off = p+'I' + self.Off = p + 'I' self.OffSize = 4 class DynamicEntry(DataSizes): @@ -55,8 +55,8 @@ class DynamicEntry(DataSizes): super().__init__(ptrsize, is_le) self.ptrsize = ptrsize if ptrsize == 64: - self.d_tag = struct.unpack(self.Sxword, ifile.read(self.SxwordSize))[0]; - self.val = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0]; + self.d_tag = struct.unpack(self.Sxword, ifile.read(self.SxwordSize))[0] + self.val = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0] else: self.d_tag = struct.unpack(self.Sword, ifile.read(self.SwordSize))[0] self.val = struct.unpack(self.Word, ifile.read(self.WordSize))[0] @@ -76,29 +76,29 @@ class SectionHeader(DataSizes): is_64 = True else: is_64 = False -#Elf64_Word - self.sh_name = struct.unpack(self.Word, ifile.read(self.WordSize))[0]; -#Elf64_Word +# Elf64_Word + self.sh_name = struct.unpack(self.Word, ifile.read(self.WordSize))[0] +# Elf64_Word self.sh_type = struct.unpack(self.Word, ifile.read(self.WordSize))[0] -#Elf64_Xword +# Elf64_Xword if is_64: self.sh_flags = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0] else: self.sh_flags = struct.unpack(self.Word, ifile.read(self.WordSize))[0] -#Elf64_Addr - self.sh_addr = struct.unpack(self.Addr, ifile.read(self.AddrSize))[0]; -#Elf64_Off +# Elf64_Addr + self.sh_addr = struct.unpack(self.Addr, ifile.read(self.AddrSize))[0] +# Elf64_Off self.sh_offset = struct.unpack(self.Off, ifile.read(self.OffSize))[0] -#Elf64_Xword +# Elf64_Xword if is_64: self.sh_size = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0] else: self.sh_size = struct.unpack(self.Word, ifile.read(self.WordSize))[0] -#Elf64_Word - self.sh_link = struct.unpack(self.Word, ifile.read(self.WordSize))[0]; -#Elf64_Word - self.sh_info = struct.unpack(self.Word, ifile.read(self.WordSize))[0]; -#Elf64_Xword +# Elf64_Word + self.sh_link = struct.unpack(self.Word, ifile.read(self.WordSize))[0] +# Elf64_Word + self.sh_info = struct.unpack(self.Word, ifile.read(self.WordSize))[0] +# Elf64_Xword if is_64: self.sh_addralign = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0] else: @@ -273,7 +273,7 @@ class Elf(DataSizes): name = self.read_str() if name.startswith(prefix): basename = name.split(b'/')[-1] - padding = b'\0'*(len(name) - len(basename)) + padding = b'\0' * (len(name) - len(basename)) newname = basename + padding assert(len(newname) == len(name)) self.bf.seek(offset) @@ -299,7 +299,7 @@ class Elf(DataSizes): sys.exit("New rpath must not be longer than the old one.") self.bf.seek(rp_off) self.bf.write(new_rpath) - self.bf.write(b'\0'*(len(old_rpath) - len(new_rpath) + 1)) + self.bf.write(b'\0' * (len(old_rpath) - len(new_rpath) + 1)) if len(new_rpath) == 0: self.remove_rpath_entry(entrynum) @@ -311,8 +311,8 @@ class Elf(DataSizes): if entry.d_tag == entrynum: rpentry = self.dynamic[i] rpentry.d_tag = 0 - self.dynamic = self.dynamic[:i] + self.dynamic[i+1:] + [rpentry] - break; + self.dynamic = self.dynamic[:i] + self.dynamic[i + 1:] + [rpentry] + break # DT_MIPS_RLD_MAP_REL is relative to the offset of the tag. Adjust it consequently. for entry in self.dynamic[i:]: if entry.d_tag == DT_MIPS_RLD_MAP_REL: diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py index 734f80b..6486e28 100644 --- a/mesonbuild/scripts/gtkdochelper.py +++ b/mesonbuild/scripts/gtkdochelper.py @@ -108,7 +108,9 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs, if gobject_typesfile: scanobjs_cmd = ['gtkdoc-scangobj'] + scanobjs_args + [gobject_typesfile, - '--module=' + module, '--cflags=' + cflags, '--ldflags=' + ldflags] + '--module=' + module, + '--cflags=' + cflags, + '--ldflags=' + ldflags] gtkdoc_run_check(scanobjs_cmd, abs_out) diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index f497f2c..676a1e5 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -51,7 +51,7 @@ def do_copydir(src_prefix, src_dir, dst_dir): for root, dirs, files in os.walk(src_prefix): for d in dirs: abs_src = os.path.join(src_dir, root, d) - filepart = abs_src[len(src_dir)+1:] + filepart = abs_src[len(src_dir) + 1:] abs_dst = os.path.join(dst_dir, filepart) if os.path.isdir(abs_dst): continue @@ -62,7 +62,7 @@ def do_copydir(src_prefix, src_dir, dst_dir): shutil.copystat(abs_src, abs_dst) for f in files: abs_src = os.path.join(src_dir, root, f) - filepart = abs_src[len(src_dir)+1:] + filepart = abs_src[len(src_dir) + 1:] abs_dst = os.path.join(dst_dir, filepart) if os.path.isdir(abs_dst): print('Tried to copy file %s but a directory of that name already exists.' % abs_dst) @@ -146,7 +146,7 @@ def run_install_script(d): 'MESON_BUILD_ROOT': d.build_dir, 'MESON_INSTALL_PREFIX': d.prefix, 'MESON_INSTALL_DESTDIR_PREFIX': d.fullprefix, - } + } child_env = os.environ.copy() child_env.update(env) diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index bfd629f..976d2f0 100644 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -80,7 +80,7 @@ def osx_syms(libfilename, outfilename): if 'LC_ID_DYLIB' in val: match = i break - result = [arr[match+2], arr[match+5]] # Libreoffice stores all 5 lines but the others seem irrelevant. + result = [arr[match + 2], arr[match + 5]] # Libreoffice stores all 5 lines but the others seem irrelevant. pnm, output = Popen_safe(['nm', '-g', '-P', libfilename])[0:2] if pnm.returncode != 0: raise RuntimeError('nm does not work.') diff --git a/mesonbuild/scripts/yelphelper.py b/mesonbuild/scripts/yelphelper.py index 76366a4..85d89b8 100644 --- a/mesonbuild/scripts/yelphelper.py +++ b/mesonbuild/scripts/yelphelper.py @@ -33,7 +33,7 @@ def build_pot(srcdir, project_id, sources): # Must be relative paths sources = [os.path.join('C', source) for source in sources] outfile = os.path.join(srcdir, project_id + '.pot') - subprocess.call(['itstool', '-o', outfile]+sources) + subprocess.call(['itstool', '-o', outfile] + sources) def update_po(srcdir, project_id, langs): potfile = os.path.join(srcdir, project_id + '.pot') @@ -55,7 +55,7 @@ def merge_translations(blddir, sources, langs): subprocess.call([ 'itstool', '-m', os.path.join(blddir, lang, lang + '.gmo'), '-o', os.path.join(blddir, lang) - ]+sources) + ] + sources) def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, project_id, symlinks): c_install_dir = os.path.join(install_dir, 'C', project_id) @@ -65,7 +65,7 @@ def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, pr for source in sources: infile = os.path.join(srcdir if lang == 'C' else blddir, lang, source) outfile = os.path.join(indir, source) - mlog.log('Installing %s to %s.' %(infile, outfile)) + mlog.log('Installing %s to %s.' % (infile, outfile)) shutil.copyfile(infile, outfile) shutil.copystat(infile, outfile) for m in media: @@ -73,15 +73,15 @@ def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, pr outfile = os.path.join(indir, m) if not os.path.exists(infile): if lang == 'C': - mlog.warning('Media file "%s" did not exist in C directory' %m) + mlog.warning('Media file "%s" did not exist in C directory' % m) elif symlinks: srcfile = os.path.join(c_install_dir, m) - mlog.log('Symlinking %s to %s.' %(outfile, srcfile)) + mlog.log('Symlinking %s to %s.' % (outfile, srcfile)) if '/' in m or '\\' in m: os.makedirs(os.path.dirname(outfile), exist_ok=True) os.symlink(srcfile, outfile) continue - mlog.log('Installing %s to %s.' %(infile, outfile)) + mlog.log('Installing %s to %s.' % (infile, outfile)) if '/' in m or '\\' in m: os.makedirs(os.path.dirname(outfile), exist_ok=True) shutil.copyfile(infile, outfile) diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 3db3f9b..dead6fb 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -99,7 +99,7 @@ class Resolver: return packagename else: mlog.warning('Subproject directory %s is empty, possibly because of an unfinished' - 'checkout, removing to reclone' % dirname) + 'checkout, removing to reclone' % dirname) os.rmdir(dirname) except NotADirectoryError: raise RuntimeError('%s is not a directory, can not use as subproject.' % dirname) @@ -181,7 +181,7 @@ class Resolver: cwd=checkoutdir) def get_data(self, url): - blocksize = 10*1024 + blocksize = 10 * 1024 if url.startswith('https://wrapdb.mesonbuild.com'): resp = open_wrapdburl(url) else: @@ -206,7 +206,7 @@ class Resolver: break downloaded += len(block) blocks.append(block) - ratio = int(downloaded/dlsize * 10) + ratio = int(downloaded / dlsize * 10) while printed_dots < ratio: print('.', end='') sys.stdout.flush() diff --git a/mesontest.py b/mesontest.py index 28440e0..ecf1b41 100755 --- a/mesontest.py +++ b/mesontest.py @@ -101,7 +101,7 @@ class TestRun(): if self.cmd is None: res += 'NONE\n' else: - res += "\n%s %s\n" %(' '.join( + res += "\n%s %s\n" % (' '.join( ["%s='%s'" % (k, v) for k, v in self.env.items()]), ' ' .join(self.cmd)) if self.stdo: @@ -131,8 +131,7 @@ def write_json_log(jsonlogfile, test_name, result): 'result': result.res, 'duration': result.duration, 'returncode': result.returncode, - 'command': result.cmd, - } + 'command': result.cmd} if isinstance(result.env, dict): jresult['env'] = result.env else: @@ -274,10 +273,10 @@ class TestHarness: return result def print_stats(self, numlen, tests, name, result, i, logfile, jsonlogfile): - startpad = ' '*(numlen - len('%d' % (i+1))) - num = '%s%d/%d' % (startpad, i+1, len(tests)) - padding1 = ' '*(38-len(name)) - padding2 = ' '*(8-len(result.res)) + startpad = ' ' * (numlen - len('%d' % (i + 1))) + num = '%s%d/%d' % (startpad, i + 1, len(tests)) + padding1 = ' ' * (38 - len(name)) + padding2 = ' ' * (8 - len(result.res)) result_str = '%s %s %s%s%s%5.2f s' % \ (num, name, padding1, result.res, padding2, result.duration) print(result_str) @@ -327,7 +326,7 @@ class TestHarness: if self.options.wrapper is None: wrap = [] logfilename = logfile_base + '.txt' - jsonlogfilename = logfile_base+ '.json' + jsonlogfilename = logfile_base + '.json' else: wrap = self.options.wrapper.split() namebase = wrap[0] @@ -346,10 +345,10 @@ class TestHarness: logfile = None try: if not self.options.verbose: - jsonlogfile = open(jsonlogfilename, 'w') + jsonlogfile = open(jsonlogfilename, 'w') logfile = open(logfilename, 'w') logfile.write('Log of Meson test suite run on %s.\n\n' % - datetime.datetime.now().isoformat()) + datetime.datetime.now().isoformat()) for i in range(self.options.repeat): for i, test in enumerate(filtered_tests): @@ -367,7 +366,7 @@ class TestHarness: res = self.run_single_test(wrap, test) if not self.options.verbose: self.print_stats(numlen, filtered_tests, visible_name, res, i, - logfile, jsonlogfile) + logfile, jsonlogfile) else: f = executor.submit(self.run_single_test, wrap, test) if not self.options.verbose: @@ -425,7 +424,7 @@ class TestHarness: for t in tests: if t.name in self.options.args: for i in range(self.options.repeat): - print('Running: %s %d/%d' % (t.name, i+1, self.options.repeat)) + print('Running: %s %d/%d' % (t.name, i + 1, self.options.repeat)) if self.options.gdb: wrap = ['gdb', '--quiet'] if len(t.cmd_args) > 0: diff --git a/run_project_tests.py b/run_project_tests.py index 6e2cb45..07e7ddb 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -59,7 +59,7 @@ class AutoDeletedDir(): shutil.rmtree(self.dir) return except OSError: - if i == retries-1: + if i == retries - 1: raise time.sleep(0.1 * (2**i)) @@ -84,7 +84,7 @@ def stop_handler(signal, frame): signal.signal(signal.SIGINT, stop_handler) signal.signal(signal.SIGTERM, stop_handler) -#unity_flags = ['--unity'] +# unity_flags = ['--unity'] unity_flags = [] backend_flags = None @@ -472,7 +472,7 @@ def check_format(): def pbcompile(compiler, source, objectfile): if compiler == 'cl': - cmd = [compiler, '/nologo', '/Fo'+objectfile, '/c', source] + cmd = [compiler, '/nologo', '/Fo' + objectfile, '/c', source] else: cmd = [compiler, '-c', source, '-o', objectfile] subprocess.check_call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) @@ -518,7 +518,7 @@ def generate_prebuilt(): if __name__ == '__main__': parser = argparse.ArgumentParser(description="Run the test suite of Meson.") parser.add_argument('extra_args', nargs='*', - help='arguments that are passed directly to Meson (remember to have -- before these).') + help='arguments that are passed directly to Meson (remember to have -- before these).') parser.add_argument('--backend', default=None, dest='backend', choices = backendlist) options = parser.parse_args() diff --git a/test cases/common/129 object only target/obj_generator.py b/test cases/common/129 object only target/obj_generator.py index a1f7421..f0239b4 100755 --- a/test cases/common/129 object only target/obj_generator.py +++ b/test cases/common/129 object only target/obj_generator.py @@ -12,7 +12,7 @@ if __name__ == '__main__': ifile = sys.argv[2] ofile = sys.argv[3] if compiler.endswith('cl'): - cmd = [compiler, '/nologo', '/MDd', '/Fo'+ofile, '/c', ifile] + cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] else: cmd = [compiler, '-c', ifile, '-o', ofile] sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/59 object generator/obj_generator.py b/test cases/common/59 object generator/obj_generator.py index d028156..a33872a 100755 --- a/test cases/common/59 object generator/obj_generator.py +++ b/test cases/common/59 object generator/obj_generator.py @@ -12,7 +12,7 @@ if __name__ == '__main__': ifile = sys.argv[2] ofile = sys.argv[3] if compiler.endswith('cl'): - cmd = [compiler, '/nologo', '/MDd', '/Fo'+ofile, '/c', ifile] + cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] else: cmd = [compiler, '-c', ifile, '-o', ofile] sys.exit(subprocess.call(cmd)) diff --git a/tools/ac_converter.py b/tools/ac_converter.py index c5c4995..0531e98 100755 --- a/tools/ac_converter.py +++ b/tools/ac_converter.py @@ -217,7 +217,7 @@ function_data = \ 'HAVE_SETJMP': ('setjmp', 'setjmp.h'), 'HAVE_PTHREAD_SETNAME_NP': ('pthread_setname_np', 'pthread.h'), 'HAVE_PTHREAD_SET_NAME_NP': ('pthread_set_name_np', 'pthread.h'), - } + } headers = [] functions = [] diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py index 7b28597..7d6d02a 100755 --- a/tools/cmake2meson.py +++ b/tools/cmake2meson.py @@ -46,14 +46,14 @@ class Lexer: def lex(self, code): lineno = 1 line_start = 0 - loc = 0; + loc = 0 col = 0 while(loc < len(code)): matched = False for (tid, reg) in self.token_specification: mo = reg.match(code, loc) if mo: - col = mo.start()-line_start + col = mo.start() - line_start matched = True loc = mo.end() match_text = mo.group() @@ -70,7 +70,7 @@ class Lexer: elif tid == 'id': yield(Token('id', match_text)) elif tid == 'eol': - #yield('eol') + # yield('eol') lineno += 1 col = 1 line_start = mo.end() @@ -240,7 +240,7 @@ class Converter: else: line = '''# %s(%s)''' % (t.name, self.convert_args(t.args)) self.indent_level += preincrement - indent = self.indent_level*self.indent_unit + indent = self.indent_level * self.indent_unit outfile.write(indent) outfile.write(line) if not(line.endswith('\n')): |