give conf.env.env to Popen in missing places

This commit is contained in:
Thomas Nagy 2011-12-25 11:11:44 +01:00
parent 3562008ffb
commit 5d31ae480a
5 changed files with 14 additions and 12 deletions

View File

@ -24,7 +24,7 @@ def build(bld):
doxyfile='test.conf',
doxy_tar='docs.tar.bz2')
else:
print('some kind of normal build')
print('Call "waf doxy" for building the documentation')
from waflib import Build
class doxy(Build.BuildContext):

View File

@ -1016,12 +1016,13 @@ def get_cc_version(conf, cc, gcc=False, icc=False):
The variables CC_VERSION, DEST_OS, DEST_BINFMT and DEST_CPU will be set in *conf.env*
"""
cmd = cc + ['-dM', '-E', '-']
env = conf.env.env or None
try:
p = Utils.subprocess.Popen(cmd, stdin=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE)
p = Utils.subprocess.Popen(cmd, stdin=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
p.stdin.write('\n'.encode())
out = p.communicate()[0]
except:
conf.fatal('could not determine the compiler version %r' % cmd)
conf.fatal('Could not determine the compiler version %r' % cmd)
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding)
@ -1038,8 +1039,6 @@ def get_cc_version(conf, cc, gcc=False, icc=False):
k = {}
if icc or gcc:
out = out.split('\n')
import shlex
for line in out:
lst = shlex.split(line)
if len(lst)>2:

View File

@ -327,12 +327,13 @@ def getoutput(conf, cmd, stdin=False):
"""
TODO a bit redundant, can be removed anytime
"""
if stdin:
stdin = Utils.subprocess.PIPE
else:
stdin = None
env = conf.env.env or None
try:
if stdin:
stdin = Utils.subprocess.PIPE
else:
stdin = None
p = Utils.subprocess.Popen(cmd, stdin=stdin, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE)
p = Utils.subprocess.Popen(cmd, stdin=stdin, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
if stdin:
p.stdin.write('\n'.encode())
stdout, stderr = p.communicate()

View File

@ -122,7 +122,8 @@ def install_pyfile(self, node, install_from=None):
(a, b, c) = (path, path + x, tsk.get_install_path(destdir=False) + x)
argv = self.env['PYTHON'] + lst + ['-c', INST, a, b, c]
info('+ byte compiling %r' % (path + x))
ret = Utils.subprocess.Popen(argv).wait()
env = self.env.env or None
ret = Utils.subprocess.Popen(argv, env=env).wait()
if ret:
raise Errors.WafError('py%s compilation failed %r' % (x, path))

View File

@ -87,7 +87,8 @@ class doxygen(Task.Task):
code = code.encode() # for python 3
#fmt = DOXY_STR % (self.inputs[0].parent.abspath())
cmd = Utils.subst_vars(DOXY_STR, self.env)
proc = Utils.subprocess.Popen(cmd, shell=True, stdin=Utils.subprocess.PIPE)
env = self.env.env or None
proc = Utils.subprocess.Popen(cmd, shell=True, stdin=Utils.subprocess.PIPE, env=env)
proc.communicate(code)
return proc.returncode