Don't fail loading subprojects if subprojects_dir is in a subdirectory

0.44
Matthias Klumpp 7 years ago committed by Nirbheek Chauhan
parent 3efa85b049
commit fcee3c9eba
  1. 16
      mesonbuild/interpreter.py

@ -33,6 +33,7 @@ from .modules import ModuleReturnValue
import os, sys, shutil, uuid import os, sys, shutil, uuid
import re, shlex import re, shlex
from collections import namedtuple from collections import namedtuple
from pathlib import PurePath
import importlib import importlib
@ -2899,11 +2900,16 @@ different subdirectory.
def evaluate_subproject_info(self, path_from_source_root, subproject_dirname): def evaluate_subproject_info(self, path_from_source_root, subproject_dirname):
depth = 0 depth = 0
subproj_name = '' subproj_name = ''
segs = path_from_source_root.split(os.path.sep) segs = PurePath(path_from_source_root).parts
while segs and segs[0] == subproject_dirname: segs_spd = PurePath(subproject_dirname).parts
depth += 1 while segs and segs[0] == segs_spd[0]:
subproj_name = segs[1] if len(segs_spd) == 1:
segs = segs[2:] subproj_name = segs[1]
segs = segs[2:]
depth += 1
else:
segs_spd = segs_spd[1:]
segs = segs[1:]
return (depth, subproj_name) return (depth, subproj_name)
# Check that the indicated file is within the same subproject # Check that the indicated file is within the same subproject

Loading…
Cancel
Save