aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorMichael <michaelbrockus@gmail.com>2020-04-18 23:11:16 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2020-04-21 00:16:21 +0300
commitc53b6379597be5961b4e69e7f187608452874e4c (patch)
treeeade9c7e52c6940a236f595a728a638ad008f9cf /mesonbuild
parent182f40d25add336531b4127e410af8bcbe067575 (diff)
downloadmeson-c53b6379597be5961b4e69e7f187608452874e4c.zip
meson-c53b6379597be5961b4e69e7f187608452874e4c.tar.gz
meson-c53b6379597be5961b4e69e7f187608452874e4c.tar.bz2
switch python2 %s for python3 .format
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/envconfig.py10
-rw-r--r--mesonbuild/environment.py8
-rw-r--r--mesonbuild/linkers.py12
-rw-r--r--mesonbuild/mesonmain.py2
-rw-r--r--mesonbuild/mlog.py2
-rw-r--r--mesonbuild/modules/sourceset.py2
6 files changed, 18 insertions, 18 deletions
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index 339f980..25b3c7f 100644
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -93,15 +93,15 @@ class MesonConfigFile:
# Windows paths...
value = value.replace('\\', '\\\\')
if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry:
- raise EnvironmentException('Malformed variable name %s in cross file..' % entry)
+ raise EnvironmentException('Malformed variable name {} in cross file..'.format(entry))
try:
res = eval(value, {'__builtins__': None}, {'true': True, 'false': False})
except Exception:
- raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
+ raise EnvironmentException('Malformed value in cross file variable {}.'.format(entry))
for i in (res if isinstance(res, list) else [res]):
if not isinstance(i, (str, int, bool)):
- raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
+ raise EnvironmentException('Malformed value in cross file variable {}.'.format(entry))
section[entry] = res
@@ -224,11 +224,11 @@ class MachineInfo:
cpu_family = literal['cpu_family']
if cpu_family not in known_cpu_families:
- mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % cpu_family)
+ mlog.warning('Unknown CPU family {}, please report this at https://github.com/mesonbuild/meson/issues/new'.format(cpu_family))
endian = literal['endian']
if endian not in ('little', 'big'):
- mlog.warning('Unknown endian %s' % endian)
+ mlog.warning('Unknown endian {}'.format(endian))
return cls(literal['system'], cpu_family, literal['cpu'], endian)
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index c571141..64efda6 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -1360,7 +1360,7 @@ class Environment:
try:
p, out, err = Popen_safe(exelist + ['-version'])
except OSError:
- raise EnvironmentException('Could not execute Java compiler "%s"' % ' '.join(exelist))
+ raise EnvironmentException('Could not execute Java compiler "{}"'.format(' '.join(exelist)))
if 'javac' in out or 'javac' in err:
version = search_version(err if 'javac' in err else out)
if not version or version == 'unknown version':
@@ -1408,7 +1408,7 @@ class Environment:
try:
p, out = Popen_safe(exelist + ['--version'])[0:2]
except OSError:
- raise EnvironmentException('Could not execute Vala compiler "%s"' % ' '.join(exelist))
+ raise EnvironmentException('Could not execute Vala compiler "{}"'.format(' '.join(exelist)))
version = search_version(out)
if 'Vala' in out:
comp_class = ValaCompiler
@@ -1610,7 +1610,7 @@ class Environment:
try:
p, _, err = Popen_safe(exelist + ['-v'])
except OSError:
- raise EnvironmentException('Could not execute Swift compiler "%s"' % ' '.join(exelist))
+ raise EnvironmentException('Could not execute Swift compiler "{}"'.format(' '.join(exelist)))
version = search_version(err)
if 'Swift' in err:
# As for 5.0.1 swiftc *requires* a file to check the linker:
@@ -1730,7 +1730,7 @@ class Environment:
if p.returncode == 1 and err.startswith('ar: bad option: --'): # Solaris
return ArLinker(linker)
self._handle_exceptions(popen_exceptions, linkers, 'linker')
- raise EnvironmentException('Unknown static linker "%s"' % ' '.join(linkers))
+ raise EnvironmentException('Unknown static linker "{}"'.format(' '.join(linkers)))
def get_source_dir(self):
return self.source_dir
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index fa898d0..44c720f 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -201,7 +201,7 @@ class CcrxLinker(StaticLinker):
return False
def get_output_args(self, target: str) -> T.List[str]:
- return ['-output=%s' % target]
+ return ['-output={}'.format(target)]
def get_linker_always_args(self) -> T.List[str]:
return ['-nologo', '-form=library']
@@ -217,7 +217,7 @@ class Xc16Linker(StaticLinker):
return False
def get_output_args(self, target: str) -> T.List[str]:
- return ['%s' % target]
+ return ['{}'.format(target)]
def get_linker_always_args(self) -> T.List[str]:
return ['rcs']
@@ -233,7 +233,7 @@ class C2000Linker(StaticLinker):
return False
def get_output_args(self, target: str) -> T.List[str]:
- return ['%s' % target]
+ return ['{}'.format(target)]
def get_linker_always_args(self) -> T.List[str]:
return ['-r']
@@ -781,7 +781,7 @@ class CcrxDynamicLinker(DynamicLinker):
return []
def get_output_args(self, outputname: str) -> T.List[str]:
- return ['-output=%s' % outputname]
+ return ['-output={}'.format(outputname)]
def get_search_args(self, dirname: str) -> 'T.NoReturn':
raise EnvironmentError('rlink.exe does not have a search dir argument')
@@ -819,7 +819,7 @@ class Xc16DynamicLinker(DynamicLinker):
return []
def get_output_args(self, outputname: str) -> T.List[str]:
- return ['-o%s' % outputname]
+ return ['-o{}'.format(outputname)]
def get_search_args(self, dirname: str) -> 'T.NoReturn':
raise EnvironmentError('xc16-gcc.exe does not have a search dir argument')
@@ -862,7 +862,7 @@ class C2000DynamicLinker(DynamicLinker):
return []
def get_output_args(self, outputname: str) -> T.List[str]:
- return ['-z', '--output_file=%s' % outputname]
+ return ['-z', '--output_file={}'.format(outputname)]
def get_search_args(self, dirname: str) -> 'T.NoReturn':
raise EnvironmentError('cl2000.exe does not have a search dir argument')
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index b6b11df..fc9d6a6 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -182,7 +182,7 @@ def ensure_stdout_accepts_unicode():
def run(original_args, mainfile):
if sys.version_info < (3, 5):
print('Meson works correctly only with python 3.5+.')
- print('You have python %s.' % sys.version)
+ print('You have python {}.'.format(sys.version))
print('Please update your environment')
return 1
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index a5fb320..8cbd248 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -302,7 +302,7 @@ def exception(e: Exception, prefix: T.Optional[AnsiDecorator] = None) -> None:
# Mypy doesn't follow hasattr, and it's pretty easy to visually inspect
# that this is correct, so we'll just ignore it.
path = get_relative_path(Path(e.file), Path(os.getcwd())) # type: ignore
- args.append('%s:%d:%d:' % (path, e.lineno, e.colno)) # type: ignore
+ args.append('{}:{}:{}:'.format(path, e.lineno, e.colno)) # type: ignore
if prefix:
args.append(prefix)
args.append(str(e))
diff --git a/mesonbuild/modules/sourceset.py b/mesonbuild/modules/sourceset.py
index a14bd70..e23e12e 100644
--- a/mesonbuild/modules/sourceset.py
+++ b/mesonbuild/modules/sourceset.py
@@ -150,7 +150,7 @@ class SourceSetHolder(MutableInterpreterObject, ObjectHolder):
if isinstance(config_data, dict):
def _get_from_config_data(key):
if strict and key not in config_data:
- raise InterpreterException('Entry %s not in configuration dictionary.' % key)
+ raise InterpreterException('Entry {} not in configuration dictionary.'.format(key))
return config_data.get(key, False)
else:
config_cache = dict()