aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2023-09-07 14:46:11 -0400
committerEli Schwartz <eschwartz93@gmail.com>2023-09-07 23:38:33 -0400
commit204fe3c5772f3f6ec9583fb9216412a4eb6018b9 (patch)
tree7a5d1ce1e839f0da2001b56442edf4a8d0ab03d3 /mesonbuild
parent983562c66e9ee28ce4204d69811cd870e2e1960f (diff)
downloadmeson-204fe3c5772f3f6ec9583fb9216412a4eb6018b9.zip
meson-204fe3c5772f3f6ec9583fb9216412a4eb6018b9.tar.gz
meson-204fe3c5772f3f6ec9583fb9216412a4eb6018b9.tar.bz2
Fix include_directories test for relative path
- On Windows, it was not detected if include directory was an absolute path to source directory, because of the mis of path separators. - In the edgecase the include directory begins with the exact same string as the source directory, but is a different directory, it was falsely reported as an error. Fixes #12217.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreter.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 5657b20..d9a260c 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -25,7 +25,7 @@ from ..wrap import wrap, WrapMode
from .. import mesonlib
from ..mesonlib import (EnvironmentVariables, ExecutableSerialisation, MesonBugException, MesonException, HoldableObject,
FileMode, MachineChoice, OptionKey, listify,
- extract_as_list, has_path_sep, PerMachine)
+ extract_as_list, has_path_sep, path_is_in_root, PerMachine)
from ..programs import ExternalProgram, NonExistingExternalProgram
from ..dependencies import Dependency
from ..depfile import DepFile
@@ -551,7 +551,7 @@ class Interpreter(InterpreterBase, HoldableObject):
if f.is_built:
return
f = os.path.normpath(f.relative_name())
- elif os.path.isfile(f) and not f.startswith('/dev'):
+ elif os.path.isfile(f) and not f.startswith('/dev/'):
srcdir = Path(self.environment.get_source_dir())
builddir = Path(self.environment.get_build_dir())
try:
@@ -2773,7 +2773,7 @@ class Interpreter(InterpreterBase, HoldableObject):
absbase_build = os.path.join(build_root, self.subdir)
for a in incdir_strings:
- if a.startswith(src_root):
+ if path_is_in_root(Path(a), Path(src_root)):
raise InvalidArguments(textwrap.dedent('''\
Tried to form an absolute path to a dir in the source tree.
You should not do that but use relative paths instead, for