1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/usr/bin/python
-
- import subprocess
- import sys
- import os
- sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), "../lib"))
- sys.path.append('/usr/lib/gitian')
- from gitian_util import *
-
- def check_command(command):
- if commands.get(command) is None:
- print>>sys.stderr, "usage: %s CMD\ntry: %s help"%(prog, prog)
- exit(1)
- return find_command(command)
-
- args = sys.argv[:]
- prog = args.pop(0)
-
- if len(args) < 1:
- print>>sys.stderr, "usage: %s CMD\n\ntry:\n %s help\nor:\n %s help CMD"%(prog, prog, prog)
- exit(1)
-
- commands = {
- "release-build": "Build all packages into the 'dist' directory",
- "package-build": "Build a single package into the 'dist' directory",
- "package-new": "Insert a new package into the distribution",
- "release-upload": "Upload a release to a web server",
- }
- if args[0] == "help":
- if len(args) == 1:
- for command in commands.keys():
- print command, " - ", commands[command]
- else:
- command = args[1]
- command_path = find_command(command)
- ret = subprocess.call([command_path, "-h"])
- elif args[0] == 'shell-complete':
- if len(args) == 1 or args[1] == "help":
- for command in commands.keys():
- print "%s:%s"%(command, commands[command])
- else:
- command = args[1]
- command_path = find_command(command)
- ret = subprocess.call([command_path, "--shell-complete"])
- else:
- command = args.pop(0)
- command_path = find_command(command)
- args.insert(0, command_path)
- os.execv(command_path, args)
|