diff options
author | Alberto Sartori <alberto.sartori@huawei.com> | 2022-04-25 12:25:05 +0200 |
---|---|---|
committer | Alberto Sartori 00646730 <alberto.sartori@huawei.com> | 2022-04-25 12:55:58 +0000 |
commit | 32981ac5493a7d9925130609ad123ae2ac9984ab (patch) | |
tree | 7457587db5376eb2ea12156960b224891037419c /bin/just-mr.py | |
parent | fa5fcc82f77f2b3974e04c170b9fdf3107ce185f (diff) | |
download | justbuild-32981ac5493a7d9925130609ad123ae2ac9984ab.tar.gz |
upgrade from optparse to argparse
Diffstat (limited to 'bin/just-mr.py')
-rwxr-xr-x | bin/just-mr.py | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/bin/just-mr.py b/bin/just-mr.py index 1a1c868c..d6859380 100755 --- a/bin/just-mr.py +++ b/bin/just-mr.py @@ -8,7 +8,7 @@ import subprocess import sys import tempfile -from optparse import OptionParser +from argparse import ArgumentParser from pathlib import Path JUST="just" @@ -475,25 +475,34 @@ def fetch(*, config, args): def main(): - parser = OptionParser() - parser.add_option("-C", dest="repository_config", - help="Repository-description file to use", - metavar="FILE") - parser.add_option("-L", dest="checkout_location", - help="Specification file for checkout locations") - parser.add_option("--local_build_root", dest="local_build_root", - help="Root for CAS, repository space, etc", - metavar="PATH") - parser.add_option("--distdir", dest="distdir", action="append", - help="Directory to look for distfiles before fetching", - metavar="PATH") - parser.add_option("--just", dest="just", - help="Path to the just binary", - metavar="PATH") - parser.add_option("--always_file", dest="always_file", action="store_true", - default=False, help="Always create file roots") - - (options, args) = parser.parse_args() + parser = ArgumentParser() + parser.add_argument("-C", + dest="repository_config", + help="Repository-description file to use", + metavar="FILE") + parser.add_argument("-L", + dest="checkout_location", + help="Specification file for checkout locations") + parser.add_argument("--local_build_root", + dest="local_build_root", + help="Root for CAS, repository space, etc", + metavar="PATH") + parser.add_argument("--distdir", + dest="distdir", + action="append", + help="Directory to look for distfiles before fetching", + metavar="PATH") + parser.add_argument("--just", + dest="just", + help="Path to the just binary", + metavar="PATH") + parser.add_argument("--always_file", + dest="always_file", + action="store_true", + default=False, + help="Always create file roots") + + (options, args) = parser.parse_known_args() config = read_config(options.repository_config) global ROOT ROOT = options.local_build_root or os.path.join(Path.home(), ".cache/just") |