diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-19 21:05:09 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-20 00:07:00 +0200 |
commit | 9bc07a09412b6ea1ff5e558e97478941b6cbfd18 (patch) | |
tree | cde770ae4dfff10f35adcde343050393a03477f8 /mesonbuild | |
parent | b4cead2763460d11ed3a6f467618f65716021bd2 (diff) | |
download | meson-9bc07a09412b6ea1ff5e558e97478941b6cbfd18.zip meson-9bc07a09412b6ea1ff5e558e97478941b6cbfd18.tar.gz meson-9bc07a09412b6ea1ff5e558e97478941b6cbfd18.tar.bz2 |
Fix several more lint errors
Found by Igor Gnatenko
************* Module mesonbuild.interpreter
E:1232,33: No value for argument 'interp' in constructor call (no-value-for-parameter)
************* Module mesonbuild.dependencies
E: 68, 4: An attribute defined in mesonbuild.dependencies line 39 hides this method (method-hidden)
************* Module mesonbuild.environment
E: 26, 0: class already defined line 19 (function-redefined)
E: 68,18: Undefined variable 'InterpreterException' (undefined-variable)
E:641,39: Undefined variable 'want_cross' (undefined-variable)
E:850,94: Undefined variable 'varname' (undefined-variable)
E:854,94: Undefined variable 'varname' (undefined-variable)
E:860,102: Undefined variable 'varname' (undefined-variable)
E:863,94: Undefined variable 'varname' (undefined-variable)
************* Module mesonbuild.modules.gnome
E:438,26: Undefined variable 'compilers' (undefined-variable)
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers.py | 6 | ||||
-rw-r--r-- | mesonbuild/dependencies.py | 3 | ||||
-rw-r--r-- | mesonbuild/environment.py | 18 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 10 | ||||
-rw-r--r-- | mesonbuild/mesonlib.py | 4 | ||||
-rw-r--r-- | mesonbuild/modules/gnome.py | 1 |
6 files changed, 18 insertions, 24 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 54c1300..18f2791 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -18,7 +18,7 @@ import subprocess, os.path import tempfile from .import mesonlib from . import mlog -from .mesonlib import MesonException, version_compare, Popen_safe +from .mesonlib import EnvironmentException, MesonException, version_compare, Popen_safe from . import coredata """This file contains the data files of all compilers Meson knows @@ -314,10 +314,6 @@ def build_unix_rpath_args(build_dir, rpath_paths, install_rpath): paths = paths + ':' + padding return ['-Wl,-rpath,' + paths] -class EnvironmentException(MesonException): - def __init(self, *args, **kwargs): - Exception.__init__(self, *args, **kwargs) - class CrossNoRunException(MesonException): def __init(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index 7b6d4c8..da73a57 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -65,9 +65,6 @@ class Dependency(): def need_threads(self): return False - def type_name(self): - return self.type_name - def get_pkgconfig_variable(self, variable_name): raise MesonException('Tried to get a pkg-config variable from a non-pkgconfig dependency.') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 3231fa8..52f5752 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -17,16 +17,12 @@ from . import coredata from . import mesonlib from . import mlog from .compilers import * -from .mesonlib import Popen_safe +from .mesonlib import EnvironmentException, Popen_safe import configparser import shutil build_filename = 'meson.build' -class EnvironmentException(mesonlib.MesonException): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - def find_coverage_tools(): gcovr_exe = 'gcovr' lcov_exe = 'lcov' @@ -65,7 +61,7 @@ def detect_native_windows_arch(): # If this doesn't exist, something is messing with the environment arch = os.environ['PROCESSOR_ARCHITECTURE'].lower() except KeyError: - raise InterpreterException('Unable to detect native OS architecture') + raise EnvironmentException('Unable to detect native OS architecture') return arch def detect_windows_arch(compilers): @@ -629,7 +625,7 @@ class Environment(): return RustCompiler(exelist, version) raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') - def detect_d_compiler(self): + def detect_d_compiler(self, want_cross): exelist = None is_cross = False # Search for a D compiler. @@ -847,20 +843,20 @@ class CrossBuildInfo(): for entry in config[s]: value = config[s][entry] if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry: - raise EnvironmentException('Malformed variable name %s in cross file..' % varname) + raise EnvironmentException('Malformed variable name %s in cross file..' % entry) try: res = eval(value, {'true' : True, 'false' : False}) except Exception: - raise EnvironmentException('Malformed value in cross file variable %s.' % varname) + raise EnvironmentException('Malformed value in cross file variable %s.' % entry) if self.ok_type(res): self.config[s][entry] = res elif isinstance(res, list): for i in res: if not self.ok_type(i): - raise EnvironmentException('Malformed value in cross file variable %s.' % varname) + raise EnvironmentException('Malformed value in cross file variable %s.' % entry) self.config[s][entry] = res else: - raise EnvironmentException('Malformed value in cross file variable %s.' % varname) + raise EnvironmentException('Malformed value in cross file variable %s.' % entry) def has_host(self): return 'host_machine' in self.config diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index c92adaf..2bef595 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1229,7 +1229,7 @@ class Interpreter(InterpreterBase): outvalues.append(v) elif isinstance(v, build.Executable): self.add_target(v.name, v) - outvalues.append(ExecutableHolder(v)) + outvalues.append(ExecutableHolder(v, self)) elif isinstance(v, list): outvalues.append(self.module_method_callback(v)) elif isinstance(v, build.GeneratedList): @@ -1572,15 +1572,15 @@ class Interpreter(InterpreterBase): elif lang == 'vala': comp = self.environment.detect_vala_compiler() if need_cross_compiler: - cross_comp = comp # Vala is too (I think). + cross_comp = comp # Vala compiles to platform-independent C elif lang == 'd': - comp = self.environment.detect_d_compiler() + comp = self.environment.detect_d_compiler(False) if need_cross_compiler: - cross_comp = comp # D as well (AFAIK). + cross_comp = self.environment.detect_d_compiler(True) elif lang == 'rust': comp = self.environment.detect_rust_compiler() if need_cross_compiler: - cross_comp = comp # FIXME, probably not correct. + cross_comp = comp # FIXME, not correct. elif lang == 'fortran': comp = self.environment.detect_fortran_compiler(False) if need_cross_compiler: diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 622cd04..551bda2 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -22,6 +22,10 @@ class MesonException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) +class EnvironmentException(MesonException): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + class File: def __init__(self, is_built, subdir, fname): self.is_built = is_built diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 3a991e9..dd4d409 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -24,6 +24,7 @@ from ..mesonlib import MesonException, Popen_safe from ..dependencies import Dependency, PkgConfigDependency, InternalDependency from .. import mlog from .. import mesonlib +from .. import compilers from .. import interpreter from . import find_program, GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, VapiTarget |