Commit cfb8b6eb authored by André Anjos's avatar André Anjos 💬
Browse files

Force debug flag from buildout (closes #17)

parent 271cf574
Pipeline #8697 passed with stages
in 16 minutes and 41 seconds
...@@ -65,6 +65,14 @@ class EnvironmentWrapper(object): ...@@ -65,6 +65,14 @@ class EnvironmentWrapper(object):
if value: if value:
self.environ[key] = value.strip(sep) self.environ[key] = value.strip(sep)
def __prepend_to_environ(key, value, sep=' '):
if self.environ.get(key):
if value:
self.environ[key] = value.strip(sep) + sep + self.environ[key]
else:
if value:
self.environ[key] = value.strip(sep)
# joins all paths, respecting potential environment variables set by the # joins all paths, respecting potential environment variables set by the
# user, with priority # user, with priority
__remove_environ('BOB_PREFIX_PATH') __remove_environ('BOB_PREFIX_PATH')
...@@ -92,11 +100,10 @@ class EnvironmentWrapper(object): ...@@ -92,11 +100,10 @@ class EnvironmentWrapper(object):
__remove_environ(key) __remove_environ(key)
__append_to_environ(key, internal) __append_to_environ(key, internal)
__append_to_environ(key, saved) __append_to_environ(key, saved)
__append_to_environ(key, os.environ.get(key)) __prepend_to_environ(key, os.environ.get(key))
# for these environment variables, values set on the environment come last # for these environment variables, values set on the environment come first
# so they can override, values set on the buildout recipe or our internal # so we can override with our debug flag
# settings
if cflags is not None: if cflags is not None:
_order_flags('CFLAGS', cflags) _order_flags('CFLAGS', cflags)
_order_flags('CXXFLAGS', cflags) _order_flags('CXXFLAGS', cflags)
......
...@@ -227,7 +227,7 @@ def test_preserve_user(): ...@@ -227,7 +227,7 @@ def test_preserve_user():
nose.tools.eq_(len(os.environ) - len(before), 1) nose.tools.eq_(len(os.environ) - len(before), 1)
assert os.environ['CFLAGS'].endswith('-BUILDOUT-TEST-STRING') assert os.environ['CFLAGS'].startswith('-BUILDOUT-TEST-STRING')
e.unset() e.unset()
for key in before: for key in before:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment