diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-10-03 20:31:39 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-10-04 17:01:03 -0400 |
commit | 800c3462f0ce35502232aedb3a318c5579c7a504 (patch) | |
tree | af17102fe3bfdabbe14cf8b47df051d8e0fffa76 | |
parent | d06cc042eb21bc16a4a5cc957a3615e5e3a9743a (diff) | |
download | meson-800c3462f0ce35502232aedb3a318c5579c7a504.zip meson-800c3462f0ce35502232aedb3a318c5579c7a504.tar.gz meson-800c3462f0ce35502232aedb3a318c5579c7a504.tar.bz2 |
condense lines
-rw-r--r-- | mesonbuild/mesonlib/universal.py | 3 | ||||
-rw-r--r-- | mesonbuild/minstall.py | 15 | ||||
-rw-r--r-- | mesonbuild/programs.py | 6 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 9 |
4 files changed, 11 insertions, 22 deletions
diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 9dffdca..ec92990 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -1467,8 +1467,7 @@ def _substitute_values_check_errors(command: T.List[str], values: T.Dict[str, T. # Error out if any output-derived templates are present in the command match = iter_regexin_iter(outregex, command) if match: - m = f'Command cannot have {match!r} since there are no outputs' - raise MesonException(m) + raise MesonException(f'Command cannot have {match!r} since there are no outputs') else: # Error out if an invalid @OUTPUTnn@ template was specified for each in command: diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index d6311fa..6284f95 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -181,8 +181,7 @@ def sanitize_permissions(path: str, umask: T.Union[str, int]) -> None: try: set_chmod(path, new_perms, follow_symlinks=False) except PermissionError as e: - msg = f'{path!r}: Unable to set permissions {new_perms!r}: {e.strerror}, ignoring...' - print(msg) + print(f'{path!r}: Unable to set permissions {new_perms!r}: {e.strerror}, ignoring...') def set_mode(path: str, mode: T.Optional['FileMode'], default_umask: T.Union[str, int]) -> None: @@ -195,15 +194,12 @@ def set_mode(path: str, mode: T.Optional['FileMode'], default_umask: T.Union[str try: set_chown(path, mode.owner, mode.group, follow_symlinks=False) except PermissionError as e: - msg = f'{path!r}: Unable to set owner {mode.owner!r} and group {mode.group!r}: {e.strerror}, ignoring...' - print(msg) + print(f'{path!r}: Unable to set owner {mode.owner!r} and group {mode.group!r}: {e.strerror}, ignoring...') except LookupError: - msg = f'{path!r}: Non-existent owner {mode.owner!r} or group {mode.group!r}: ignoring...' - print(msg) + print(f'{path!r}: Non-existent owner {mode.owner!r} or group {mode.group!r}: ignoring...') except OSError as e: if e.errno == errno.EINVAL: - msg = f'{path!r}: Non-existent numeric owner {mode.owner!r} or group {mode.group!r}: ignoring...' - print(msg) + print(f'{path!r}: Non-existent numeric owner {mode.owner!r} or group {mode.group!r}: ignoring...') else: raise # Must set permissions *after* setting owner/group otherwise the @@ -213,8 +209,7 @@ def set_mode(path: str, mode: T.Optional['FileMode'], default_umask: T.Union[str try: set_chmod(path, mode.perms, follow_symlinks=False) except PermissionError as e: - msg = '{path!r}: Unable to set permissions {mode.perms_s!r}: {e.strerror}, ignoring...' - print(msg) + print('{path!r}: Unable to set permissions {mode.perms_s!r}: {e.strerror}, ignoring...') else: sanitize_permissions(path, default_umask) diff --git a/mesonbuild/programs.py b/mesonbuild/programs.py index 79f8300..25a0642 100644 --- a/mesonbuild/programs.py +++ b/mesonbuild/programs.py @@ -106,15 +106,13 @@ class ExternalProgram(mesonlib.HoldableObject): cmd: T.List[T.Union[str, ExternalProgram]] = [self, '--version'] res = interpreter.run_command_impl(interpreter.current_node, cmd, {}, True) if res.returncode != 0: - m = f'Running {raw_cmd!r} failed' - raise mesonlib.MesonException(m) + raise mesonlib.MesonException(f'Running {raw_cmd!r} failed') output = res.stdout.strip() if not output: output = res.stderr.strip() match = re.search(r'([0-9][0-9\.]+)', output) if not match: - m = f'Could not find a version number in output of {raw_cmd!r}' - raise mesonlib.MesonException(m) + raise mesonlib.MesonException(f'Could not find a version number in output of {raw_cmd!r}') self.cached_version = match.group(1) return self.cached_version diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 24d02df..e061c9e 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -149,8 +149,7 @@ class PackageDefinition: raise WrapException(f'Missing sections in {self.basename}') self.wrap_section = config.sections()[0] if not self.wrap_section.startswith('wrap-'): - m = f'{self.wrap_section!r} is not a valid first section in {self.basename}' - raise WrapException(m) + raise WrapException(f'{self.wrap_section!r} is not a valid first section in {self.basename}') self.type = self.wrap_section[5:] self.values = dict(config[self.wrap_section]) @@ -179,8 +178,7 @@ class PackageDefinition: try: return self.values[key] except KeyError: - m = f'Missing key {key!r} in {self.basename}' - raise WrapException(m) + raise WrapException(f'Missing key {key!r} in {self.basename}') def get_directory(subdir_root: str, packagename: str) -> str: fname = os.path.join(subdir_root, packagename + '.wrap') @@ -387,8 +385,7 @@ class Resolver: elif out == '': # It is not a submodule, just a folder that exists in the main repository. return False - m = f'Unknown git submodule output: {out!r}' - raise WrapException(m) + raise WrapException(f'Unknown git submodule output: {out!r}') def get_file(self) -> None: path = self.get_file_internal('source') |