intltool: move some code outside a loop in intltool_in

It's fine to execute this code just one time since the environment
variables won't change throughout the different source files.
This commit is contained in:
Damián Nohales 2014-09-18 15:16:34 -03:00
parent 2b5cab25d0
commit c0314641b7
1 changed files with 14 additions and 14 deletions

View File

@ -71,23 +71,23 @@ def apply_intltool_in_f(self):
self.ensure_localedir()
podir = getattr(self, 'podir', '.')
podirnode = self.path.find_dir(podir)
if not podirnode:
error("could not find the podir %r" % podir)
return
cache = getattr(self, 'intlcache', '.intlcache')
self.env.INTLCACHE = [os.path.join(str(self.path.get_bld()), podir, cache)]
self.env.INTLPODIR = podirnode.bldpath()
self.env.INTLFLAGS = getattr(self, 'flags', self.env.INTLFLAGS_DEFAULT)
if '-c' in self.env.INTLFLAGS:
Logs.warn('Redundant -c flag in intltool task %r' % self)
self.env.INTLFLAGS.remove('-c')
for i in self.to_list(self.source):
node = self.path.find_resource(i)
podir = getattr(self, 'podir', '.')
podirnode = self.path.find_dir(podir)
if not podirnode:
error("could not find the podir %r" % podir)
continue
cache = getattr(self, 'intlcache', '.intlcache')
self.env.INTLCACHE = [os.path.join(str(self.path.get_bld()), podir, cache)]
self.env.INTLPODIR = podirnode.bldpath()
self.env.INTLFLAGS = getattr(self, 'flags', self.env.INTLFLAGS_DEFAULT)
if '-c' in self.env.INTLFLAGS:
Logs.warn('Redundant -c flag in intltool task %r' % self)
self.env.INTLFLAGS.remove('-c')
task = self.create_task('intltool', node, node.change_ext(''))
inst = getattr(self, 'install_path', None)
if inst: