diff --git a/authors.txt b/authors.txt index 0c575e723..ab438b75f 100644 --- a/authors.txt +++ b/authors.txt @@ -73,3 +73,4 @@ Joe Baldino Peter Harris Roger Boerdijk melak47 +Philipp Ittershagen diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 0c6d9809a..af2c17d60 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2290,7 +2290,11 @@ class Interpreter(InterpreterBase): inputfile = inputfile[0] if not isinstance(inputfile, (str, mesonlib.File)): raise InterpreterException('Input must be a string or a file') - ifile_abs = os.path.join(self.environment.source_dir, self.subdir, inputfile) + if isinstance(inputfile, str): + inputfile = os.path.join(self.subdir, inputfile) + else: + inputfile = inputfile.relative_name() + ifile_abs = os.path.join(self.environment.source_dir, inputfile) elif 'command' in kwargs and '@INPUT@' in kwargs['command']: raise InterpreterException('@INPUT@ used as command argument, but no input file specified.') # Validate output @@ -2309,7 +2313,7 @@ class Interpreter(InterpreterBase): if inputfile is not None: # 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)) + conffile = os.path.normpath(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) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 7a5b96266..ba52219db 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -125,14 +125,14 @@ class File: assert(isinstance(self.fname, str)) def __str__(self): - return os.path.join(self.subdir, self.fname) + return self.relative_name() def __repr__(self): ret = '