aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/minstall.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-05-13 10:36:58 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2018-10-04 09:40:21 -0400
commit37067a53c4b3b99982ef8e1f431ba0c9302b66e8 (patch)
tree7d3ebbb24b45bf6cfdb2a76a4dcdabf8808a346c /mesonbuild/minstall.py
parent5af2717e76015b47bfc2b11d4034099d9b62d978 (diff)
downloadmeson-37067a53c4b3b99982ef8e1f431ba0c9302b66e8.zip
meson-37067a53c4b3b99982ef8e1f431ba0c9302b66e8.tar.gz
meson-37067a53c4b3b99982ef8e1f431ba0c9302b66e8.tar.bz2
Use a single ArgumentParser for all subcommands
This has the adventage that "meson --help" shows a list of all commands, making them discoverable. This also reduce the manual parsing of arguments to the strict minimum needed for backward compatibility.
Diffstat (limited to 'mesonbuild/minstall.py')
-rw-r--r--mesonbuild/minstall.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 1d72179..b65abe0 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -14,7 +14,6 @@
import sys, pickle, os, shutil, subprocess, gzip, errno
import shlex
-import argparse
from glob import glob
from .scripts import depfixer
from .scripts import destdir_join
@@ -33,15 +32,13 @@ build definitions so that it will not break when the change happens.'''
selinux_updates = []
-def buildparser():
- parser = argparse.ArgumentParser(prog='meson install')
+def add_arguments(parser):
parser.add_argument('-C', default='.', dest='wd',
help='directory to cd into before running')
parser.add_argument('--no-rebuild', default=False, action='store_true',
help='Do not rebuild before installing.')
parser.add_argument('--only-changed', default=False, action='store_true',
help='Only overwrite files that are older than the copied file.')
- return parser
class DirMaker:
def __init__(self, lf):
@@ -501,9 +498,7 @@ class Installer:
else:
raise
-def run(args):
- parser = buildparser()
- opts = parser.parse_args(args)
+def run(opts):
datafilename = 'meson-private/install.dat'
private_dir = os.path.dirname(datafilename)
log_dir = os.path.join(private_dir, '../meson-logs')
@@ -520,6 +515,3 @@ def run(args):
append_to_log(lf, '# Does not contain files installed by custom scripts.')
installer.do_install(datafilename)
return 0
-
-if __name__ == '__main__':
- sys.exit(run(sys.argv[1:]))