Bug 1269517 - Fix various environment variables that may contain posix-style paths when invoking the js subconfigure. r=glandium
MozReview-Commit-ID: IuxdjO2P9aQ
--- a/build/subconfigure.py
+++ b/build/subconfigure.py
@@ -201,26 +201,29 @@ def prepare(srcdir, objdir, shell, args)
if os.path.exists(data_file):
with open(data_file, 'rb') as f:
data = pickle.load(f)
previous_args = data['args']
# Msys likes to break environment variables and command line arguments,
# so read those from stdin, as they are passed from the configure script
# when necessary (on windows).
- # However, for some reason, $PATH is not handled like other environment
- # variables, and msys remangles it even when giving it is already a msys
- # $PATH. Fortunately, the mangling/demangling is just find for $PATH, so
- # we can just take the value from the environment. Msys will convert it
- # back properly when calling subconfigure.
input = sys.stdin.read()
if input:
data = {a: b for [a, b] in eval(input)}
environ = {a: b for a, b in data['env']}
- environ['PATH'] = os.environ['PATH']
+ # These environment variables as passed from old-configure may contain
+ # posix-style paths, which will not be meaningful to the js
+ # subconfigure, which runs as a native python process, so use their
+ # values from the environment. In the case of autoconf implemented
+ # subconfigures, Msys will re-convert them properly.
+ for var in ('HOME', 'TERM', 'PATH', 'TMPDIR', 'TMP',
+ 'TEMP', 'INCLUDE'):
+ if var in environ and var in os.environ:
+ environ[var] = os.environ[var]
args = data['args']
else:
environ = os.environ
args, others = parser.parse_known_args(args)
data = {
'target': args.target,