diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:16:11 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:16:11 -0500 |
commit | 6a0fabc6472f49621260de215f128a31ae70219b (patch) | |
tree | 6a67908358a2c5e5baa215fe0201dfe213dd8a01 /mesonbuild/modules/cmake.py | |
parent | 4340bf34faca7eed8076ba4c388fbe15355f2183 (diff) | |
download | meson-6a0fabc6472f49621260de215f128a31ae70219b.zip meson-6a0fabc6472f49621260de215f128a31ae70219b.tar.gz meson-6a0fabc6472f49621260de215f128a31ae70219b.tar.bz2 |
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
Diffstat (limited to 'mesonbuild/modules/cmake.py')
-rw-r--r-- | mesonbuild/modules/cmake.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py index 18dc2f5..fd92ecf 100644 --- a/mesonbuild/modules/cmake.py +++ b/mesonbuild/modules/cmake.py @@ -92,7 +92,7 @@ class CMakeSubprojectHolder(InterpreterObject, ObjectHolder): tgt = args[0] res = self.held_object.cm_interpreter.target_info(tgt) if res is None: - raise InterpreterException('The CMake target {} does not exist\n'.format(tgt) + + raise InterpreterException(f'The CMake target {tgt} does not exist\n' + ' Use the following command in your meson.build to list all available targets:\n\n' + ' message(\'CMaket targets:\\n - \' + \'\\n - \'.join(<cmake_subproject>.target_list()))') @@ -235,7 +235,7 @@ class CmakeModule(ExtensionModule): cmakebin = dependencies.ExternalProgram('cmake', silent=False) p, stdout, stderr = mesonlib.Popen_safe(cmakebin.get_command() + ['--system-information', '-G', 'Ninja'])[0:3] if p.returncode != 0: - mlog.log('error retrieving cmake information: returnCode={} stdout={} stderr={}'.format(p.returncode, stdout, stderr)) + mlog.log(f'error retrieving cmake information: returnCode={p.returncode} stdout={stdout} stderr={stderr}') return False match = re.search('\nCMAKE_ROOT \\"([^"]+)"\n', stdout.strip()) @@ -273,11 +273,11 @@ class CmakeModule(ExtensionModule): if not isinstance(pkgroot, str): raise mesonlib.MesonException('Install_dir must be a string.') - template_file = os.path.join(self.cmake_root, 'Modules', 'BasicConfigVersion-{}.cmake.in'.format(compatibility)) + template_file = os.path.join(self.cmake_root, 'Modules', f'BasicConfigVersion-{compatibility}.cmake.in') if not os.path.exists(template_file): - raise mesonlib.MesonException('your cmake installation doesn\'t support the {} compatibility'.format(compatibility)) + raise mesonlib.MesonException(f'your cmake installation doesn\'t support the {compatibility} compatibility') - version_file = os.path.join(state.environment.scratch_dir, '{}ConfigVersion.cmake'.format(name)) + version_file = os.path.join(state.environment.scratch_dir, f'{name}ConfigVersion.cmake') conf = { 'CVF_VERSION': (version, ''), @@ -298,7 +298,7 @@ class CmakeModule(ExtensionModule): with open(infile) as fin: data = fin.readlines() except Exception as e: - raise mesonlib.MesonException('Could not read input file %s: %s' % (infile, str(e))) + raise mesonlib.MesonException('Could not read input file {}: {}'.format(infile, str(e))) result = [] regex = re.compile(r'(?:\\\\)+(?=\\?@)|\\@|@([-a-zA-Z0-9_]+)@') @@ -339,7 +339,7 @@ class CmakeModule(ExtensionModule): raise mesonlib.MesonException('"name" not specified.') name = kwargs['name'] - (ofile_path, ofile_fname) = os.path.split(os.path.join(state.subdir, '{}Config.cmake'.format(name))) + (ofile_path, ofile_fname) = os.path.split(os.path.join(state.subdir, f'{name}Config.cmake')) ofile_abs = os.path.join(state.environment.build_dir, ofile_path, ofile_fname) install_dir = kwargs.get('install_dir', os.path.join(state.environment.coredata.get_option(mesonlib.OptionKey('libdir')), 'cmake', name)) |