scons: make sure to respect options in 'config.py' over defaults stored in opts, fix up permissions and flush the .sconsign.dblite when switching to FAST build - closes #261 and #264
This commit is contained in:
parent
db7b0edd58
commit
6166da7c22
1 changed files with 29 additions and 4 deletions
33
SConstruct
33
SConstruct
|
@ -195,7 +195,7 @@ for opt in opts.options:
|
||||||
if opt.key not in pickle_store:
|
if opt.key not in pickle_store:
|
||||||
pickle_store.append(opt.key)
|
pickle_store.append(opt.key)
|
||||||
|
|
||||||
# Method of adding configure behavoir to Scons adapted from:
|
# Method of adding configure behavior to Scons adapted from:
|
||||||
# http://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/SConstruct
|
# http://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/SConstruct
|
||||||
preconfigured = False
|
preconfigured = False
|
||||||
force_configure = False
|
force_configure = False
|
||||||
|
@ -206,6 +206,10 @@ if 'configure' in command_line_args:
|
||||||
elif ('-h' in command_line_args) or ('--help' in command_line_args):
|
elif ('-h' in command_line_args) or ('--help' in command_line_args):
|
||||||
preconfigured = True # this is just to ensure config gets skipped when help is requested
|
preconfigured = True # this is just to ensure config gets skipped when help is requested
|
||||||
|
|
||||||
|
# initially populate environment with defaults and any possible custom arguments
|
||||||
|
opts.Update(env)
|
||||||
|
|
||||||
|
# if we are not configuring overwrite environment with pickled settings
|
||||||
if not force_configure:
|
if not force_configure:
|
||||||
if os.path.exists(SCONS_CONFIGURE_CACHE):
|
if os.path.exists(SCONS_CONFIGURE_CACHE):
|
||||||
try:
|
try:
|
||||||
|
@ -220,16 +224,28 @@ if not force_configure:
|
||||||
else:
|
else:
|
||||||
preconfigured = False
|
preconfigured = False
|
||||||
|
|
||||||
|
# if custom arguments are supplied make sure to accept them
|
||||||
if opts.args:
|
if opts.args:
|
||||||
|
# since we have custom arguments update environment with all opts to
|
||||||
|
# make sure to absorb the custom ones
|
||||||
|
opts.Update(env)
|
||||||
|
# now since we've got custom arguments we'll disregard any
|
||||||
|
# pickled environment and force another configuration
|
||||||
preconfigured = False
|
preconfigured = False
|
||||||
|
if env['FAST']:
|
||||||
|
# because we are clearing the 'sconf_temp' files each configure when FAST=False
|
||||||
|
# we now need to flush the dblite otherwise SCons will skip checks
|
||||||
|
# during the first 'FAST' configure
|
||||||
|
try:
|
||||||
|
os.unlink('.sconsign.dblite')
|
||||||
|
except: pass
|
||||||
|
|
||||||
elif preconfigured:
|
elif preconfigured:
|
||||||
if ('-h' not in command_line_args) and ('--help' not in command_line_args):
|
if ('-h' not in command_line_args) and ('--help' not in command_line_args):
|
||||||
color_print(4,'Using previous successful configuration...')
|
color_print(4,'Using previous successful configuration...')
|
||||||
color_print(4,'Re-configure by running "python scons/scons.py configure".')
|
color_print(4,'Re-configure by running "python scons/scons.py configure".')
|
||||||
|
|
||||||
opts.Update(env)
|
|
||||||
|
|
||||||
Help(opts.GenerateHelpText(env))
|
|
||||||
|
|
||||||
|
|
||||||
#### Custom Configure Checks ###
|
#### Custom Configure Checks ###
|
||||||
|
@ -787,10 +803,17 @@ if not preconfigured:
|
||||||
pickle_dict[i] = env.get(i)
|
pickle_dict[i] = env.get(i)
|
||||||
pickle.dump(pickle_dict,env_cache)
|
pickle.dump(pickle_dict,env_cache)
|
||||||
env_cache.close()
|
env_cache.close()
|
||||||
# fix up permissions on pickled options
|
# fix up permissions on configure outputs
|
||||||
try:
|
try:
|
||||||
os.chmod(SCONS_CONFIGURE_CACHE,0666)
|
os.chmod(SCONS_CONFIGURE_CACHE,0666)
|
||||||
except: pass
|
except: pass
|
||||||
|
try:
|
||||||
|
os.chmod(SCONS_LOCAL_CONFIG,0666)
|
||||||
|
except: pass
|
||||||
|
try:
|
||||||
|
os.chmod('.sconsign.dblite',0666)
|
||||||
|
except: pass
|
||||||
|
|
||||||
# clean up test build targets
|
# clean up test build targets
|
||||||
if not env['FAST']:
|
if not env['FAST']:
|
||||||
try:
|
try:
|
||||||
|
@ -801,6 +824,8 @@ if not preconfigured:
|
||||||
color_print(4,'\n*Configure complete*\nNow run "python scons/scons.py" to build or "python scons/scons.py install" to install')
|
color_print(4,'\n*Configure complete*\nNow run "python scons/scons.py" to build or "python scons/scons.py install" to install')
|
||||||
Exit(0)
|
Exit(0)
|
||||||
|
|
||||||
|
# autogenerate help on default/current SCons options
|
||||||
|
Help(opts.GenerateHelpText(env))
|
||||||
|
|
||||||
#### Builds ####
|
#### Builds ####
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue