Beispiel #1
0
    def _execute(self, env, target, source, *args, **kw):
        """ Execute builder's actions.

        Here we append to `target` the languages read from `$LINGUAS_FILE` and
        apply `SCons.Builder.BuilderBase._execute()` separatelly to each target.
        The arguments and return value are same as for
        `SCons.Builder.BuilderBase._execute()`.
        """
        import SCons.Node
        linguas_files = None
        if 'LINGUAS_FILE' in env and env['LINGUAS_FILE']:
            linguas_files = env['LINGUAS_FILE']
            # This prevents endless recursion loop (we'll be invoked once for
            # each target appended here, we must not extend the list again).
            env['LINGUAS_FILE'] = None
            linguas = _read_linguas_from_files(env, linguas_files)
            if SCons.Util.is_List(target):
                target.extend(linguas)
            elif target is not None:
                target = [target] + linguas
            else:
                target = linguas
        if not target:
            # Let the SCons.BuilderBase to handle this patologic situation
            return BuilderBase._execute(self, env, target, source, *args, **kw)
        # The rest is ours
        if not SCons.Util.is_List(target):
            target = [target]
        result = []
        for tgt in target:
            r = BuilderBase._execute(self, env, [tgt], source, *args, **kw)
            result.extend(r)
        if linguas_files is not None:
            env['LINGUAS_FILE'] = linguas_files
        return SCons.Node.NodeList(result)
Beispiel #2
0
 def _execute(self, env, target, source, *args):
   if not target:
     if env.has_key('POTDOMAIN') and env['POTDOMAIN']:
       domain = env['POTDOMAIN']
     else:
       domain = 'messages'
     target = [ domain ]
   return BuilderBase._execute(self, env, target, source, *args)
Beispiel #3
0
 def _execute(self, env, target, source, *args):
     if not target:
         if env.has_key("POTDOMAIN") and env["POTDOMAIN"]:
             domain = env["POTDOMAIN"]
         else:
             domain = "messages"
         target = [domain]
     return BuilderBase._execute(self, env, target, source, *args)
    def _execute(self, env, target, source, *args, **kw):
        """ Execute builder's actions.
    
    Here we append to `target` the languages read from `$LINGUAS_FILE` and 
    apply `SCons.Builder.BuilderBase._execute()` separatelly to each target.
    The arguments and return value are same as for
    `SCons.Builder.BuilderBase._execute()`. 
    """
        import SCons.Util
        import SCons.Node

        linguas_files = None
        if env.has_key("LINGUAS_FILE") and env["LINGUAS_FILE"]:
            linguas_files = env["LINGUAS_FILE"]
            # This prevents endless recursion loop (we'll be invoked once for
            # each target appended here, we must not extend the list again).
            env["LINGUAS_FILE"] = None
            linguas = _read_linguas_from_files(env, linguas_files)
            if SCons.Util.is_List(target):
                target.extend(linguas)
            elif target is not None:
                target = [target] + linguas
            else:
                target = linguas
        if not target:
            # Let the SCons.BuilderBase to handle this patologic situation
            return BuilderBase._execute(self, env, target, source, *args, **kw)
        # The rest is ours
        if not SCons.Util.is_List(target):
            target = [target]
        result = []
        for tgt in target:
            r = BuilderBase._execute(self, env, [tgt], source, *args, **kw)
            result.extend(r)
        if linguas_files is not None:
            env["LINGUAS_FILE"] = linguas_files
        return SCons.Node.NodeList(result)
Beispiel #5
0
    def _execute(self, env, target, source, *args, **kw):
        # Here we add support for 'LINGUAS_FILE' keyword. Emitter is not suitable
        # in this case, as it is called too late (after multiple sources
        # are handled single_source builder.

        linguas_files = None
        if 'LINGUAS_FILE' in env and env['LINGUAS_FILE'] is not None:
            linguas_files = env['LINGUAS_FILE']
            # This should prevent from endless recursion.
            env['LINGUAS_FILE'] = None
            # We read only languages. Suffixes shall be added automatically.
            linguas = _read_linguas_from_files(env, linguas_files)
            if SCons.Util.is_List(source):
                source.extend(linguas)
            elif source is not None:
                source = [source] + linguas
            else:
                source = linguas
        result = BuilderBase._execute(self, env, target, source, *args, **kw)
        if linguas_files is not None:
            env['LINGUAS_FILE'] = linguas_files
        return result
 def _execute(self, env, target, source, *args, **kw):
   # Here we add support for 'LINGUAS_FILE' keyword. Emitter is not suitable
   # in this case, as it is called too late (after multiple sources
   # are handled single_source builder.
   import SCons.Util
   from SCons.Tool.GettextCommon import _read_linguas_from_files
   linguas_files = None
   if env.has_key('LINGUAS_FILE') and env['LINGUAS_FILE'] is not None:
     linguas_files = env['LINGUAS_FILE']
     # This should prevent from endless recursion. 
     env['LINGUAS_FILE'] = None
     # We read only languages. Suffixes shall be added automatically.
     linguas = _read_linguas_from_files(env, linguas_files)
     if SCons.Util.is_List(source):
       source.extend(linguas)
     elif source is not None:
       source = [source] + linguas
     else:
       source = linguas
   result = BuilderBase._execute(self,env,target,source,*args, **kw)
   if linguas_files is not None:
     env['LINGUAS_FILE'] = linguas_files
   return result
Beispiel #7
0
 def _execute(self, env, target, source, ow={}, exec_kw={}):
     """
     Override _execute() to remove C header files from the sources list
     """
     sources = BuilderBase._execute(self, env, target,source, ow, exec_kw)
     return [x for x in sources if is_c_file(x)]
Beispiel #8
0
 def _execute(self, env, target, source, ow={}, exec_kw={}):
     """
     Override _execute() to remove C header files from the sources list
     """
     sources = BuilderBase._execute(self, env, target, source, ow, exec_kw)
     return [x for x in sources if is_c_file(x)]