Merge pull request #5942 from scivision/duck

interpreter: raise Meson exception when non-found module is used anyway
This commit is contained in:
Jussi Pakkanen 2019-10-23 18:45:06 +03:00 committed by GitHub
commit ae9723a5c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -2388,6 +2388,8 @@ external dependencies (including libraries) must go to "dependencies".''')
msg = 'Program {!r} was overridden with the compiled executable {!r}'\
' and therefore cannot be used during configuration'
raise InterpreterException(msg.format(progname, cmd.description()))
if not cmd.found():
raise InterpreterException('command {!r} not found or not executable'.format(cmd))
elif isinstance(cmd, CompilerHolder):
cmd = cmd.compiler.get_exelist()[0]
prog = ExternalProgram(cmd, silent=True)

View File

@ -1389,13 +1389,13 @@ class BuildDirLock:
msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_UNLCK, 1)
self.lockfile.close()
def relpath(path, start):
def relpath(path: str, start: str) -> str:
# On Windows a relative path can't be evaluated for paths on two different
# drives (i.e. c:\foo and f:\bar). The only thing left to do is to use the
# original absolute path.
try:
return os.path.relpath(path, start)
except ValueError:
except (TypeError, ValueError):
return path