aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2016-07-19 22:40:57 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2016-07-19 20:10:57 +0300
commit88aafd363e3b63184b42d66b9307ec701670b529 (patch)
tree0ce768f1b7a5f7c7c21874edfeb4944f3bfa65e6 /mesonbuild
parent69d9c2228d718a627fdb3f8504cbc4cdff0b1f4c (diff)
downloadmeson-88aafd363e3b63184b42d66b9307ec701670b529.zip
meson-88aafd363e3b63184b42d66b9307ec701670b529.tar.gz
meson-88aafd363e3b63184b42d66b9307ec701670b529.tar.bz2
Normalize the path of a configured file to avoid dupes (#640)
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/environment.py8
-rw-r--r--mesonbuild/interpreter.py4
3 files changed, 9 insertions, 5 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index c2ccc6c..ab5bc49 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1821,7 +1821,7 @@ rule FORTRAN_DEP_HACK
ninja_command = environment.detect_ninja()
if ninja_command is None:
- raise MesonException('Could not detect ninja command')
+ raise MesonException('Could not detect Ninja v1.6 or newer)')
elem = NinjaBuildElement(self.all_outputs, 'clean', 'CUSTOM_COMMAND', 'PHONY')
elem.add_item('COMMAND', [ninja_command, '-t', 'clean'])
elem.add_item('description', 'Cleaning')
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index b9552a9..98ce933 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -45,11 +45,13 @@ def find_valgrind():
def detect_ninja():
for n in ['ninja', 'ninja-build']:
try:
- p = subprocess.Popen([n, '--version'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ p = subprocess.Popen([n, '--version'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
except FileNotFoundError:
continue
- p.communicate()
- if p.returncode == 0:
+ version = p.communicate()[0].decode(errors='ignore')
+ # Perhaps we should add a way for the caller to know the failure mode
+ # (not found or too old)
+ if p.returncode == 0 and mesonlib.version_compare(version, ">=1.6"):
return n
def detect_cpu_family():
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 2fd835f..51c40c9 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1993,7 +1993,9 @@ class Interpreter():
raise InterpreterException('Argument "configuration" is not of type configuration_data')
ofile_abs = os.path.join(self.environment.build_dir, self.subdir, output)
if inputfile is not None:
- conffile = os.path.join(self.subdir, inputfile)
+ # Normalize the path of the conffile to avoid duplicates
+ # This is especially important to convert '/' to '\' on Windows
+ conffile = os.path.normpath(os.path.join(self.subdir, inputfile))
if conffile not in self.build_def_files:
self.build_def_files.append(conffile)
os.makedirs(os.path.join(self.environment.build_dir, self.subdir), exist_ok=True)