1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-23 08:16:54 +00:00

setup.py build_usage/build_man fixes

This commit is contained in:
Marian Beermann 2017-02-14 23:01:52 +01:00
parent a1ceb16627
commit 788b608aa9
2 changed files with 6 additions and 6 deletions

View file

@ -220,7 +220,7 @@ def run(self):
os.mkdir('docs/usage') os.mkdir('docs/usage')
# allows us to build docs without the C modules fully loaded during help generation # allows us to build docs without the C modules fully loaded during help generation
from borg.archiver import Archiver from borg.archiver import Archiver
parser = Archiver(prog='borg').parser parser = Archiver(prog='borg').build_parser()
self.generate_level("", parser, Archiver) self.generate_level("", parser, Archiver)
@ -369,7 +369,7 @@ def run(self):
os.makedirs('docs/man', exist_ok=True) os.makedirs('docs/man', exist_ok=True)
# allows us to build docs without the C modules fully loaded during help generation # allows us to build docs without the C modules fully loaded during help generation
from borg.archiver import Archiver from borg.archiver import Archiver
parser = Archiver(prog='borg').parser parser = Archiver(prog='borg').build_parser()
self.generate_level('', parser, Archiver) self.generate_level('', parser, Archiver)
self.build_topic_pages(Archiver) self.build_topic_pages(Archiver)

View file

@ -1691,7 +1691,7 @@ def preprocess_args(self, args):
print(warning, file=sys.stderr) print(warning, file=sys.stderr)
return args return args
def build_parser(self, prog=None): def build_parser(self):
def process_epilog(epilog): def process_epilog(epilog):
epilog = textwrap.dedent(epilog).splitlines() epilog = textwrap.dedent(epilog).splitlines()
try: try:
@ -1702,7 +1702,7 @@ def process_epilog(epilog):
epilog = [line for line in epilog if not line.startswith('.. man')] epilog = [line for line in epilog if not line.startswith('.. man')]
return '\n'.join(epilog) return '\n'.join(epilog)
common_parser = argparse.ArgumentParser(add_help=False, prog=prog) common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog)
common_group = common_parser.add_argument_group('Common options') common_group = common_parser.add_argument_group('Common options')
common_group.add_argument('-h', '--help', action='help', help='show this help message and exit') common_group.add_argument('-h', '--help', action='help', help='show this help message and exit')
@ -1743,7 +1743,7 @@ def process_epilog(epilog):
action='store_true', default=False, action='store_true', default=False,
help='treat part files like normal files (e.g. to list/extract them)') help='treat part files like normal files (e.g. to list/extract them)')
parser = argparse.ArgumentParser(prog=prog, description='Borg - Deduplicated Backups') parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups')
parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__, parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__,
help='show version number and exit') help='show version number and exit')
subparsers = parser.add_subparsers(title='required arguments', metavar='<command>') subparsers = parser.add_subparsers(title='required arguments', metavar='<command>')
@ -3079,7 +3079,7 @@ def parse_args(self, args=None):
# We can't use argparse for "serve" since we don't want it to show up in "Available commands" # We can't use argparse for "serve" since we don't want it to show up in "Available commands"
if args: if args:
args = self.preprocess_args(args) args = self.preprocess_args(args)
parser = self.build_parser(self.prog) parser = self.build_parser()
args = parser.parse_args(args or ['-h']) args = parser.parse_args(args or ['-h'])
if args.func == self.do_create: if args.func == self.do_create:
# need at least 1 path but args.paths may also be populated from patterns # need at least 1 path but args.paths may also be populated from patterns