Ejemplo n.º 1
0
def main():
    op = optparse.OptionParser()
    op.add_option(
        '--stgit-version',
        action='store_true',
        help='Print StGit version',
    )
    op.add_option(
        '--asciidoc',
        metavar='CMD',
        help='Print asciidoc documentation for a command',
    )
    op.add_option(
        '--commands',
        action='store_true',
        help='Print list of all stg subcommands',
    )
    op.add_option(
        '--cmd-list',
        action='store_true',
        help='Print asciidoc command list',
    )
    op.add_option(
        '--py-cmd-list',
        action='store_true',
        help='Write Python command list',
    )
    op.add_option(
        '--bash-completion',
        action='store_true',
        help='Write bash completion code',
    )
    op.add_option(
        '--fish-completion',
        action='store_true',
        help='Write fish completion code',
    )
    options, args = op.parse_args()
    if args:
        op.error('Wrong number of arguments')
    if options.stgit_version:
        print(stgit.version.get_version())
    elif options.asciidoc:
        argparse.write_asciidoc(stgit.main.commands[options.asciidoc], sys.stdout)
    elif options.commands:
        for cmd, _, _, _ in commands.get_commands(allow_cached=False):
            print(cmd)
    elif options.cmd_list:
        commands.asciidoc_command_list(
            commands.get_commands(allow_cached=False), sys.stdout
        )
    elif options.py_cmd_list:
        commands.py_commands(commands.get_commands(allow_cached=False), sys.stdout)
    elif options.bash_completion:
        write_bash_completion(sys.stdout)
    elif options.fish_completion:
        write_fish_completion(sys.stdout)
    else:
        op.error('No command')
Ejemplo n.º 2
0
        break
else:
    print('StGit version unavailable', file=sys.stderr)
    sys.exit(1)

with open('stgit/builtin_version.py', 'w') as f:
    print(
        '# This file is automatically generated. Do not edit.',
        'version = {ver!r}'.format(ver=ver),
        sep='\n',
        file=f,
    )

# generate the python command list
with open('stgit/commands/cmdlist.py', 'w') as f:
    commands.py_commands(commands.get_commands(allow_cached=False), f)

# generate the bash completion script
with open('stgit-completion.bash', 'w') as f:
    completion.write_completion(f)

setup(
    name='stgit',
    version=ver,
    license='GPLv2',
    author='Catalin Marinas',
    author_email='*****@*****.**',
    url='http://www.procode.org/stgit/',
    download_url='https://repo.or.cz/stgit.git',
    description='Stacked GIT',
    long_description='Push/pop utility on top of GIT',
Ejemplo n.º 3
0
Archivo: setup.py Proyecto: samv/stgit
            ('share/stgit/templates', glob.glob('templates/*.tmpl')),
            ('share/stgit/examples', glob.glob('examples/*.tmpl')),
            ('share/stgit/examples', ['examples/gitconfig']),
            ('share/stgit/contrib', ['contrib/stgbashprompt.sh']),
            ('share/stgit/completion', ['stgit-completion.bash'])
            ])

# Check the minimum versions required
__check_python_version()
__check_git_version()

# ensure readable template files
old_mask = os.umask(0022)

version.write_builtin_version()

# generate the python command list
f = file('stgit/commands/cmdlist.py', 'w')
commands.py_commands(commands.get_commands(allow_cached = False), f)
f.close()

# generate the bash completion script
f = file('stgit-completion.bash', 'w')
completion.write_completion(f)
f.close()

__run_setup()

# restore the old mask
os.umask(old_mask)