2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-23 02:16:01 +01:00

refactor the vapi_dirs flags processing

This commit is contained in:
Thomas Nagy 2012-04-07 14:48:45 +02:00
parent 1e083206af
commit bafd9c4417

View File

@ -24,13 +24,6 @@ class valac(Task.Task):
def run(self): def run(self):
cmd = [self.env['VALAC']] + self.env['VALAFLAGS'] cmd = [self.env['VALAC']] + self.env['VALAFLAGS']
for vapi_dir in self.vapi_dirs:
cmd.append('--vapidir=%s' % vapi_dir)
for package in self.generator.packages:
cmd.append('--pkg=%s' % package)
cmd.extend([a.abspath() for a in self.inputs]) cmd.extend([a.abspath() for a in self.inputs])
ret = self.exec_command(cmd, cwd=self.outputs[0].parent.abspath()) ret = self.exec_command(cmd, cwd=self.outputs[0].parent.abspath())
@ -115,7 +108,6 @@ def init_vala_task(self):
self.includes = Utils.to_list(getattr(self, 'includes', [])) self.includes = Utils.to_list(getattr(self, 'includes', []))
self.uselib = self.to_list(getattr(self, 'uselib', [])) self.uselib = self.to_list(getattr(self, 'uselib', []))
valatask.vapi_dirs = []
valatask.install_path = getattr(self, 'install_path', '') valatask.install_path = getattr(self, 'install_path', '')
valatask.vapi_path = getattr(self, 'vapi_path', '${DATAROOTDIR}/vala/vapi') valatask.vapi_path = getattr(self, 'vapi_path', '${DATAROOTDIR}/vala/vapi')
@ -124,7 +116,7 @@ def init_vala_task(self):
valatask.install_binding = getattr(self, 'install_binding', True) valatask.install_binding = getattr(self, 'install_binding', True)
self.packages = packages = Utils.to_list(getattr(self, 'packages', [])) self.packages = packages = Utils.to_list(getattr(self, 'packages', []))
vapi_dirs = Utils.to_list(getattr(self, 'vapi_dirs', [])) self.vapi_dirs = vapi_dirs = Utils.to_list(getattr(self, 'vapi_dirs', []))
includes = [] includes = []
if hasattr(self, 'use'): if hasattr(self, 'use'):
@ -161,20 +153,21 @@ def init_vala_task(self):
lst.reverse() lst.reverse()
local_packages = [pkg for pkg in lst if pkg not in seen] + local_packages local_packages = [pkg for pkg in lst if pkg not in seen] + local_packages
for vapi_dir in vapi_dirs: addflags(['--pkg=%s' % p for p in packages])
try:
valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath())
valatask.vapi_dirs.append(self.path.find_dir(vapi_dir).get_bld().abspath())
except AttributeError:
Logs.warn("Unable to locate Vala API directory: '%s'" % vapi_dir)
for vapi_dir in vapi_dirs:
v_node = self.path.find_dir(vapi_dir)
if not v_node:
Logs.warn('Unable to locate Vala API directory: %r' % vapi_dir)
else:
addflags('--vapidir=%s' % v_node.abspath())
addflags('--vapidir=%s' % v_node.get_bld().abspath())
self.dump_deps_node = None self.dump_deps_node = None
if self.is_lib and self.packages: if self.is_lib and self.packages:
self.dump_deps_node = self.path.find_or_declare('%s.deps' % self.target) self.dump_deps_node = self.path.find_or_declare('%s.deps' % self.target)
valatask.outputs.append(self.dump_deps_node) valatask.outputs.append(self.dump_deps_node)
self.includes.append(self.bld.srcnode.abspath()) self.includes.append(self.bld.srcnode.abspath())
self.includes.append(self.bld.bldnode.abspath()) self.includes.append(self.bld.bldnode.abspath())
for include in includes: for include in includes: