TEMPORARY_DIRECTORY = '/tmp'
-# Globals
-quiet = False
-command = None
+class Globals:
+ quiet = False
+ command = None
+
+globals = Globals()
class Error(Exception):
def __init__(self, value):
#
def log(m):
- if not quiet:
+ if not globals.quiet:
print '\x1b[33m* %s\x1b[0m' % m
def copytree(a, b):
elif s.startswith('osx-'):
target = OSXSingleTarget(int(s.split('-')[1]), work)
elif s == 'osx':
- if command == 'build':
+ if globals.command == 'build':
target = OSXSingleTarget(64, work)
else:
target = OSXUniversalTarget(work)
def checkout(self, target):
flags = ''
redirect = ''
- if quiet:
+ if globals.quiet:
flags = '-q'
redirect = '>/dev/null'
command('git clone %s %s/%s.git %s/src/%s' % (flags, config.get('git_prefix'), self.name, target.directory, self.name))
if args.project is None and args.command != 'shell':
raise Error('you must specify -p or --project')
- quiet = args.quiet
- command = args.command
+ globals.quiet = args.quiet
+ globals.command = args.command
project = Project(args.project, args.directory, args.checkout)
commands = ['build', 'package', 'release', 'pot', 'changelog', 'manual', 'doxygen', 'latest', 'test', 'shell', 'revision']
- if command not in commands:
+ if globals.command not in commands:
e = 'command must be one of: '
for c in commands:
e += '%s ' % c
raise Error(e)
- if command == 'build':
+ if globals.command == 'build':
if args.target is None:
raise Error('you must specify -t or --target')
if not args.keep:
target.cleanup()
- elif command == 'package':
+ elif globals.command == 'package':
if args.target is None:
raise Error('you must specify -t or --target')
if not args.keep:
target.cleanup()
- elif command == 'release':
+ elif globals.command == 'release':
if args.minor is False and args.micro is False:
raise Error('you must specify --minor or --micro')
target.cleanup()
- elif command == 'pot':
+ elif globals.command == 'pot':
target = SourceTarget()
project.checkout(target)
target.cleanup()
- elif command == 'changelog':
+ elif globals.command == 'changelog':
target = SourceTarget()
project.checkout(target)
target.cleanup()
- elif command == 'manual':
+ elif globals.command == 'manual':
target = SourceTarget()
project.checkout(target)
target.cleanup()
- elif command == 'doxygen':
+ elif globals.command == 'doxygen':
target = SourceTarget()
project.checkout(target)
target.cleanup()
- elif command == 'latest':
+ elif globals.command == 'latest':
target = SourceTarget()
project.checkout(target)
print latest
target.cleanup()
- elif command == 'test':
+ elif globals.command == 'test':
if args.target is None:
raise Error('you must specify -t or --target')
if target is not None:
target.cleanup()
- elif command == 'shell':
+ elif globals.command == 'shell':
if args.target is None:
raise Error('you must specify -t or --target')
target = target_factory(args.target, args.debug, args.work)
target.command('bash')
- elif command == 'revision':
+ elif globals.command == 'revision':
target = SourceTarget()
project.checkout(target)
target.cleanup()
else:
- raise Error('invalid command %s' % command)
+ raise Error('invalid command %s' % globals.command)
try:
main()