Skip to content

Commit 9bc07a0

Browse files
nirbheekjpakkane
authored andcommitted
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)
1 parent b4cead2 commit 9bc07a0

File tree

6 files changed

+18
-24
lines changed

6 files changed

+18
-24
lines changed

mesonbuild/compilers.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import tempfile
1919
from .import mesonlib
2020
from . import mlog
21-
from .mesonlib import MesonException, version_compare, Popen_safe
21+
from .mesonlib import EnvironmentException, MesonException, version_compare, Popen_safe
2222
from . import coredata
2323

2424
"""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):
314314
paths = paths + ':' + padding
315315
return ['-Wl,-rpath,' + paths]
316316

317-
class EnvironmentException(MesonException):
318-
def __init(self, *args, **kwargs):
319-
Exception.__init__(self, *args, **kwargs)
320-
321317
class CrossNoRunException(MesonException):
322318
def __init(self, *args, **kwargs):
323319
Exception.__init__(self, *args, **kwargs)

mesonbuild/dependencies.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ def get_exe_args(self):
6565
def need_threads(self):
6666
return False
6767

68-
def type_name(self):
69-
return self.type_name
70-
7168
def get_pkgconfig_variable(self, variable_name):
7269
raise MesonException('Tried to get a pkg-config variable from a non-pkgconfig dependency.')
7370

mesonbuild/environment.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@
1717
from . import mesonlib
1818
from . import mlog
1919
from .compilers import *
20-
from .mesonlib import Popen_safe
20+
from .mesonlib import EnvironmentException, Popen_safe
2121
import configparser
2222
import shutil
2323

2424
build_filename = 'meson.build'
2525

26-
class EnvironmentException(mesonlib.MesonException):
27-
def __init__(self, *args, **kwargs):
28-
super().__init__(*args, **kwargs)
29-
3026
def find_coverage_tools():
3127
gcovr_exe = 'gcovr'
3228
lcov_exe = 'lcov'
@@ -65,7 +61,7 @@ def detect_native_windows_arch():
6561
# If this doesn't exist, something is messing with the environment
6662
arch = os.environ['PROCESSOR_ARCHITECTURE'].lower()
6763
except KeyError:
68-
raise InterpreterException('Unable to detect native OS architecture')
64+
raise EnvironmentException('Unable to detect native OS architecture')
6965
return arch
7066

7167
def detect_windows_arch(compilers):
@@ -629,7 +625,7 @@ def detect_rust_compiler(self):
629625
return RustCompiler(exelist, version)
630626
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
631627

632-
def detect_d_compiler(self):
628+
def detect_d_compiler(self, want_cross):
633629
exelist = None
634630
is_cross = False
635631
# Search for a D compiler.
@@ -847,20 +843,20 @@ def parse_datafile(self, filename):
847843
for entry in config[s]:
848844
value = config[s][entry]
849845
if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry:
850-
raise EnvironmentException('Malformed variable name %s in cross file..' % varname)
846+
raise EnvironmentException('Malformed variable name %s in cross file..' % entry)
851847
try:
852848
res = eval(value, {'true' : True, 'false' : False})
853849
except Exception:
854-
raise EnvironmentException('Malformed value in cross file variable %s.' % varname)
850+
raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
855851
if self.ok_type(res):
856852
self.config[s][entry] = res
857853
elif isinstance(res, list):
858854
for i in res:
859855
if not self.ok_type(i):
860-
raise EnvironmentException('Malformed value in cross file variable %s.' % varname)
856+
raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
861857
self.config[s][entry] = res
862858
else:
863-
raise EnvironmentException('Malformed value in cross file variable %s.' % varname)
859+
raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
864860

865861
def has_host(self):
866862
return 'host_machine' in self.config

mesonbuild/interpreter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ def module_method_callback(self, invalues):
12291229
outvalues.append(v)
12301230
elif isinstance(v, build.Executable):
12311231
self.add_target(v.name, v)
1232-
outvalues.append(ExecutableHolder(v))
1232+
outvalues.append(ExecutableHolder(v, self))
12331233
elif isinstance(v, list):
12341234
outvalues.append(self.module_method_callback(v))
12351235
elif isinstance(v, build.GeneratedList):
@@ -1572,15 +1572,15 @@ def detect_compilers(self, lang, need_cross_compiler):
15721572
elif lang == 'vala':
15731573
comp = self.environment.detect_vala_compiler()
15741574
if need_cross_compiler:
1575-
cross_comp = comp # Vala is too (I think).
1575+
cross_comp = comp # Vala compiles to platform-independent C
15761576
elif lang == 'd':
1577-
comp = self.environment.detect_d_compiler()
1577+
comp = self.environment.detect_d_compiler(False)
15781578
if need_cross_compiler:
1579-
cross_comp = comp # D as well (AFAIK).
1579+
cross_comp = self.environment.detect_d_compiler(True)
15801580
elif lang == 'rust':
15811581
comp = self.environment.detect_rust_compiler()
15821582
if need_cross_compiler:
1583-
cross_comp = comp # FIXME, probably not correct.
1583+
cross_comp = comp # FIXME, not correct.
15841584
elif lang == 'fortran':
15851585
comp = self.environment.detect_fortran_compiler(False)
15861586
if need_cross_compiler:

mesonbuild/mesonlib.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class MesonException(Exception):
2222
def __init__(self, *args, **kwargs):
2323
Exception.__init__(self, *args, **kwargs)
2424

25+
class EnvironmentException(MesonException):
26+
def __init__(self, *args, **kwargs):
27+
super().__init__(*args, **kwargs)
28+
2529
class File:
2630
def __init__(self, is_built, subdir, fname):
2731
self.is_built = is_built

mesonbuild/modules/gnome.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from ..dependencies import Dependency, PkgConfigDependency, InternalDependency
2525
from .. import mlog
2626
from .. import mesonlib
27+
from .. import compilers
2728
from .. import interpreter
2829
from . import find_program, GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, VapiTarget
2930

0 commit comments

Comments
 (0)