diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-08-04 03:04:17 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-08-15 23:50:36 +0300 |
commit | fd7e8c540063870391e6ce75aa0fb179180fa057 (patch) | |
tree | 4f87ab60767474259694c09e2dfac48574f11e6a /mesonbuild/interpreter.py | |
parent | 275c493cafb6df15d8655574013cb599c7728c0b (diff) | |
download | meson-fd7e8c540063870391e6ce75aa0fb179180fa057.zip meson-fd7e8c540063870391e6ce75aa0fb179180fa057.tar.gz meson-fd7e8c540063870391e6ce75aa0fb179180fa057.tar.bz2 |
expand tilde when looking up libraries -Dfoo=~/mylib
It is often desirable to use ~ for home directory in -D compilation args.
Why the transform to pathlib.Path and back to str? Because this is one of many
places where the list(map(str,..))) will be eliminated upon Python 3.6 being
minimum Meson Python requirement.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 3a5dfaf..7a858ab 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -33,6 +33,7 @@ from .interpreterbase import ObjectHolder from .modules import ModuleReturnValue from .cmake import CMakeInterpreter +from pathlib import Path import os, shutil, uuid import re, shlex import subprocess @@ -1543,9 +1544,12 @@ class CompilerHolder(InterpreterObject): return self.notfound_library(libname) search_dirs = mesonlib.stringlistify(kwargs.get('dirs', [])) - for i in search_dirs: - if not os.path.isabs(i): - raise InvalidCode('Search directory %s is not an absolute path.' % i) + search_dirs = [Path(d).expanduser() for d in search_dirs] + for d in search_dirs: + if not d.is_absolute(): + raise InvalidCode('Search directory {} is not an absolute path.'.format(d)) + search_dirs = list(map(str, search_dirs)) + libtype = mesonlib.LibType.PREFER_SHARED if 'static' in kwargs: if not isinstance(kwargs['static'], bool): |