Skip to content

Commit cf5ddfd

Browse files
committed
dealing with undefined option variables.
1 parent 4209cc7 commit cf5ddfd

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

SConstruct

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,16 @@ if env['tools_names'] != ['default']:
249249
Help(vars.GenerateHelpText(env))
250250
# Check for superfluous options
251251
if len(vars.UnknownVariables())>0:
252+
APPROVED_VARIABLES = [ 'os', 'subprocess']
253+
DEL= ""
252254
for k in vars.UnknownVariables():
253-
print("Unknown option '%s'" % k)
254-
Exit(1)
255+
if not k in APPROVED_VARIABLES:
256+
print("Unknown option variable '%s'" % k)
257+
DEL+=k+", "
258+
if len(DEL)>0:
259+
print("Most likely these variables are set in the options file. Add the following statement to delete them:")
260+
print("\n del "+DEL[:-2]+"\n")
261+
Exit(1)
255262

256263
env['domains'] = sorted(set(env['domains']))
257264
#===== First thing we do is to install Trilinos if requested to do so:

scons/templates/README_FIRST

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ If you can't find a matching template file you can either import one that
2020
comes close or start from scratch and set the options as required. All
2121
recognised options are explained below.
2222

23+
Delete all variables that are not option variables. In some cases, variables
24+
that are introduced in option files and that are not option variables can trigger
25+
an error in scons.
26+
2327
Prefixes
2428
========
2529

scons/templates/homebrew_options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
escript_opts_version = 203
3131

3232
HOMEBREW_PREFIX = '/opt/homebrew'
33+
3334
pythoncmd = os.path.join(HOMEBREW_PREFIX, 'bin', 'python3')
3435
import subprocess
3536
p=subprocess.run([pythoncmd, '-V'], capture_output=True, text=True)
@@ -113,3 +114,5 @@
113114
ld_extra = ["-L/opt/homebrew/opt/llvm/lib", "-lz", "-Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" ]
114115

115116

117+
# clean up:
118+
del HOMEBREW_PREFIX, p, subversion, revversion, t

0 commit comments

Comments
 (0)