diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-01-28 15:42:42 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-01-29 22:06:11 +0200 |
commit | da34bea893b3b309800e0f03021a99ee58c599d6 (patch) | |
tree | fe58634de2ad20678a25292571f5bd2cfdb64847 /mesonbuild | |
parent | 4e31ca3abeecf0591cccc7052da34c2735759030 (diff) | |
download | meson-da34bea893b3b309800e0f03021a99ee58c599d6.zip meson-da34bea893b3b309800e0f03021a99ee58c599d6.tar.gz meson-da34bea893b3b309800e0f03021a99ee58c599d6.tar.bz2 |
pep8 py37
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/backends.py | 4 | ||||
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 32 | ||||
-rw-r--r-- | mesonbuild/dependencies/misc.py | 2 | ||||
-rw-r--r-- | mesonbuild/dependencies/ui.py | 2 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 2 | ||||
-rw-r--r-- | mesonbuild/mesonlib.py | 2 | ||||
-rw-r--r-- | mesonbuild/mesonmain.py | 2 | ||||
-rw-r--r-- | mesonbuild/minstall.py | 4 | ||||
-rw-r--r-- | mesonbuild/modules/pkgconfig.py | 2 | ||||
-rw-r--r-- | mesonbuild/mparser.py | 2 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 2 |
11 files changed, 28 insertions, 28 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 9f3f5d6..a0326f3 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -798,7 +798,7 @@ class Backend: def replace_outputs(self, args, private_dir, output_list): newargs = [] - regex = re.compile('@OUTPUT(\d+)@') + regex = re.compile(r'@OUTPUT(\d+)@') for arg in args: m = regex.search(arg) while m is not None: @@ -938,7 +938,7 @@ class Backend: dfilename = os.path.join(outdir, target.depfile) i = i.replace('@DEPFILE@', dfilename) elif '@PRIVATE_OUTDIR_' in i: - match = re.search('@PRIVATE_OUTDIR_(ABS_)?([^/\s*]*)@', i) + match = re.search(r'@PRIVATE_OUTDIR_(ABS_)?([^/\s*]*)@', i) if not match: msg = 'Custom target {!r} has an invalid argument {!r}' \ ''.format(target.name, i) diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 0d72223..783ae64 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -472,14 +472,14 @@ class Vs2010Backend(backends.Backend): pname.text = project_name if self.windows_target_platform_version: ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props') type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') ET.SubElement(type_config, 'ConfigurationType') ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' ET.SubElement(type_config, 'UseOfMfc').text = 'false' if self.platform_toolset: ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props') direlem = ET.SubElement(root, 'PropertyGroup') fver = ET.SubElement(direlem, '_ProjectFileVersion') fver.text = self.project_file_version @@ -517,7 +517,7 @@ class Vs2010Backend(backends.Backend): 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') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname) def gen_custom_target_vcxproj(self, target, ofname, guid): @@ -543,7 +543,7 @@ class Vs2010Backend(backends.Backend): ET.SubElement(customstep, 'Command').text = ' '.join(self.quote_arguments(wrapper_cmd)) ET.SubElement(customstep, 'Outputs').text = ';'.join(ofilenames) ET.SubElement(customstep, 'Inputs').text = ';'.join([exe_data] + srcs + depend_files) - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') self.generate_custom_generator_commands(target, root) self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname) @@ -769,7 +769,7 @@ class Vs2010Backend(backends.Backend): pname.text = project_name if self.windows_target_platform_version: ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props') # Start configuration type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') ET.SubElement(type_config, 'ConfigurationType').text = conftype @@ -842,7 +842,7 @@ class Vs2010Backend(backends.Backend): elif '/Od' in o_flags: ET.SubElement(type_config, 'Optimization').text = 'Disabled' # End configuration - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props') generated_files, custom_target_output_files, generated_files_include_dirs = self.generate_custom_generator_commands(target, root) (gen_src, gen_hdrs, gen_objs, gen_langs) = self.split_sources(generated_files) (custom_src, custom_hdrs, custom_objs, custom_langs) = self.split_sources(custom_target_output_files) @@ -1201,7 +1201,7 @@ class Vs2010Backend(backends.Backend): ET.SubElement(inc_objs, 'Object', Include=s) self.add_generated_objects(inc_objs, gen_objs) - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') # Reference the regen target. regen_vcxproj = os.path.join(self.environment.get_build_dir(), 'REGEN.vcxproj') self.add_project_reference(root, regen_vcxproj, self.environment.coredata.regen_guid) @@ -1229,14 +1229,14 @@ class Vs2010Backend(backends.Backend): pname.text = project_name if self.windows_target_platform_version: ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props') type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') ET.SubElement(type_config, 'ConfigurationType').text = "Utility" ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' ET.SubElement(type_config, 'UseOfMfc').text = 'false' if self.platform_toolset: ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props') direlem = ET.SubElement(root, 'PropertyGroup') fver = ET.SubElement(direlem, '_ProjectFileVersion') fver.text = self.project_file_version @@ -1281,7 +1281,7 @@ if %%errorlevel%% neq 0 goto :VCEnd''' ET.SubElement(custombuild, 'Outputs').text = Vs2010Backend.get_regen_stampfile(self.environment.get_build_dir()) deps = self.get_regen_filelist() ET.SubElement(custombuild, 'AdditionalInputs').text = ';'.join(deps) - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') ET.SubElement(root, 'ImportGroup', Label='ExtensionTargets') self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname) @@ -1308,14 +1308,14 @@ if %%errorlevel%% neq 0 goto :VCEnd''' pname.text = project_name if self.windows_target_platform_version: ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props') type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') ET.SubElement(type_config, 'ConfigurationType') ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' ET.SubElement(type_config, 'UseOfMfc').text = 'false' if self.platform_toolset: ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props') direlem = ET.SubElement(root, 'PropertyGroup') fver = ET.SubElement(direlem, '_ProjectFileVersion') fver.text = self.project_file_version @@ -1354,7 +1354,7 @@ if %%errorlevel%% neq 0 goto :VCEnd''' self.serialize_tests() ET.SubElement(postbuild, 'Command').text =\ cmd_templ % ('" "'.join(test_command)) - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname) def gen_installproj(self, target_name, ofname): @@ -1381,14 +1381,14 @@ if %%errorlevel%% neq 0 goto :VCEnd''' pname.text = project_name if self.windows_target_platform_version: ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props') type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') ET.SubElement(type_config, 'ConfigurationType') ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' ET.SubElement(type_config, 'UseOfMfc').text = 'false' if self.platform_toolset: ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props') direlem = ET.SubElement(root, 'PropertyGroup') fver = ET.SubElement(direlem, '_ProjectFileVersion') fver.text = self.project_file_version @@ -1422,7 +1422,7 @@ exit /b %%1 if %%errorlevel%% neq 0 goto :VCEnd''' ET.SubElement(postbuild, 'Command').text =\ cmd_templ % ('" "'.join(test_command)) - ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') + ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets') self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname) def generate_debug_information(self, link): diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 9e0a65a..e6f52a5 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -176,7 +176,7 @@ class MPIDependency(ExternalDependency): mlog.debug(mlog.bold('Standard output\n'), o) mlog.debug(mlog.bold('Standard error\n'), e) return - version = re.search('\d+.\d+.\d+', o) + version = re.search(r'\d+.\d+.\d+', o) if version: version = version.group(0) else: diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index 03c96f2..c2b5103 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -360,7 +360,7 @@ class QtBaseDependency(ExternalDependency): # Didn't find qmake :( self.is_found = False return - self.version = re.search(self.qtver + '(\.\d+)+', stdo).group(0) + self.version = re.search(self.qtver + r'(\.\d+)+', stdo).group(0) # Query library path, header path, and binary path mlog.log("Found qmake:", mlog.bold(self.qmake.get_name()), '(%s)' % self.version) stdo = Popen_safe(self.qmake.get_command() + ['-query'])[1] diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 6a79517..c940f40 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2853,7 +2853,7 @@ external dependencies (including libraries) must go to "dependencies".''') subproject = self.subprojects[dirname] if subproject.found(): dep = self.subprojects[dirname].get_variable_method([varname], {}) - except InvalidArguments as e: + except InvalidArguments: pass if not isinstance(dep, DependencyHolder): diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 2170fec..8454d79 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -608,7 +608,7 @@ def version_compare_condition_with_min(condition, minimum): # Map versions in the constraint of the form '0.46' to '0.46.0', to embed # this knowledge of the meson versioning scheme. condition = condition.strip() - if re.match('^\d+.\d+$', condition): + if re.match(r'^\d+.\d+$', condition): condition += '.0' return cmpop(Version(minimum), Version(condition)) diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 037d76c..f0f287f 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -120,7 +120,7 @@ class CommandLineParser: if os.environ.get('MESON_FORCE_BACKTRACE'): raise return 1 - except Exception as e: + except Exception: if os.environ.get('MESON_FORCE_BACKTRACE'): raise traceback.print_exc() diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index 74a8497..c6b6bbf 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -101,7 +101,7 @@ def set_chown(path, user=None, group=None, dir_fd=None, follow_symlinks=True): def set_chmod(path, mode, dir_fd=None, follow_symlinks=True): try: os.chmod(path, mode, dir_fd=dir_fd, follow_symlinks=follow_symlinks) - except (NotImplementedError, OSError, SystemError) as e: + except (NotImplementedError, OSError, SystemError): if not os.path.islink(path): os.chmod(path, mode, dir_fd=dir_fd) @@ -157,7 +157,7 @@ def restore_selinux_contexts(): ''' try: subprocess.check_call(['selinuxenabled']) - except (FileNotFoundError, PermissionError, subprocess.CalledProcessError) as e: + except (FileNotFoundError, PermissionError, subprocess.CalledProcessError): # If we don't have selinux or selinuxenabled returned 1, failure # is ignored quietly. return diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index bc9bff8..05fcd5e 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -239,7 +239,7 @@ class PkgConfigModule(ExtensionModule): # https://bugs.freedesktop.org/show_bug.cgi?id=103203 if isinstance(value, PurePath): value = value.as_posix() - return value.replace(' ', '\ ') + return value.replace(' ', r'\ ') def _make_relative(self, prefix, subdir): if isinstance(prefix, PurePath): diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index ec18837..ed0dc1b 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -37,7 +37,7 @@ class MesonUnicodeDecodeError(MesonException): def decode_match(match): try: return codecs.decode(match.group(0), 'unicode_escape') - except UnicodeDecodeError as err: + except UnicodeDecodeError: raise MesonUnicodeDecodeError(match.group(0)) class ParseException(MesonException): diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index f4134d3..e5d0a71 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -349,7 +349,7 @@ class Resolver: if os.path.exists(dst_file): try: os.remove(dst_file) - except PermissionError as exc: + except PermissionError: os.chmod(dst_file, stat.S_IWUSR) os.remove(dst_file) shutil.copy2(src_file, dst_dir) |