Check make version for "-O" support

fixes #33
This commit is contained in:
Ralph Lange
2020-06-03 15:48:20 +02:00
parent a0f1c7e96e
commit 58cebdd7dd
2 changed files with 24 additions and 14 deletions

View File

@@ -503,6 +503,8 @@ class TestDetectContext(unittest.TestCase):
class TestSetupForBuild(unittest.TestCase):
args = Namespace(paths=[])
cue.building_base = True
if ci_os == 'windows':
sp.check_call(['choco', 'install', 'make'])
def setUp(self):
os.environ.pop('EPICS_HOST_ARCH', None)
@@ -607,12 +609,12 @@ class TestSetupForBuild(unittest.TestCase):
def test_DetectionBase314No(self):
self.setBase314('NO')
cue.setup_for_build(self.args)
self.assertFalse(cue.isbase314, 'Falsely detected Base 3.14')
self.assertFalse(cue.is_base314, 'Falsely detected Base 3.14')
def test_DetectionBase314Yes(self):
self.setBase314('YES')
cue.setup_for_build(self.args)
self.assertTrue(cue.isbase314, 'Base 3.14 = YES not detected')
self.assertTrue(cue.is_base314, 'Base 3.14 = YES not detected')
def test_DetectionTestResultsTarget314No(self):
self.setBase314('YES')

32
cue.py
View File

@@ -74,15 +74,22 @@ modules_to_compile = []
setup = {}
places = {}
is_base314 = False
is_make3 = False
has_test_results = False
silent_dep_builds = True
def clear_lists():
global isbase314, has_test_results, ci
global is_base314, has_test_results, silent_dep_builds, is_make3
del seen_setups[:]
del modules_to_compile[:]
setup.clear()
places.clear()
isbase314 = False
is_base314 = False
is_make3 = False
has_test_results = False
silent_dep_builds = True
ci['service'] = '<none>'
ci['os'] = '<unknown>'
ci['platform'] = '<unknown>'
@@ -181,11 +188,6 @@ def modlist():
return ret
isbase314 = False
has_test_results = False
silent_dep_builds = True
def host_info():
print('{0}Build using {1} compiler on {2} ({3}) hosted by {4}{5}'
.format(ANSI_CYAN, ci['compiler'], ci['os'], ci['platform'], ci['service'], ANSI_RESET))
@@ -325,10 +327,12 @@ def call_make(args=[], **kws):
parallel = kws.pop('parallel', 2)
silent = kws.pop('silent', False)
# no parallel make for Base 3.14
if parallel <= 0 or isbase314:
if parallel <= 0 or is_base314:
makeargs = []
else:
makeargs = ['-j{0}'.format(parallel), '-Otarget']
makeargs = ['-j{0}'.format(parallel)]
if not is_make3:
makeargs += ['-Otarget']
if silent:
makeargs += ['-s']
logger.debug("EXEC '%s' in %s", ' '.join(['make'] + makeargs + args), place)
@@ -468,7 +472,7 @@ def add_dependency(dep):
def setup_for_build(args):
global isbase314, has_test_results
global is_base314, has_test_results, is_make3
dllpaths = []
if ci['os'] == 'windows':
@@ -563,9 +567,9 @@ def setup_for_build(args):
if os.path.exists(cfg_base_version):
with open(cfg_base_version) as myfile:
if 'BASE_3_14=YES' in myfile.read():
isbase314 = True
is_base314 = True
if not isbase314:
if not is_base314:
rules_build = os.path.join(places['EPICS_BASE'], 'configure', 'RULES_BUILD')
if os.path.exists(rules_build):
with open(rules_build) as myfile:
@@ -573,6 +577,10 @@ def setup_for_build(args):
if re.match('^test-results:', line):
has_test_results = True
# Check make version
if re.match(r'^GNU Make 3', sp.check_output(['make', '-v'])):
is_make3 = True
# apparently %CD% is handled automagically
os.environ['TOP'] = os.getcwd()