mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
git-serve: Move entry point to a main() method
Move the main program logic of git-serve to a main() method such that it can be used as a module and easily be invoked by setuptools wrapper scripts. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
b8318d2587
commit
8468b6be4b
1 changed files with 102 additions and 96 deletions
|
@ -289,6 +289,7 @@ def usage(cmds):
|
|||
exit(0)
|
||||
|
||||
|
||||
def main():
|
||||
user = os.environ.get('AUR_USER')
|
||||
privileged = (os.environ.get('AUR_PRIVILEGED', '0') == '1')
|
||||
ssh_cmd = os.environ.get('SSH_ORIGINAL_COMMAND')
|
||||
|
@ -339,7 +340,8 @@ elif action == 'setup-repo':
|
|||
die_with_help("{:s}: missing repository name".format(action))
|
||||
if len(cmdargv) > 2:
|
||||
die_with_help("{:s}: too many arguments".format(action))
|
||||
warn('{:s} is deprecated. Use `git push` to create new repositories.'.format(action))
|
||||
warn('{:s} is deprecated. '
|
||||
'Use `git push` to create new repositories.'.format(action))
|
||||
create_pkgbase(cmdargv[1], user)
|
||||
elif action == 'restore':
|
||||
if len(cmdargv) < 2:
|
||||
|
@ -397,3 +399,7 @@ elif action == 'help':
|
|||
usage(cmds)
|
||||
else:
|
||||
die_with_help("invalid command: {:s}".format(action))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Reference in a new issue