[Scons-users] Bash + os.environ is an evil

Paweł Tomulik ptomulik at meil.pw.edu.pl
Fri Apr 4 09:45:59 EDT 2014


Not really a question, just want to share my today's experience.

This code

import os
env = Environment(ENV = os.environ)

can cause real headache. Especially if SCons is started under bash.

It appears, that os.environ may contain bash functions, for example:

{ 'module' : "() { eval `/usr/bin/modulecmd bash \$*`\n}", ... }

The effect is, that SCons executes these functions occasionally when
executing its actions, especially when configuring with SConf.

The possible workarounds are described here
http://stackoverflow.com/questions/20259568/is-there-a-way-in-python-to-check-whether-an-entry-to-os-environ-is-a-variable-o?rq=1

--
Paweł Tomulik



More information about the Scons-users mailing list