summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-04-12 02:35:34 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-04-12 02:38:32 +0530
commitb49b85816477885fc230d9e94c91e8cbfd491877 (patch)
tree7f9d3c5d6b71559e7c7de1f4fc24a91a0d020710
parent487526bfff8583cf1c0805e300967d8f23932fb0 (diff)
downloadmeson-nirbheek/fix-promote-wrap-files.tar.gz
wraptool: Allow promoting a subproject called foo.wrapnirbheek/fix-promote-wrap-files
During setup we suggest running meson wrap promote path/to/foo.wrap so accept that syntax too.
-rw-r--r--mesonbuild/wrap/wraptool.py5
-rwxr-xr-xrun_unittests.py2
2 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/wrap/wraptool.py b/mesonbuild/wrap/wraptool.py
index 09a0289bf..3d046a0d3 100644
--- a/mesonbuild/wrap/wraptool.py
+++ b/mesonbuild/wrap/wraptool.py
@@ -160,8 +160,11 @@ def promote(argument):
path_segment, subproject_name = os.path.split(argument)
spdir_name = 'subprojects'
sprojs = mesonlib.detect_subprojects(spdir_name)
+ # The command we suggest ends with .wrap, so allow that too
+ if subproject_name.endswith('.wrap'):
+ subproject_name = subproject_name[:-5]
if subproject_name not in sprojs:
- sys.exit('Subproject %s not found in directory tree.' % subproject_name)
+ sys.exit('Subproject {!r} not found in directory tree'.format(subproject_name))
matches = sprojs[subproject_name]
if len(matches) == 1:
do_promotion(matches[0], spdir_name)
diff --git a/run_unittests.py b/run_unittests.py
index 4f688cd91..c8576ea60 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1777,7 +1777,7 @@ int main(int argc, char **argv) {
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)
+ subprocess.check_call(self.wrap_command + ['promote', 'athing.wrap'], cwd=workdir)
self.assertTrue(os.path.isfile(promoted_wrap))
self.init(workdir)
self.build()