diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-10-05 23:39:07 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-12-17 21:19:22 +0200 |
commit | 164fb9a150d2a210aee7fa66d0e06ed475c4bdd8 (patch) | |
tree | 8af07ed64e5a77e0fbba084b5b1a0a4577bbddb1 | |
parent | 5b9d79b9029f1a9be897188c6ffbdce65d4e510b (diff) | |
download | meson-164fb9a150d2a210aee7fa66d0e06ed475c4bdd8.zip meson-164fb9a150d2a210aee7fa66d0e06ed475c4bdd8.tar.gz meson-164fb9a150d2a210aee7fa66d0e06ed475c4bdd8.tar.bz2 |
Also promote wrap files.
-rw-r--r-- | mesonbuild/mesonlib.py | 17 | ||||
-rw-r--r-- | mesonbuild/wrap/wraptool.py | 14 | ||||
-rwxr-xr-x | run_unittests.py | 4 | ||||
-rw-r--r-- | test cases/unit/13 promote/subprojects/s2/subprojects/athing.wrap | 2 |
4 files changed, 26 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) diff --git a/run_unittests.py b/run_unittests.py index f742624..d5dc36e 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1661,6 +1661,10 @@ int main(int argc, char **argv) { self.assertFalse(os.path.isdir(scommondir)) subprocess.check_call(self.wrap_command + ['promote', 'subprojects/s2/subprojects/scommon'], cwd=workdir) self.assertTrue(os.path.isdir(scommondir)) + promoted_wrap = os.path.join(spdir, 'athing.wrap') + self.assertFalse(os.path.isfile(promoted_wrap)) + subprocess.check_call(self.wrap_command + ['promote', 'athing'], cwd=workdir) + self.assertTrue(os.path.isfile(promoted_wrap)) self.init(workdir) self.build() diff --git a/test cases/unit/13 promote/subprojects/s2/subprojects/athing.wrap b/test cases/unit/13 promote/subprojects/s2/subprojects/athing.wrap new file mode 100644 index 0000000..09ba4e8 --- /dev/null +++ b/test cases/unit/13 promote/subprojects/s2/subprojects/athing.wrap @@ -0,0 +1,2 @@ +The contents of this wrap file are never evaluated so they +can be anything. |