Pass a conf.env.env to check_cfg

This commit is contained in:
Thomas Nagy 2015-10-06 23:06:22 +02:00
parent 061f8e2b1d
commit 1fbac668cb
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
1 changed files with 9 additions and 9 deletions

View File

@ -6,7 +6,7 @@
C/C++/D configuration helpers
"""
import os, re, shlex, sys
import os, re, shlex
from waflib import Build, Utils, Task, Options, Logs, Errors, Runner
from waflib.TaskGen import after_method, feature
from waflib.Configure import conf
@ -288,7 +288,7 @@ def exec_cfg(self, kw):
"""
path = Utils.to_list(kw['path'])
env = self.env.env or None
def define_it():
pkgname = kw.get('uselib_store', kw['package'].upper())
if kw.get('global_define'):
@ -301,7 +301,7 @@ def exec_cfg(self, kw):
# pkg-config version
if 'atleast_pkgconfig_version' in kw:
cmd = path + ['--atleast-pkgconfig-version=%s' % kw['atleast_pkgconfig_version']]
self.cmd_and_log(cmd)
self.cmd_and_log(cmd, env=env)
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'
return
@ -310,7 +310,7 @@ def exec_cfg(self, kw):
for x in cfg_ver:
y = x.replace('-', '_')
if y in kw:
self.cmd_and_log(path + ['--%s=%s' % (x, kw[y]), kw['package']])
self.cmd_and_log(path + ['--%s=%s' % (x, kw[y]), kw['package']], env=env)
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'
define_it()
@ -318,7 +318,7 @@ def exec_cfg(self, kw):
# retrieving the version of a module
if 'modversion' in kw:
version = self.cmd_and_log(path + ['--modversion', kw['modversion']]).strip()
version = self.cmd_and_log(path + ['--modversion', kw['modversion']], env=env).strip()
self.define('%s_VERSION' % Utils.quote_define_name(kw.get('uselib_store', kw['modversion'])), version)
return version
@ -342,19 +342,19 @@ def exec_cfg(self, kw):
# retrieving variables of a module
if 'variables' in kw:
env = kw.get('env', self.env)
v = kw.get('env', self.env)
uselib = kw.get('uselib_store', kw['package'].upper())
vars = Utils.to_list(kw['variables'])
for v in vars:
val = self.cmd_and_log(lst + ['--variable=' + v]).strip()
val = self.cmd_and_log(lst + ['--variable=' + v], env=env).strip()
var = '%s_%s' % (uselib, v)
env[var] = val
v[var] = val
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'
return
# so we assume the command-line will output flags to be parsed afterwards
ret = self.cmd_and_log(lst)
ret = self.cmd_and_log(lst, env=env)
if not 'okmsg' in kw:
kw['okmsg'] = 'yes'