aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/interpreter.py10
-rw-r--r--mesonbuild/modules/gnome.py16
-rw-r--r--mesonbuild/mparser.py19
-rw-r--r--test cases/linuxlike/11 runpath rpath ldlibrarypath/meson.build2
4 files changed, 30 insertions, 17 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 649b842..ed08987 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2375,7 +2375,10 @@ class Interpreter(InterpreterBase):
@stringArgs
def func_include_directories(self, node, args, kwargs):
src_root = self.environment.get_source_dir()
- absbase = os.path.join(src_root, self.subdir)
+ build_root = self.environment.get_build_dir()
+ absbase_src = os.path.join(src_root, self.subdir)
+ absbase_build = os.path.join(build_root, self.subdir)
+
for a in args:
if a.startswith(src_root):
raise InvalidArguments('''Tried to form an absolute path to a source dir. You should not do that but use
@@ -2395,8 +2398,9 @@ put in the include directories by default so you only need to do
include_directories('.') if you intend to use the result in a
different subdirectory.
''')
- absdir = os.path.join(absbase, a)
- if not os.path.isdir(absdir):
+ absdir_src = os.path.join(absbase_src, a)
+ absdir_build = os.path.join(absbase_build, a)
+ if not os.path.isdir(absdir_src) and not os.path.isdir(absdir_build):
raise InvalidArguments('Include dir %s does not exist.' % a)
is_system = kwargs.get('is_system', False)
if not isinstance(is_system, bool):
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 6921472..b4dfd12 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -253,6 +253,8 @@ class GnomeModule(ExtensionModule):
missing_basename = os.path.basename(missing)
for dep in dependencies:
+ if hasattr(dep, 'held_object'):
+ dep = dep.held_object
if isinstance(dep, mesonlib.File):
if dep.fname == missing_basename:
found = True
@@ -260,18 +262,20 @@ class GnomeModule(ExtensionModule):
dep_files.append(dep)
subdirs.append(dep.subdir)
break
- elif isinstance(dep, interpreter.CustomTargetHolder):
- if dep.held_object.get_basename() == missing_basename:
+ elif isinstance(dep, build.CustomTarget):
+ if dep.get_basename() == missing_basename:
found = True
dep_files.remove(missing)
dep_files.append(
mesonlib.File(
is_built=True,
- subdir=dep.held_object.get_subdir(),
- fname=dep.held_object.get_basename()))
- depends.append(dep.held_object)
- subdirs.append(dep.held_object.get_subdir())
+ subdir=dep.get_subdir(),
+ fname=dep.get_basename()))
+ depends.append(dep)
+ subdirs.append(dep.get_subdir())
break
+ else:
+ raise RuntimeError('Unreachable code.')
if not found:
raise MesonException(
diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py
index de0f12c..75985c3 100644
--- a/mesonbuild/mparser.py
+++ b/mesonbuild/mparser.py
@@ -420,6 +420,9 @@ class Parser:
except StopIteration:
self.current = Token('eof', '', self.current.line_start, self.current.lineno, self.current.colno + self.current.bytespan[1] - self.current.bytespan[0], (0, 0), None)
+ def getline(self):
+ return self.lexer.getline(self.current.line_start)
+
def accept(self, s):
if self.current.tid == s:
self.getsym()
@@ -429,12 +432,12 @@ class Parser:
def expect(self, s):
if self.accept(s):
return True
- raise ParseException('Expecting %s got %s.' % (s, self.current.tid), self.lexer.getline(self.current.line_start), self.current.lineno, self.current.colno)
+ raise ParseException('Expecting %s got %s.' % (s, self.current.tid), self.getline(), self.current.lineno, self.current.colno)
def block_expect(self, s, block_start):
if self.accept(s):
return True
- raise BlockParseException('Expecting %s got %s.' % (s, self.current.tid), self.lexer.getline(self.current.line_start), self.current.lineno, self.current.colno, self.lexer.getline(block_start.line_start), block_start.lineno, block_start.colno)
+ raise BlockParseException('Expecting %s got %s.' % (s, self.current.tid), self.getline(), self.current.lineno, self.current.colno, self.lexer.getline(block_start.line_start), block_start.lineno, block_start.colno)
def parse(self):
block = self.codeblock()
@@ -449,18 +452,18 @@ class Parser:
if self.accept('plusassign'):
value = self.e1()
if not isinstance(left, IdNode):
- raise ParseException('Plusassignment target must be an id.', left.lineno, left.colno)
+ raise ParseException('Plusassignment target must be an id.', self.getline(), left.lineno, left.colno)
return PlusAssignmentNode(left.lineno, left.colno, left.value, value)
elif self.accept('assign'):
value = self.e1()
if not isinstance(left, IdNode):
raise ParseException('Assignment target must be an id.',
- left.lineno, left.colno)
+ self.getline(), left.lineno, left.colno)
return AssignmentNode(left.lineno, left.colno, left.value, value)
elif self.accept('questionmark'):
if self.in_ternary:
raise ParseException('Nested ternary operators are not allowed.',
- left.lineno, left.colno)
+ self.getline(), left.lineno, left.colno)
self.in_ternary = True
trueblock = self.e1()
self.expect('colon')
@@ -536,7 +539,7 @@ class Parser:
self.block_expect('rparen', block_start)
if not isinstance(left, IdNode):
raise ParseException('Function call must be applied to plain id',
- left.lineno, left.colno)
+ self.getline(), left.lineno, left.colno)
left = FunctionNode(left.subdir, left.lineno, left.colno, left.value, args)
go_again = True
while go_again:
@@ -588,7 +591,7 @@ class Parser:
elif self.accept('colon'):
if not isinstance(s, IdNode):
raise ParseException('Keyword argument must be a plain identifier.',
- s.lineno, s.colno)
+ self.getline(), s.lineno, s.colno)
a.set_kwarg(s.value, self.statement())
potential = self.current
if not self.accept('comma'):
@@ -604,7 +607,7 @@ class Parser:
methodname = self.e9()
if not(isinstance(methodname, IdNode)):
raise ParseException('Method name must be plain id',
- self.current.lineno, self.current.colno)
+ self.getline(), self.current.lineno, self.current.colno)
self.expect('lparen')
args = self.args()
self.expect('rparen')
diff --git a/test cases/linuxlike/11 runpath rpath ldlibrarypath/meson.build b/test cases/linuxlike/11 runpath rpath ldlibrarypath/meson.build
index b49da66..a3103ac 100644
--- a/test cases/linuxlike/11 runpath rpath ldlibrarypath/meson.build
+++ b/test cases/linuxlike/11 runpath rpath ldlibrarypath/meson.build
@@ -1,5 +1,7 @@
project('runpath rpath ldlibrarypath', 'c')
+error('MESON_SKIP_TEST test disabled due to bug #1635.')
+
libsrc = files('lib.c')
subdir('lib1')