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
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):
default = ARGUMENTS[name]
if split:
default = default.split()
default = None
# then use environment default
elif os.environ.has_key(name):
print "Acquiring variable %s from system environment: %s" % (name, os.environ[name])
default = os.environ[name]
if split:
default = default.split()
# set variable
if required is not None:
env[name] = required
if default is not None:
if env.has_key(name) and env[name] != default:
env[name] += default
else:
env[name] = default
# the real value should be env[name] + default + required
if split:
value = []
if env.has_key(name):
value = str(env[name]).split()
if required is not None:
value += required
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, 'CC')