MCPcopy Create free account
hub / github.com/boostorg/build / _getExternalEnv

Function _getExternalEnv

v2/test/configuration.py:280–316  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

278
279
280def _getExternalEnv(name):
281 toolsetName = "__myDummyToolset__"
282
283 t = BoostBuild.Tester(["toolset=%s" % toolsetName], pass_toolset=False,
284 use_test_config=False)
285 try:
286 # Prepare a dummy toolset so we do not get errors in case the default
287 # one is not found.
288 t.write(toolsetName + ".jam", """\
289import feature ;
290feature.extend toolset : %s ;
291rule init ( ) { }
292""" % toolsetName)
293
294 # Python version of the same dummy toolset.
295 t.write(toolsetName + ".py", """\
296from b2.build import feature
297feature.extend('toolset', ['%s'])
298def init(): pass
299""" % toolsetName)
300
301 t.write("jamroot.jam", """\
302import os ;
303local names = [ MATCH ^---var-name---=(.*) : [ modules.peek : ARGV ] ] ;
304for x in $(names)
305{
306 value = [ os.environ $(x) ] ;
307 ECHO "###" $(x): '$(value)' "###" ;
308}
309""")
310
311 t.run_build_system(["---var-name---=%s" % name])
312 m = re.search("^### %s: '(.*)' ###$" % name, t.stdout(), re.MULTILINE)
313 if m:
314 return m.group(1)
315 finally:
316 t.cleanup()
317
318
319###############################################################################

Callers 1

Calls 5

writeMethod · 0.95
run_build_systemMethod · 0.95
cleanupMethod · 0.95
searchMethod · 0.80
stdoutMethod · 0.80

Tested by

no test coverage detected