diff options
| author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-30 02:53:35 +0530 |
|---|---|---|
| committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-30 03:19:31 +0530 |
| commit | bb491735a980d9124078ac032a5281e648027de7 (patch) | |
| tree | 12891bd7f7427089fee1a392c9940a98a54bdfde /mesonbuild/coredata.py | |
| parent | 66fbcde96e4dd3782d5289b4faf2479335bdf7b1 (diff) | |
| download | meson-bb491735a980d9124078ac032a5281e648027de7.tar.gz | |
coredata: Use our own implementation of commonpath
os.path.commonpath was added in Python 3.5, so just write our own for
now. pathlib was added in Python 3.4, so this should be ok. We need to
use that instead of doing str.split() etc because Windows path handling
has a lot of exceptions and pathlib handles all that for us.
Also adds a unit test for this.
Diffstat (limited to 'mesonbuild/coredata.py')
| -rw-r--r-- | mesonbuild/coredata.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 1ec769a36..2dd2f2acd 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -13,7 +13,8 @@ # limitations under the License. import pickle, os, uuid -from .mesonlib import MesonException, default_libdir, default_libexecdir, default_prefix +from .mesonlib import MesonException, commonpath +from .mesonlib import default_libdir, default_libexecdir, default_prefix version = '0.38.0.dev1' backendlist = ['ninja', 'vs2010', 'vs2015', 'xcode'] @@ -158,7 +159,7 @@ class CoreData: if option.endswith('dir') and os.path.isabs(value) and \ option not in builtin_dir_noprefix_options: # Value must be a subdir of the prefix - if os.path.commonpath([value, prefix]) != prefix: + if commonpath([value, prefix]) != prefix: m = 'The value of the {!r} option is {!r} which must be a ' \ 'subdir of the prefix {!r}.\nNote that if you pass a ' \ 'relative path, it is assumed to be a subdir of prefix.' |
