2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-12 05:10:40 +01:00

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', doxyfile='test.conf',
doxy_tar='docs.tar.bz2') doxy_tar='docs.tar.bz2')
else: else:
print('some kind of normal build') print('Call "waf doxy" for building the documentation')
from waflib import Build from waflib import Build
class doxy(Build.BuildContext): 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* The variables CC_VERSION, DEST_OS, DEST_BINFMT and DEST_CPU will be set in *conf.env*
""" """
cmd = cc + ['-dM', '-E', '-'] cmd = cc + ['-dM', '-E', '-']
env = conf.env.env or None
try: 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()) p.stdin.write('\n'.encode())
out = p.communicate()[0] out = p.communicate()[0]
except: 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): if not isinstance(out, str):
out = out.decode(sys.stdout.encoding) out = out.decode(sys.stdout.encoding)
@ -1038,8 +1039,6 @@ def get_cc_version(conf, cc, gcc=False, icc=False):
k = {} k = {}
if icc or gcc: if icc or gcc:
out = out.split('\n') out = out.split('\n')
import shlex
for line in out: for line in out:
lst = shlex.split(line) lst = shlex.split(line)
if len(lst)>2: if len(lst)>2:

View File

@ -327,12 +327,13 @@ def getoutput(conf, cmd, stdin=False):
""" """
TODO a bit redundant, can be removed anytime TODO a bit redundant, can be removed anytime
""" """
if stdin:
stdin = Utils.subprocess.PIPE
else:
stdin = None
env = conf.env.env or None
try: try:
if stdin: p = Utils.subprocess.Popen(cmd, stdin=stdin, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
stdin = Utils.subprocess.PIPE
else:
stdin = None
p = Utils.subprocess.Popen(cmd, stdin=stdin, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE)
if stdin: if stdin:
p.stdin.write('\n'.encode()) p.stdin.write('\n'.encode())
stdout, stderr = p.communicate() 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) (a, b, c) = (path, path + x, tsk.get_install_path(destdir=False) + x)
argv = self.env['PYTHON'] + lst + ['-c', INST, a, b, c] argv = self.env['PYTHON'] + lst + ['-c', INST, a, b, c]
info('+ byte compiling %r' % (path + x)) 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: if ret:
raise Errors.WafError('py%s compilation failed %r' % (x, path)) 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 code = code.encode() # for python 3
#fmt = DOXY_STR % (self.inputs[0].parent.abspath()) #fmt = DOXY_STR % (self.inputs[0].parent.abspath())
cmd = Utils.subst_vars(DOXY_STR, self.env) 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) proc.communicate(code)
return proc.returncode return proc.returncode