Skip to content

Commit fe1e31e

Browse files
mdavidsaverralphlange
authored andcommitted
more "" environment variable handling
Enforce equivalence between unset and set to empty string for some more environment variables. Also, stricter validation of $WINE
1 parent b2b4e77 commit fe1e31e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

cue.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,11 @@ def update_release_local(var, location):
431431
def set_setup_from_env(dep):
432432
for postf in ['', '_DIRNAME', '_REPONAME', '_REPOOWNER', '_REPOURL',
433433
'_VARNAME', '_RECURSIVE', '_DEPTH', '_HOOK']:
434-
if dep + postf in os.environ:
435-
setup[dep + postf] = os.environ[dep + postf]
436-
logger.debug('ENV assignment: %s = %s', dep + postf, setup[dep + postf])
434+
env = dep + postf
435+
val = os.environ.get(env)
436+
if val:
437+
setup[env] = val
438+
logger.debug('ENV assignment: %s = %s', env, setup[env])
437439

438440

439441
def call_git(args, **kws):
@@ -863,9 +865,8 @@ def handle_old_cross_variables():
863865
os.environ["CI_CROSS_TARGETS"] = ""
864866

865867
if "RTEMS" in os.environ:
866-
if 'RTEMS_TARGET' in os.environ:
867-
rtems_target = os.environ['RTEMS_TARGET']
868-
else:
868+
rtems_target = os.environ.get('RTEMS_TARGET')
869+
if not rtems_target:
869870
if os.environ['RTEMS'] == '5':
870871
rtems_target = 'RTEMS-pc686-qemu'
871872
else:
@@ -889,8 +890,10 @@ def handle_old_cross_variables():
889890
if "WINE" in os.environ:
890891
if os.environ['WINE'] == '32':
891892
new_cross_target = ":win32-x86-mingw"
892-
else:
893+
elif os.environ['WINE'] == '64':
893894
new_cross_target = ":windows-x64-mingw"
895+
else:
896+
raise RuntimeError("Invalid $WINE, must be 32/64")
894897
os.environ["CI_CROSS_TARGETS"] += new_cross_target
895898

896899
print(

0 commit comments

Comments
 (0)