Ensure correct prog name available to manpage

Building manpage will use the parser, which will need to be told that
'git-upstream' is the correct program name, otherwise it will use
sys.argv[0] and this is set to 'setup.py' when building using:

    python setup.py build_manpage

Change-Id: I6de46b99cc4e7d536dcd5e39ba8f224cc492e4d8
This commit is contained in:
Darragh Bailey
2016-10-24 14:31:07 +01:00
parent d2c030637b
commit bc9fc649f6

View File

@@ -42,6 +42,7 @@ except ImportError:
def build_parsers(): def build_parsers():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='git-upstream',
description=__doc__.strip(), description=__doc__.strip(),
epilog='See "%(prog)s help COMMAND" for help on a specific command.', epilog='See "%(prog)s help COMMAND" for help on a specific command.',
add_help=False) add_help=False)
@@ -67,7 +68,7 @@ def build_parsers():
# calculate the correct path to allow the program be re-executed # calculate the correct path to allow the program be re-executed
program = sys.argv[0] program = sys.argv[0]
if os.path.split(program)[-1] != 'git-upstream': if os.path.split(program)[-1] != parser.prog:
script_cmdline = ['python', program] script_cmdline = ['python', program]
else: else:
script_cmdline = [program] script_cmdline = [program]