aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Klumpp <matthias@tenstral.net>2018-01-18 03:23:17 +0100
committerMatthias Klumpp <matthias@tenstral.net>2018-02-12 19:12:44 +0100
commit3274f951d20de2f6fcfa78e0531f7f70d7d234a8 (patch)
treecddde54f8ccc329e9385f91d30f20ed214d6d3b6
parentf35606f61ea19d1d71b670b34ed8dc108b492d7f (diff)
downloadmeson-3274f951d20de2f6fcfa78e0531f7f70d7d234a8.zip
meson-3274f951d20de2f6fcfa78e0531f7f70d7d234a8.tar.gz
meson-3274f951d20de2f6fcfa78e0531f7f70d7d234a8.tar.bz2
Don't fail loading subprojects if subprojects_dir is in a subdirectory
-rw-r--r--mesonbuild/interpreter.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 0dfe57d..9b1b45c 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -33,6 +33,7 @@ from .modules import ModuleReturnValue
import os, sys, shutil, uuid
import re, shlex
from collections import namedtuple
+from pathlib import PurePath
import importlib
@@ -2963,11 +2964,16 @@ different subdirectory.
def evaluate_subproject_info(self, path_from_source_root, subproject_dirname):
depth = 0
subproj_name = ''
- segs = path_from_source_root.split(os.path.sep)
- while segs and segs[0] == subproject_dirname:
- depth += 1
- subproj_name = segs[1]
- segs = segs[2:]
+ segs = PurePath(path_from_source_root).parts
+ segs_spd = PurePath(subproject_dirname).parts
+ while segs and segs[0] == segs_spd[0]:
+ if len(segs_spd) == 1:
+ subproj_name = segs[1]
+ segs = segs[2:]
+ depth += 1
+ else:
+ segs_spd = segs_spd[1:]
+ segs = segs[1:]
return (depth, subproj_name)
# Check that the indicated file is within the same subproject