@@ -25,6 +25,10 @@ with open(sys.argv[2], 'w') as f:
25
25
# now we need to generate a good file
26
26
printchplenv = os .path .join (chpl_home , 'util/printchplenv' )
27
27
28
+ # this defines the order of the variables printchplbuilds might print
29
+ # we fill in the values from the output of printchplenv, if they exist
30
+ # depending on the configuration, not all may be printed by printchplbuilds
31
+ # for this reason, we can specify a filter function that will be called with the chplenv dict
28
32
chpl_vars = [
29
33
("CHPL_TARGET_PLATFORM" , None ),
30
34
("CHPL_TARGET_COMPILER" , None ),
@@ -34,12 +38,15 @@ chpl_vars = [
34
38
("CHPL_COMM" , None ),
35
39
("CHPL_COMM_SUBSTRATE" , None ),
36
40
("CHPL_GASNET_SEGMENT" , None ),
41
+ ("CHPL_LIBFABRIC" , None , lambda env : env ["CHPL_COMM" ] == "ofi" ),
42
+ ("CHPL_COMM_OFI_OOB" , None , lambda env : env ["CHPL_COMM" ] == "ofi" ),
37
43
("CHPL_TASKS" , None ),
38
44
("CHPL_TIMERS" , None ),
39
45
("CHPL_UNWIND" , None ),
40
46
("CHPL_MEM" , None ),
41
47
("CHPL_ATOMICS" , None ),
42
48
("CHPL_HWLOC" , None ),
49
+ ("CHPL_HWLOC_PCI" , None , lambda env : env ["CHPL_HWLOC" ] == "bundled" ),
43
50
("CHPL_RE2" , None ),
44
51
("CHPL_AUX_FILESYS" , None ),
45
52
("CHPL_LIB_PIC" , None ),
@@ -48,13 +55,15 @@ chpl_vars = [
48
55
chplenv_out = [l .strip () for l in sp .check_output ([printchplenv , "--all" , "--internal" , "--simple" ]).decode ().splitlines ()]
49
56
chplenv = {k : v for k , v in [l .split ("=" , 1 ) for l in chplenv_out ]}
50
57
51
- # fill in the chplvars
52
- for i , (k , v ) in enumerate (chpl_vars ):
53
- if not v :
58
+ # fill in the chplvars, checking the filter function if it exists
59
+ for i , cv in enumerate (chpl_vars ):
60
+ k , v = cv [:2 ]
61
+ if not v and (len (cv ) < 3 or cv [2 ](chplenv )):
54
62
chpl_vars [i ] = (k , chplenv .get (k , "NA" ))
55
63
56
64
# write the good file
57
65
goodfile = os .path .splitext (__file__ )[0 ] + ".good"
58
66
with open (goodfile , 'w' ) as f :
59
67
print ("<Current>" , file = f )
60
- print ("\n " .join ([f"{ k } : { v } " for k , v in chpl_vars ]), file = f )
68
+ # only print the variables that have a value
69
+ print ("\n " .join ([f"{ cv [0 ]} : { cv [1 ]} " for cv in chpl_vars if cv [1 ]]), file = f )
0 commit comments