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
1 changed files with 2 additions and 1 deletions

View File

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