Scons: fix options like CPPFLAGS

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14845 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-08-26 18:55:51 +00:00
parent 14de7887d8
commit 132ab09b38

View File

@ -523,25 +523,34 @@ def setEnvVariable(env, name, required = None, default = None, split = True):
environment variables environment variables
split: whether or not split obtained variable like '-02 -g' split: whether or not split obtained variable like '-02 -g'
''' '''
# first try command line argument (override environment settings) # 1. ARGUMENTS is already set to env[name], override default.
if ARGUMENTS.has_key(name): if ARGUMENTS.has_key(name):
default = ARGUMENTS[name] default = None
if split:
default = default.split()
# then use environment default # then use environment default
elif os.environ.has_key(name): elif os.environ.has_key(name):
print "Acquiring variable %s from system environment: %s" % (name, os.environ[name]) print "Acquiring variable %s from system environment: %s" % (name, os.environ[name])
default = os.environ[name] default = os.environ[name]
if split: if split:
default = default.split() default = default.split()
# set variable # the real value should be env[name] + default + required
if required is not None: if split:
env[name] = required value = []
if default is not None: if env.has_key(name):
if env.has_key(name) and env[name] != default: value = str(env[name]).split()
env[name] += default if required is not None:
else: value += required
env[name] = default if default is not None:
value += default
else:
value = ""
if env.has_key(name):
value = str(env[name])
if required is not None:
value += " " + required
if default is not None:
value += " " + default
env[name] = value
# print name, env[name]
setEnvVariable(env, 'DESTDIR', split=False) setEnvVariable(env, 'DESTDIR', split=False)
setEnvVariable(env, 'CC') setEnvVariable(env, 'CC')