Compare commits
5 Commits
v3.4.1
...
0e93b70855
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e93b70855 | ||
|
|
fe29811d26 | ||
|
|
dead44c3cb | ||
|
|
ca8fde2eaf | ||
|
|
130e88b709 |
@@ -702,7 +702,7 @@ class TestAppveyorDetectContext(unittest.TestCase):
|
||||
|
||||
|
||||
class TestSetupForBuild(unittest.TestCase):
|
||||
args = Namespace(paths=[])
|
||||
args = Namespace(extra_env_vars=[])
|
||||
if ci_os == 'windows':
|
||||
choco_installs = ['make']
|
||||
if ci_service != 'appveyor':
|
||||
@@ -721,7 +721,7 @@ class TestSetupForBuild(unittest.TestCase):
|
||||
|
||||
def test_AddPathsOption(self):
|
||||
os.environ['FOOBAR'] = 'BAR'
|
||||
args = Namespace(paths=['/my/{FOOBAR}/dir', '/my/foobar'])
|
||||
args = Namespace(extra_env_vars=['PATH=/my/{FOOBAR}/dir', 'PATH=/my/foobar'])
|
||||
cue.setup_for_build(args)
|
||||
self.assertTrue(re.search('/my/BAR/dir', os.environ['PATH']), 'Expanded path not in PATH')
|
||||
self.assertTrue(re.search('/foobar', os.environ['PATH']), 'Plain path not in PATH')
|
||||
@@ -887,7 +887,7 @@ LINE2=NO''')
|
||||
|
||||
@unittest.skipIf(ci_os != 'linux', 'CrossCompatibilityHandling tests only apply to linux')
|
||||
class TestCrossCompatibilityHandling(unittest.TestCase):
|
||||
args = Namespace(paths=[])
|
||||
args = Namespace(extra_env_vars=[])
|
||||
|
||||
def setUp(self):
|
||||
cue.clear_lists()
|
||||
|
||||
45
cue.py
45
cue.py
@@ -136,7 +136,10 @@ def detect_context():
|
||||
ci['cachedir'] = os.environ['CACHEDIR']
|
||||
|
||||
if 'CHOCO' in os.environ:
|
||||
ci['choco'].extend(os.environ['CHOCO'].split())
|
||||
if os.environ['CHOCO'] == 'NO':
|
||||
ci['choco'] = []
|
||||
else:
|
||||
ci['choco'].extend(os.environ['CHOCO'].split())
|
||||
|
||||
if 'APT' in os.environ:
|
||||
ci['apt'].extend(os.environ['APT'].split())
|
||||
@@ -764,16 +767,37 @@ def setup_for_build(args):
|
||||
if re.match('^test-results:', line):
|
||||
has_test_results = True
|
||||
|
||||
addpaths = []
|
||||
for path in args.paths:
|
||||
# apparently %CD% is handled automagically, so use getcwd() instead
|
||||
os.environ['TOP'] = os.getcwd()
|
||||
os.environ['MAKE'] = 'make'
|
||||
os.environ['EPICS_BASE'] = places['EPICS_BASE']
|
||||
|
||||
changed_vars = set()
|
||||
|
||||
for extra_env_var in args.extra_env_vars:
|
||||
try:
|
||||
addpaths.append(path.format(**os.environ))
|
||||
key_value = extra_env_var.split('=')
|
||||
key = key_value[0]
|
||||
value = key_value[1]
|
||||
expanded_value = value.format(**os.environ)
|
||||
|
||||
# Update the environment right now so later variables have access
|
||||
if key in os.environ:
|
||||
old_value = [os.environ[key]]
|
||||
else:
|
||||
old_value = []
|
||||
|
||||
os.environ[key] = os.pathsep.join(old_value + [expanded_value])
|
||||
changed_vars.add(key)
|
||||
except KeyError:
|
||||
print('Environment')
|
||||
[print(' ', K, '=', repr(V)) for K, V in os.environ.items()]
|
||||
raise
|
||||
|
||||
os.environ['PATH'] = os.pathsep.join([os.environ['PATH']] + addpaths)
|
||||
for key in changed_vars:
|
||||
print("{0}{2} = {3}{1}".format(ANSI_CYAN, ANSI_RESET, key, os.environ[key]))
|
||||
|
||||
# os.environ completely updated at this point
|
||||
|
||||
logger.debug('Final PATH')
|
||||
for loc in os.environ['PATH'].split(os.pathsep):
|
||||
@@ -784,9 +808,6 @@ def setup_for_build(args):
|
||||
is_make3 = True
|
||||
logger.debug('Check if make is a 3.x series: %s', is_make3)
|
||||
|
||||
# apparently %CD% is handled automagically
|
||||
os.environ['TOP'] = os.getcwd()
|
||||
|
||||
# Add EXTRA make arguments
|
||||
for tag in ['EXTRA', 'EXTRA1', 'EXTRA2', 'EXTRA3', 'EXTRA4', 'EXTRA5']:
|
||||
val = os.environ.get(tag, "")
|
||||
@@ -1352,8 +1373,6 @@ def test_results(args):
|
||||
def doExec(args):
|
||||
'exec user command with vcvars'
|
||||
setup_for_build(args)
|
||||
os.environ['MAKE'] = 'make'
|
||||
os.environ['EPICS_BASE'] = places['EPICS_BASE']
|
||||
fold_start('exec.command', 'Execute command {}'.format(args.cmd))
|
||||
sp.check_call(' '.join(args.cmd), shell=True)
|
||||
fold_end('exec.command', 'Execute command {}'.format(args.cmd))
|
||||
@@ -1423,8 +1442,10 @@ def getargs():
|
||||
p = ArgumentParser()
|
||||
p.add_argument('--no-vcvars', dest='vcvars', default=True, action='store_false',
|
||||
help='Assume vcvarsall.bat has already been run')
|
||||
p.add_argument('--add-path', dest='paths', default=[], action='append',
|
||||
help='Append directory to $PATH or %%PATH%%. Expands {ENVVAR}')
|
||||
p.add_argument('--add-path', dest='extra_env_vars', type=lambda x: "PATH={}".format(x), default=[], action='append',
|
||||
help='Append directory to $PATH or %%PATH%%. Expands {ENVVAR}. Equivalent to: "--add-env PATH=<PATHS>"')
|
||||
p.add_argument('--add-env', dest='extra_env_vars', default=[], action='append',
|
||||
help='Append directory to the specified $ENVVAR or %%ENVVAR%%. Expands {OTHER_ENVVAR}. Example: "--add-env \'LD_LIBRARY_PATH={EPICS_BASE}/lib/{EPICS_HOST_ARCH}\'"')
|
||||
p.add_argument('-T', '--timeout', type=timespec, metavar='DLY',
|
||||
help='Terminate make after delay. DLY interpreted as second, or may be qualified with "S", "M", or "H". (default no timeout)')
|
||||
subp = p.add_subparsers()
|
||||
|
||||
@@ -31,6 +31,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-18.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
@@ -68,7 +69,7 @@ jobs:
|
||||
name: "3.15 Ub-20 clang-10"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Prepare and compile dependencies
|
||||
|
||||
Reference in New Issue
Block a user