@@ -130,13 +130,35 @@ def execute(self, log, keyvals, testDef):
130
130
# check if we need to point to middleware
131
131
# do this before we load environment modules so we can append to the list if needed
132
132
midpath = False
133
+ try :
134
+ savebinpath = os .environ ['PATH' ]
135
+ except KeyError :
136
+ savebinpath = None
137
+ try :
138
+ savelibpath = os .environ ['LIBRARY_PATH' ]
139
+ except KeyError :
140
+ savelibpath = None
141
+ try :
142
+ savecpath = os .environ ['CPATH' ]
143
+ except KeyError :
144
+ savecpath = None
145
+ try :
146
+ saveldlibpath = os .environ ['LD_LIBRARY_PATH' ]
147
+ except KeyError :
148
+ saveldlibpath = None
133
149
try :
134
150
if cmds ['middleware' ] is not None :
135
151
# pass it down
136
152
log ['middleware' ] = cmds ['middleware' ]
137
- # get the log entry of its location
138
- midlog = testDef .logger .getLog (cmds ['middleware' ])
139
- if midlog is not None :
153
+ # there may be more than one middleware noted here
154
+ # so break it apart just in case
155
+ # might be comma-delimited or space delimited
156
+ mware = re .split ("\s|," , cmds ['middleware' ])
157
+ for m in mware :
158
+ # get the log entry of its location
159
+ midlog = testDef .logger .getLog (m )
160
+ if midlog is None :
161
+ continue
140
162
# get the location of the middleware
141
163
try :
142
164
if midlog ['location' ] is not None :
@@ -145,7 +167,6 @@ def execute(self, log, keyvals, testDef):
145
167
oldbinpath = os .environ ['PATH' ]
146
168
pieces = oldbinpath .split (':' )
147
169
except KeyError :
148
- oldbinpath = ""
149
170
pieces = []
150
171
bindir = os .path .join (midlog ['location' ], "bin" )
151
172
pieces .insert (0 , bindir )
@@ -156,7 +177,6 @@ def execute(self, log, keyvals, testDef):
156
177
oldldlibpath = os .environ ['LD_LIBRARY_PATH' ]
157
178
pieces = oldldlibpath .split (':' )
158
179
except KeyError :
159
- oldldlibpath = ""
160
180
pieces = []
161
181
bindir = os .path .join (midlog ['location' ], "lib" )
162
182
pieces .insert (0 , bindir )
@@ -167,7 +187,6 @@ def execute(self, log, keyvals, testDef):
167
187
oldcpath = os .environ ['CPATH' ]
168
188
pieces = oldcpath .split (':' )
169
189
except KeyError :
170
- oldcpath = ""
171
190
pieces = []
172
191
bindir = os .path .join (midlog ['location' ], "include" )
173
192
pieces .insert (0 , bindir )
@@ -178,7 +197,6 @@ def execute(self, log, keyvals, testDef):
178
197
oldlibpath = os .environ ['LIBRARY_PATH' ]
179
198
pieces = oldlibpath .split (':' )
180
199
except KeyError :
181
- oldlibpath = ""
182
200
pieces = []
183
201
bindir = os .path .join (midlog ['location' ], "lib" )
184
202
pieces .insert (0 , bindir )
@@ -290,7 +308,12 @@ def execute(self, log, keyvals, testDef):
290
308
# save the current directory so we can return to it
291
309
cwd = os .getcwd ()
292
310
# now move to the package location
293
- os .chdir (location )
311
+ try :
312
+ os .chdir (location )
313
+ except :
314
+ log ['status' ] = 1
315
+ return
316
+
294
317
# see if they want us to execute autogen
295
318
try :
296
319
if cmds ['autogen_cmd' ] is not None :
@@ -532,10 +555,34 @@ def execute(self, log, keyvals, testDef):
532
555
533
556
# if we added middleware to the paths, remove it
534
557
if midpath :
535
- os .environ ['PATH' ] = oldbinpath
536
- os .environ ['LD_LIBRARY_PATH' ] = oldldlibpath
537
- os .environ ['CPATH' ] = oldcpath
538
- os .environ ['LIBRARY_PATH' ] = oldlibpath
558
+ if savebinpath is None :
559
+ try :
560
+ del os .environ ['PATH' ]
561
+ except :
562
+ pass
563
+ else :
564
+ os .environ ['PATH' ] = savebinpath
565
+ if saveldlibpath is None :
566
+ try :
567
+ del os .environ ['LD_LIBRARY_PATH' ]
568
+ except :
569
+ pass
570
+ else :
571
+ os .environ ['LD_LIBRARY_PATH' ] = saveldlibpath
572
+ if savecpath is None :
573
+ try :
574
+ del os .environ ['CPATH' ]
575
+ except :
576
+ pass
577
+ else :
578
+ os .environ ['CPATH' ] = savecpath
579
+ if savelibpath is None :
580
+ try :
581
+ del os .environ ['LIBRARY_PATH' ]
582
+ except :
583
+ pass
584
+ else :
585
+ os .environ ['LIBRARY_PATH' ] = savelibpath
539
586
540
587
# Add confirmation that build is complete
541
588
try :
0 commit comments