diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/mesonlib.py | 17 | ||||
-rw-r--r-- | mesonbuild/wrap/wraptool.py | 14 |
2 files changed, 20 insertions, 11 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 8da08d3..bc66b5c 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -901,13 +901,18 @@ def detect_subprojects(spdir_name, current_dir='', result=None): basename = os.path.split(trial)[1] if trial == 'packagecache': continue - if not os.path.isdir(trial): - continue - if basename in result: - result[basename].append(trial) + append_this = True + if os.path.isdir(trial): + detect_subprojects(spdir_name, trial, result) + elif trial.endswith('.wrap') and os.path.isfile(trial): + basename = os.path.splitext(basename)[0] else: - result[basename] = [trial] - detect_subprojects(spdir_name, trial, result) + append_this = False + if append_this: + if basename in result: + result[basename].append(trial) + else: + result[basename] = [trial] return result class OrderedSet(collections.MutableSet): diff --git a/mesonbuild/wrap/wraptool.py b/mesonbuild/wrap/wraptool.py index 096ab4d..00115cb 100644 --- a/mesonbuild/wrap/wraptool.py +++ b/mesonbuild/wrap/wraptool.py @@ -145,11 +145,15 @@ def info(name): print(' ', v['branch'], v['revision']) def do_promotion(from_path, spdir_name): - sproj_name = os.path.split(from_path)[1] - outputdir = os.path.join(spdir_name, sproj_name) - if os.path.exists(outputdir): - sys.exit('Output dir %s already exists. Will not overwrite.' % outputdir) - shutil.copytree(from_path, outputdir, ignore=shutil.ignore_patterns('subprojects')) + if os.path.isfile(from_path): + assert(from_path.endswith('.wrap')) + shutil.copy(from_path, spdir_name) + elif os.path.isdir(from_path): + sproj_name = os.path.split(from_path)[1] + outputdir = os.path.join(spdir_name, sproj_name) + if os.path.exists(outputdir): + sys.exit('Output dir %s already exists. Will not overwrite.' % outputdir) + shutil.copytree(from_path, outputdir, ignore=shutil.ignore_patterns('subprojects')) def promote(argument): path_segment, subproject_name = os.path.split(argument) |