diff options
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 18 | ||||
-rw-r--r-- | mesonbuild/compilers/cuda.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/d.py | 24 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/clike.py | 6 |
4 files changed, 26 insertions, 26 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index a37e4da..56c97f4 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -762,7 +762,7 @@ class Compiler(metaclass=abc.ABCMeta): contents = code elif isinstance(code, mesonlib.File): srcname = code.fname - with open(code.fname, 'r') as f: + with open(code.fname) as f: contents = f.read() # Construct the compiler command-line @@ -1009,16 +1009,16 @@ class Compiler(metaclass=abc.ABCMeta): return [] def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]: - raise EnvironmentError('This compiler does not support Windows CRT selection') + raise OSError('This compiler does not support Windows CRT selection') def get_crt_link_args(self, crt_val: str, buildtype: str) -> T.List[str]: - raise EnvironmentError('This compiler does not support Windows CRT selection') + raise OSError('This compiler does not support Windows CRT selection') def get_compile_only_args(self) -> T.List[str]: return [] def get_preprocess_only_args(self) -> T.List[str]: - raise EnvironmentError('This compiler does not have a preprocessor') + raise OSError('This compiler does not have a preprocessor') def get_default_include_dirs(self) -> T.List[str]: return [] @@ -1095,7 +1095,7 @@ class Compiler(metaclass=abc.ABCMeta): return objfile + '.' + self.get_depfile_suffix() def get_depfile_suffix(self) -> str: - raise EnvironmentError('{} does not implement get_depfile_suffix'.format(self.id)) + raise OSError('{} does not implement get_depfile_suffix'.format(self.id)) def get_no_stdinc_args(self) -> T.List[str]: """Arguments to turn off default inclusion of standard libraries.""" @@ -1112,13 +1112,13 @@ class Compiler(metaclass=abc.ABCMeta): pass def get_module_incdir_args(self) -> T.Tuple[str, ...]: - raise EnvironmentError('{} does not implement get_module_incdir_args'.format(self.id)) + raise OSError('{} does not implement get_module_incdir_args'.format(self.id)) def get_module_outdir_args(self, path: str) -> T.List[str]: - raise EnvironmentError('{} does not implement get_module_outdir_args'.format(self.id)) + raise OSError('{} does not implement get_module_outdir_args'.format(self.id)) def module_name_to_filename(self, module_name: str) -> str: - raise EnvironmentError('{} does not implement module_name_to_filename'.format(self.id)) + raise OSError('{} does not implement module_name_to_filename'.format(self.id)) def get_compiler_check_args(self, mode: CompileCheckMode) -> T.List[str]: """Arguments to pass the compiler and/or linker for checks. @@ -1212,7 +1212,7 @@ class Compiler(metaclass=abc.ABCMeta): def get_feature_args(self, kwargs: T.Dict[str, T.Any], build_to_src: str) -> T.List[str]: """Used by D for extra language features.""" # TODO: using a TypeDict here would improve this - raise EnvironmentError('{} does not implement get_feature_args'.format(self.id)) + raise OSError('{} does not implement get_feature_args'.format(self.id)) def get_prelink_args(self, prelink_name: str, obj_list: T.List[str]) -> T.List[str]: raise EnvironmentException('{} does not know how to do prelinking.'.format(self.id)) diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 733e362..a55975a 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -514,7 +514,7 @@ class CudaCompiler(Compiler): mlog.debug(stde) mlog.debug('-----') if pc.returncode != 0: - raise EnvironmentException('Compiler {0} can not compile programs.'.format(self.name_string())) + raise EnvironmentException('Compiler {} can not compile programs.'.format(self.name_string())) # Run sanity check (if possible) if self.is_cross: @@ -533,7 +533,7 @@ class CudaCompiler(Compiler): mlog.debug('-----') pe.wait() if pe.returncode != 0: - raise EnvironmentException('Executables created by {0} compiler {1} are not runnable.'.format(self.language, self.name_string())) + raise EnvironmentException('Executables created by {} compiler {} are not runnable.'.format(self.language, self.name_string())) # Interpret the result of the sanity test. # As mentioned above, it is not only a sanity test but also a GPU diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index ef261fd..b16aca8 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -183,10 +183,10 @@ class DmdLikeCompilerMixin(CompilerMixinBase): if int(d) > debug_level: debug_level = int(d) else: - res.append('{0}={1}'.format(debug_arg, d)) + res.append('{}={}'.format(debug_arg, d)) if debug_level >= 0: - res.append('{0}={1}'.format(debug_arg, debug_level)) + res.append('{}={}'.format(debug_arg, debug_level)) if 'versions' in kwargs: version_level = -1 @@ -207,10 +207,10 @@ class DmdLikeCompilerMixin(CompilerMixinBase): if int(v) > version_level: version_level = int(v) else: - res.append('{0}={1}'.format(version_arg, v)) + res.append('{}={}'.format(version_arg, v)) if version_level >= 0: - res.append('{0}={1}'.format(version_arg, version_level)) + res.append('{}={}'.format(version_arg, version_level)) if 'import_dirs' in kwargs: import_dirs = kwargs.pop('import_dirs') @@ -230,8 +230,8 @@ class DmdLikeCompilerMixin(CompilerMixinBase): else: expdir = basedir srctreedir = os.path.join(build_to_src, expdir) - res.append('{0}{1}'.format(import_dir_arg, srctreedir)) - res.append('{0}{1}'.format(import_dir_arg, bldtreedir)) + res.append('{}{}'.format(import_dir_arg, srctreedir)) + res.append('{}{}'.format(import_dir_arg, bldtreedir)) if kwargs: raise EnvironmentException('Unknown D compiler feature(s) selected: %s' % ', '.join(kwargs.keys())) @@ -560,10 +560,10 @@ class DCompiler(Compiler): if int(d) > debug_level: debug_level = int(d) else: - res.append('{0}={1}'.format(debug_arg, d)) + res.append('{}={}'.format(debug_arg, d)) if debug_level >= 0: - res.append('{0}={1}'.format(debug_arg, debug_level)) + res.append('{}={}'.format(debug_arg, debug_level)) if 'versions' in kwargs: version_level = -1 @@ -584,10 +584,10 @@ class DCompiler(Compiler): if int(v) > version_level: version_level = int(v) else: - res.append('{0}={1}'.format(version_arg, v)) + res.append('{}={}'.format(version_arg, v)) if version_level >= 0: - res.append('{0}={1}'.format(version_arg, version_level)) + res.append('{}={}'.format(version_arg, version_level)) if 'import_dirs' in kwargs: import_dirs = kwargs.pop('import_dirs') @@ -607,8 +607,8 @@ class DCompiler(Compiler): else: expdir = basedir srctreedir = os.path.join(build_to_src, expdir) - res.append('{0}{1}'.format(import_dir_arg, srctreedir)) - res.append('{0}{1}'.format(import_dir_arg, bldtreedir)) + res.append('{}{}'.format(import_dir_arg, srctreedir)) + res.append('{}{}'.format(import_dir_arg, bldtreedir)) if kwargs: raise EnvironmentException('Unknown D compiler feature(s) selected: %s' % ', '.join(kwargs.keys())) diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index ad3bfae..ad0e257 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -321,7 +321,7 @@ class CLikeCompiler(Compiler): mlog.debug(stde) mlog.debug('-----') if pc.returncode != 0: - raise mesonlib.EnvironmentException('Compiler {0} can not compile programs.'.format(self.name_string())) + raise mesonlib.EnvironmentException('Compiler {} can not compile programs.'.format(self.name_string())) # Run sanity check if self.is_cross: if self.exe_wrapper is None: @@ -337,7 +337,7 @@ class CLikeCompiler(Compiler): raise mesonlib.EnvironmentException('Could not invoke sanity test executable: %s.' % str(e)) pe.wait() if pe.returncode != 0: - raise mesonlib.EnvironmentException('Executables created by {0} compiler {1} are not runnable.'.format(self.language, self.name_string())) + raise mesonlib.EnvironmentException('Executables created by {} compiler {} are not runnable.'.format(self.language, self.name_string())) def sanity_check(self, work_dir: str, environment: 'Environment') -> None: code = 'int main(void) { int class=0; return class; }\n' @@ -810,7 +810,7 @@ class CLikeCompiler(Compiler): if val is not None: if isinstance(val, bool): return val, False - raise mesonlib.EnvironmentException('Cross variable {0} is not a boolean.'.format(varname)) + raise mesonlib.EnvironmentException('Cross variable {} is not a boolean.'.format(varname)) # TODO: we really need a protocol for this, # |