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

Clean-up environment variables which should be set by Conda activation

parent 8f113055
Pipeline #6761 passed with stages
in 1 minute and 31 seconds
......@@ -23,19 +23,10 @@ class EnvironmentWrapper(object):
settings from initialization.
"""
DEBUG_CFLAGS = '-O0 -g -DBOB_DEBUG'
RELEASE_CFLAGS = '-O3 -g0 -DNDEBUG -mtune=generic'
LDFLAGS = ''
MACOSX_DEPLOYMENT_TARGET = '10.9'
if platform.system() == 'Darwin':
DEBUG_CFLAGS += ' -pthread'
RELEASE_CFLAGS += ' -pthread'
LDFLAGS = '-lpthread'
# Note: CLang does not work well with BZ_DEBUG\n
if platform.system() != 'Darwin':
DEBUG_CFLAGS += ' -DBZ_DEBUG'
# Note: CLang does not work well with BZ_DEBUG
# 24.01.2017: we only support gcc on both Linux and MacOSX
DEBUG_CFLAGS = '-O0 -g -DBOB_DEBUG -pthread -DBZ_DEBUG'
RELEASE_CFLAGS = '-O3 -g0 -DNDEBUG -mtune=generic -pthread'
def __init__(self, logger, debug=None, prefixes=None, environ=None):
......@@ -112,17 +103,6 @@ class EnvironmentWrapper(object):
if cflags is not None:
_order_flags('CFLAGS', cflags)
_order_flags('CXXFLAGS', cflags)
_order_flags('LDFLAGS', EnvironmentWrapper.LDFLAGS)
# sets the MacOSX deployment target, if the user has not yet set it on
# their environment
if platform.system() == 'Darwin':
if os.environ.get('MACOSX_DEPLOYMENT_TARGET'):
self.environ['MACOSX_DEPLOYMENT_TARGET'] = \
os.environ['MACOSX_DEPLOYMENT_TARGET']
else:
self.environ['MACOSX_DEPLOYMENT_TARGET'] = \
EnvironmentWrapper.MACOSX_DEPLOYMENT_TARGET
def set(self):
"""Sets the current environment for variables needed for the setup of the
......
......@@ -54,11 +54,7 @@ def test_set_debug_true():
e.set()
if platform.system() == 'Darwin':
nose.tools.eq_(len(os.environ) - len(before), 4)
else:
# Linux
nose.tools.eq_(len(os.environ) - len(before), 2)
nose.tools.eq_(len(os.environ) - len(before), 2)
assert 'CFLAGS' in os.environ
assert os.environ['CFLAGS'].find(EnvironmentWrapper.DEBUG_CFLAGS) >= 0
......@@ -67,15 +63,6 @@ def test_set_debug_true():
assert os.environ['CXXFLAGS'].find(EnvironmentWrapper.DEBUG_CFLAGS) >= 0
assert os.environ['CXXFLAGS'].find(EnvironmentWrapper.RELEASE_CFLAGS) < 0
if platform.system() == 'Darwin':
assert 'LDFLAGS' in os.environ
assert os.environ['LDFLAGS'].find(EnvironmentWrapper.LDFLAGS) >= 0
assert 'MACOSX_DEPLOYMENT_TARGET' in os.environ
assert os.environ['MACOSX_DEPLOYMENT_TARGET'] == \
EnvironmentWrapper.MACOSX_DEPLOYMENT_TARGET
e.unset()
for key in before:
assert key in os.environ, "key `%s' from before is not on os.environ" % (key,)
......@@ -96,11 +83,7 @@ def test_set_debug_false():
e.set()
if platform.system() == 'Darwin':
nose.tools.eq_(len(os.environ) - len(before), 4)
else:
# Linux
nose.tools.eq_(len(os.environ) - len(before), 2)
nose.tools.eq_(len(os.environ) - len(before), 2)
assert 'CFLAGS' in os.environ
assert 'CXXFLAGS' in os.environ
......@@ -111,15 +94,6 @@ def test_set_debug_false():
assert os.environ['CXXFLAGS'].find(EnvironmentWrapper.DEBUG_CFLAGS) < 0
assert os.environ['CXXFLAGS'].find(EnvironmentWrapper.RELEASE_CFLAGS) >= 0
if platform.system() == 'Darwin':
assert 'LDFLAGS' in os.environ
assert os.environ['LDFLAGS'].find(EnvironmentWrapper.LDFLAGS) >= 0
assert 'MACOSX_DEPLOYMENT_TARGET' in os.environ
assert os.environ['MACOSX_DEPLOYMENT_TARGET'] == \
EnvironmentWrapper.MACOSX_DEPLOYMENT_TARGET
e.unset()
for key in before:
assert key in os.environ, "key `%s' from before is not on os.environ" % (key,)
......@@ -225,11 +199,7 @@ def test_set_multiple():
e.set()
if platform.system() == 'Darwin':
nose.tools.eq_(len(os.environ) - len(before), 7)
else:
# Linux
nose.tools.eq_(len(os.environ) - len(before), 5)
nose.tools.eq_(len(os.environ) - len(before), 5)
nose.tools.eq_(os.environ['CFLAGS'], EnvironmentWrapper.DEBUG_CFLAGS + ' ' + environ['CFLAGS'])
nose.tools.eq_(os.environ['CXXFLAGS'], os.environ['CFLAGS'])
......@@ -263,11 +233,7 @@ def test_preserve_user():
e.set()
if platform.system() == 'Darwin':
nose.tools.eq_(len(os.environ) - len(before), 3)
else:
# Linux
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')
......
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