SCons: replace deprecated Options() by new Variables() object

dop-in replacement, no functionality change. Requires SCons >= 1.0
This commit is contained in:
Fischlurch 2010-05-21 01:51:18 +02:00
parent d10380d124
commit 0977a7de6d

View file

@ -63,8 +63,8 @@ def setupBasicEnvironment():
Decider('MD5-timestamp') # detect changed files by timestamp, then do a MD5 Decider('MD5-timestamp') # detect changed files by timestamp, then do a MD5
opts = defineCmdlineOptions() vars = defineCmdlineVariables()
env = LumieraEnvironment(options=opts env = LumieraEnvironment(variables=vars
,toolpath = [TOOLDIR] ,toolpath = [TOOLDIR]
,tools = ["default", "BuilderGCH", "BuilderDoxygen"] ,tools = ["default", "BuilderGCH", "BuilderDoxygen"]
) )
@ -101,8 +101,8 @@ def setupBasicEnvironment():
appendCppDefine(env,'PKGDATADIR','LUMIERA_CONFIG_PATH=\\"$PKGLIBDIR/:.\\"' appendCppDefine(env,'PKGDATADIR','LUMIERA_CONFIG_PATH=\\"$PKGLIBDIR/:.\\"'
,'LUMIERA_CONFIG_PATH=\\"$DESTDIR/share/lumiera/:.\\"') ,'LUMIERA_CONFIG_PATH=\\"$DESTDIR/share/lumiera/:.\\"')
prepareOptionsHelp(opts,env) prepareOptionsHelp(vars,env)
opts.Save(OPTIONSCACHEFILE, env) vars.Save(OPTIONSCACHEFILE, env)
return env return env
def appendCppDefine(env,var,cppVar, elseVal=''): def appendCppDefine(env,var,cppVar, elseVal=''):
@ -142,40 +142,40 @@ def handleVerboseMessages(env):
def defineCmdlineOptions(): def defineCmdlineVariables():
""" current options will be persisted in a options cache file. """ several toggles and configuration variables can be set on the commandline,
you may define custom options in a separate file. current settings will be persisted in a options cache file.
you may define custom variable settings in a separate file.
Commandline will override both. Commandline will override both.
""" """
opts = Options([OPTIONSCACHEFILE, CUSTOPTIONSFILE]) vars = Variables([OPTIONSCACHEFILE, CUSTOPTIONSFILE])
opts.AddOptions( vars.AddVariables(
('ARCHFLAGS', 'Set architecture-specific compilation flags (passed literally to gcc)','') ('ARCHFLAGS', 'Set architecture-specific compilation flags (passed literally to gcc)','')
,('CC', 'Set the C compiler to use.', 'gcc') ,('CC', 'Set the C compiler to use.', 'gcc')
,('CXX', 'Set the C++ compiler to use.', 'g++') ,('CXX', 'Set the C++ compiler to use.', 'g++')
,PathOption('CCACHE', 'Integrate with CCache', '', PathOption.PathAccept) ,PathVariable('CCACHE', 'Integrate with CCache', '', PathVariable.PathAccept)
,PathOption('DISTCC', 'Invoke C/C++ compiler commands through DistCC', '', PathOption.PathAccept) ,PathVariable('DISTCC', 'Invoke C/C++ compiler commands through DistCC', '', PathVariable.PathAccept)
,EnumOption('BUILDLEVEL', 'NoBug build level for debugging', 'ALPHA', ,EnumVariable('BUILDLEVEL', 'NoBug build level for debugging', 'ALPHA', allowed_values=('ALPHA', 'BETA', 'RELEASE'))
allowed_values=('ALPHA', 'BETA', 'RELEASE')) ,BoolVariable('DEBUG', 'Build with debugging information and no optimisations', False)
,BoolOption('DEBUG', 'Build with debugging information and no optimisations', False) ,BoolVariable('OPTIMIZE', 'Build with strong optimisation (-O3)', False)
,BoolOption('OPTIMIZE', 'Build with strong optimisation (-O3)', False) ,BoolVariable('VALGRIND', 'Run Testsuite under valgrind control', True)
,BoolOption('VALGRIND', 'Run Testsuite under valgrind control', True) ,BoolVariable('VERBOSE', 'Print full build commands', False)
,BoolOption('VERBOSE', 'Print full build commands', False)
,('TESTSUITES', 'Run only Testsuites matching the given pattern', '') ,('TESTSUITES', 'Run only Testsuites matching the given pattern', '')
# ,BoolOption('OPENGL', 'Include support for OpenGL preview rendering', False) # ,BoolVariable('OPENGL', 'Include support for OpenGL preview rendering', False)
# ,EnumOption('DIST_TARGET', 'Build target architecture', 'auto', # ,EnumVariable('DIST_TARGET', 'Build target architecture', 'auto',
# allowed_values=('auto', 'i386', 'i686', 'x86_64' ), ignorecase=2) # allowed_values=('auto', 'i386', 'i686', 'x86_64' ), ignorecase=2)
,PathOption('DESTDIR', 'Installation dir prefix', '/usr/local') ,PathVariable('DESTDIR', 'Installation dir prefix', '/usr/local')
,PathOption('PKGLIBDIR', 'Installation dir for plugins, defaults to DESTDIR/lib/lumiera', '',PathOption.PathAccept) ,PathVariable('PKGLIBDIR', 'Installation dir for plugins, defaults to DESTDIR/lib/lumiera', '',PathVariable.PathAccept)
,PathOption('PKGDATADIR', 'Installation dir for default config, usually DESTDIR/share/lumiera', '',PathOption.PathAccept) ,PathVariable('PKGDATADIR', 'Installation dir for default config, usually DESTDIR/share/lumiera', '',PathVariable.PathAccept)
,PathOption('SRCTAR', 'Create source tarball prior to compiling', '..', PathOption.PathAccept) ,PathVariable('SRCTAR', 'Create source tarball prior to compiling', '..', PathVariable.PathAccept)
,PathOption('DOCTAR', 'Create tarball with developer documentation', '..', PathOption.PathAccept) ,PathVariable('DOCTAR', 'Create tarball with developer documentation', '..', PathVariable.PathAccept)
) )
return opts return vars
def prepareOptionsHelp(opts,env): def prepareOptionsHelp(vars,env):
prelude = """ prelude = """
USAGE: scons [-c] [OPTS] [key=val [key=val...]] [TARGETS] USAGE: scons [-c] [OPTS] [key=val [key=val...]] [TARGETS]
Build and optionally install Lumiera. Build and optionally install Lumiera.
@ -194,7 +194,7 @@ Special Targets:
Configuration Options: Configuration Options:
""" """
Help(prelude + opts.GenerateHelpText(env)) Help(prelude + vars.GenerateHelpText(env))