Added cmake style config argument, which allows us to make it non-interactive.

This commit is contained in:
Nick Bolton 2009-11-02 10:56:22 +00:00
parent 9515338c75
commit d85c266aa0
1 changed files with 21 additions and 19 deletions

40
hm.py
View File

@ -130,9 +130,9 @@ def usage():
'Example: %s configure' 'Example: %s configure'
) % (this_cmd, this_cmd) ) % (this_cmd, this_cmd)
def configure(): def configure(generator = None):
err = configure_internal() err = configure_internal(generator)
if err == 0: if err == 0:
print ('Configure complete!\n\n' print ('Configure complete!\n\n'
@ -143,9 +143,9 @@ def configure():
else: else:
return False return False
def configure_internal(): def configure_internal(generator = None):
ensure_setup_latest() ensure_setup_latest(generator)
generator = get_generator() generator = get_generator()
if generator != '': if generator != '':
@ -299,7 +299,7 @@ def package(type):
# Package is supported by default. # Package is supported by default.
package_unsupported = False package_unsupported = False
if type == '': if type == None:
package_usage() package_usage()
elif type == 'src-tgz': elif type == 'src-tgz':
if sys.platform in ['linux2', 'darwin']: if sys.platform in ['linux2', 'darwin']:
@ -332,7 +332,7 @@ def package(type):
else: else:
package_unsupported = True package_unsupported = True
else: else:
print 'Not yet implemented: package %s' % package_type print 'Not yet implemented: package %s' % type
if package_unsupported: if package_unsupported:
print ('Package type, %s is not ' print ('Package type, %s is not '
@ -407,7 +407,7 @@ def main(argv):
arg_1 = argv[1] arg_1 = argv[1]
completions = complete_command(arg_1) completions = complete_command(arg_1)
arg_2 = '' arg_2 = None
if len(argv) > 2: if len(argv) > 2:
arg_2 = argv[2] arg_2 = argv[2]
@ -423,7 +423,7 @@ def main(argv):
if cmd in ['about', 'info']: if cmd in ['about', 'info']:
about() about()
elif cmd in ['configure', 'conf']: elif cmd in ['configure', 'conf']:
configure() configure(arg_2)
elif cmd in ['build']: elif cmd in ['build']:
build(arg_2) build(arg_2)
elif cmd in ['open']: elif cmd in ['open']:
@ -486,17 +486,19 @@ def open_project_internal(project_filename, application = ''):
os.system(path) os.system(path)
return True return True
def setup(): def setup(generator = None):
print "Running setup..." print "Running setup..."
if sys.platform == 'win32': # If no generator specified, prompt the user.
generator = setup_generator_get(win32_generators) if generator == None:
elif sys.platform in ['linux2', 'sunos5', 'freebsd7']: if sys.platform == 'win32':
generator = setup_generator_get(unix_generators) generator = setup_generator_get(win32_generators)
elif sys.platform == 'darwin': elif sys.platform in ['linux2', 'sunos5', 'freebsd7']:
generator = setup_generator_get(darwin_generators) generator = setup_generator_get(unix_generators)
else: elif sys.platform == 'darwin':
raise Exception('Unsupported platform: ' + sys.platform) generator = setup_generator_get(darwin_generators)
else:
raise Exception('Unsupported platform: ' + sys.platform)
# Create build dir, since config file resides there. # Create build dir, since config file resides there.
if not os.path.exists(bin_dir): if not os.path.exists(bin_dir):
@ -662,9 +664,9 @@ def run_vcbuild(generator, mode, args=''):
return os.system(temp_bat) return os.system(temp_bat)
def ensure_setup_latest(): def ensure_setup_latest(generator = None):
if not has_setup_version(setup_version): if not has_setup_version(setup_version):
setup() setup(generator)
# Start the program. # Start the program.
main(sys.argv) main(sys.argv)