the default setup script name becomes "setup"
it can be changed in autocmake.cfg
This commit is contained in:
27
update.py
27
update.py
@ -128,9 +128,9 @@ def autogenerated_notice():
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def gen_setup(config, relative_path):
|
||||
def gen_setup(config, relative_path, setup_script_name):
|
||||
"""
|
||||
Generate setup.py script.
|
||||
Generate setup script.
|
||||
"""
|
||||
s = []
|
||||
s.append('#!/usr/bin/env python')
|
||||
@ -145,8 +145,8 @@ def gen_setup(config, relative_path):
|
||||
|
||||
s.append('\n\noptions = """')
|
||||
s.append('Usage:')
|
||||
s.append(' ./setup.py [options] [<builddir>]')
|
||||
s.append(' ./setup.py (-h | --help)')
|
||||
s.append(' ./{0} [options] [<builddir>]'.format(setup_script_name))
|
||||
s.append(' ./{0} (-h | --help)'.format(setup_script_name))
|
||||
s.append('\nOptions:')
|
||||
|
||||
options = []
|
||||
@ -334,7 +334,7 @@ def main(argv):
|
||||
sys.stderr.write("Step 1: Update or create infrastructure files\n")
|
||||
sys.stderr.write(" which will be needed to configure and build the project:\n")
|
||||
sys.stderr.write(" $ %s --self\n\n" % argv[0])
|
||||
sys.stderr.write("Step 2: Create CMakeLists.txt and setup.py in PROJECT_ROOT:\n")
|
||||
sys.stderr.write("Step 2: Create CMakeLists.txt and setup script in PROJECT_ROOT:\n")
|
||||
sys.stderr.write(" $ %s <PROJECT_ROOT>\n" % argv[0])
|
||||
sys.stderr.write(" example:\n")
|
||||
sys.stderr.write(" $ %s ..\n" % argv[0])
|
||||
@ -343,7 +343,7 @@ def main(argv):
|
||||
if argv[1] in ['-h', '--help']:
|
||||
print('Usage:')
|
||||
print(' python update.py --self Update this script and fetch or update infrastructure files under lib/.')
|
||||
print(' python update.py <builddir> (Re)generate CMakeLists.txt and setup.py and fetch or update CMake modules.')
|
||||
print(' python update.py <builddir> (Re)generate CMakeLists.txt and setup script and fetch or update CMake modules.')
|
||||
print(' python update.py (-h | --help) Show this help text.')
|
||||
sys.exit(0)
|
||||
|
||||
@ -398,7 +398,12 @@ def main(argv):
|
||||
sys.exit(-1)
|
||||
min_cmake_version = config.get('project', 'min_cmake_version')
|
||||
|
||||
# get relative path from setup.py script to this directory
|
||||
if config.has_option('project', 'setup_script'):
|
||||
setup_script_name = config.get('project', 'setup_script')
|
||||
else:
|
||||
setup_script_name = 'setup'
|
||||
|
||||
# get relative path from setup script to this directory
|
||||
relative_path = os.path.relpath(os.path.abspath('.'), project_root)
|
||||
|
||||
# fetch modules from the web or from relative paths
|
||||
@ -410,10 +415,10 @@ def main(argv):
|
||||
with open(os.path.join(project_root, 'CMakeLists.txt'), 'w') as f:
|
||||
f.write('%s\n' % '\n'.join(s))
|
||||
|
||||
# create setup.py
|
||||
print('- generating setup.py')
|
||||
s = gen_setup(config, relative_path)
|
||||
file_path = os.path.join(project_root, 'setup.py')
|
||||
# create setup script
|
||||
print('- generating setup script')
|
||||
s = gen_setup(config, relative_path, setup_script_name)
|
||||
file_path = os.path.join(project_root, setup_script_name)
|
||||
with open(file_path, 'w') as f:
|
||||
f.write('%s\n' % '\n'.join(s))
|
||||
if sys.platform != 'win32':
|
||||
|
Reference in New Issue
Block a user