Example #1
0
    def __init__(self, action="yasha -o $TARGET $SOURCE"):
        def scan(node, env, path):
            src = str(node.srcnode())
            src_dir = os.path.dirname(src)
            variant_dir = os.path.dirname(str(node))

            cmd = action.replace('$SOURCE', src)
            cmd = ['-M'] + cmd.split()[1:]

            try:  # Remove $TARGET from action
                index = cmd.index('-o')
                del cmd[index]
                del cmd[index]
            except ValueError:
                pass

            runner = CliRunner()
            result = runner.invoke(cli.cli, cmd)

            deps = result.output[:-1].split(" ")[2:]
            deps = [d.replace(src_dir, variant_dir) for d in deps]

            return env.File(deps)

        def emit(target, source, env):
            env.Clean(target[0], str(target[0]) + ".d")
            return target, source

        from SCons.Scanner import Scanner
        from SCons.Action import Action
        BuilderBase.__init__(self,
                             action=Action(action),
                             emitter=emit,
                             source_scanner=Scanner(function=scan),
                             single_source=True)
Example #2
0
    def __init__(self, jinja_loader, context={}):
        BuilderBase.__init__(self,
                             action=Action(self.jinja_action),
                             src_suffix='.jinja',
                             suffix='')

        self.jinja_env = jinjatools.Environment(loader=jinja_loader)
        self.jinja_template_context = context
Example #3
0
 def __init__(self, builder):
     BuilderBase.__init__(self, 
                          action=builder.action,
                          emitter=builder.emitter,
                          prefix=builder.prefix,
                          suffix=builder.suffix,
                          src_suffix=builder.src_suffix,
                          src_builder=builder.src_builder)
Example #4
0
 def __init__(self, env, **kw):
     if not 'suffix' in kw:
         kw['suffix'] = '$POSUFFIX'
     if not 'src_suffix' in kw:
         kw['src_suffix'] = '$POTSUFFIX'
     if not 'src_builder' in kw:
         kw['src_builder'] = '_POTUpdateBuilder'
     if not 'single_source' in kw:
         kw['single_source'] = True
     alias = None
     if 'target_alias' in kw:
         alias = kw['target_alias']
         del kw['target_alias']
     if not 'target_factory' in kw:
         kw['target_factory'] = _POTargetFactory(env, alias=alias).File
     BuilderBase.__init__(self, **kw)
Example #5
0
 def __init__(self, env, **kw):
     if 'suffix' not in kw:
         kw['suffix'] = '$POSUFFIX'
     if 'src_suffix' not in kw:
         kw['src_suffix'] = '$POTSUFFIX'
     if 'src_builder' not in kw:
         kw['src_builder'] = '_POTUpdateBuilder'
     if 'single_source' not in kw:
         kw['single_source'] = True
     alias = None
     if 'target_alias' in kw:
         alias = kw['target_alias']
         del kw['target_alias']
     if 'target_factory' not in kw:
         kw['target_factory'] = _POTargetFactory(env, alias=alias).File
     BuilderBase.__init__(self, **kw)
 def __init__(self, env, **kw):
     if not "suffix" in kw:
         kw["suffix"] = "$POSUFFIX"
     if not "src_suffix" in kw:
         kw["src_suffix"] = "$POTSUFFIX"
     if not "src_builder" in kw:
         kw["src_builder"] = "_POTUpdateBuilder"
     if not "single_source" in kw:
         kw["single_source"] = True
     alias = None
     if "target_alias" in kw:
         alias = kw["target_alias"]
         del kw["target_alias"]
     if not "target_factory" in kw:
         kw["target_factory"] = _POTargetFactory(env, alias=alias).File
     BuilderBase.__init__(self, **kw)
Example #7
0
    def __init__(self, action="yasha $SOURCE -o $TARGET"):
        def scan(node, env, path):
            src = str(node.srcnode())
            src_dir = os.path.dirname(src)
            variant_dir = os.path.dirname(str(node))

            cli_command = [src, "-M"]
            extensions = re.search(r"(-e|--extensions)\s*(.+)", action)
            variables = re.search(r"(-v|--variables)\s*(.+)", action)

            if extensions:
                cli_command += ["-e", extensions.group(2)]
            if variables:
                cli_command += ["-v", extensions.group(2)]
            if re.match(r"--no-variables", action):
                cli_command += ["--no-variables"]
            if re.match(r"--no-extensions", action):
                cli_command += ["--no-extensions"]

            runner = CliRunner()
            result = runner.invoke(yasha.cli, cli_command)

            deps = result.output[:-1].split(" ")[2:]
            deps = [d.replace(src_dir, variant_dir) for d in deps]
            return env.File(deps)

        def emit(target, source, env):
            env.Clean(target[0], str(target[0]) + ".d")
            return target, source

        from SCons.Scanner import Scanner
        from SCons.Action import Action
        BuilderBase.__init__(self,
                             action=Action(action),
                             emitter=emit,
                             source_scanner=Scanner(function=scan),
                             single_source=True
                             )
Example #8
0
    def __init__(self, action="yasha $SOURCE -o $TARGET"):
        def scan(node, env, path):
            src = str(node.srcnode())
            src_dir = os.path.dirname(src)
            variant_dir = os.path.dirname(str(node))

            cli_command = [src, "-M"]
            extensions = re.search(r"(-e|--extensions)\s*(.+)", action)
            variables = re.search(r"(-v|--variables)\s*(.+)", action)

            if extensions:
                cli_command += ["-e", extensions.group(2)]
            if variables:
                cli_command += ["-v", extensions.group(2)]
            if re.match(r"--no-variables", action):
                cli_command += ["--no-variable-file"]
            if re.match(r"--no-extensions", action):
                cli_command += ["--no-extension-file"]

            runner = CliRunner()
            result = runner.invoke(cli.cli, cli_command)

            deps = result.output[:-1].split(" ")[2:]
            deps = [d.replace(src_dir, variant_dir) for d in deps]
            return env.File(deps)

        def emit(target, source, env):
            env.Clean(target[0], str(target[0]) + ".d")
            return target, source

        from SCons.Scanner import Scanner
        from SCons.Action import Action
        BuilderBase.__init__(self,
                             action=Action(action),
                             emitter=emit,
                             source_scanner=Scanner(function=scan),
                             single_source=True)
    def __init__(self, jinja_loader, context={}):
        BuilderBase.__init__(self, action=Action(self.jinja_action), src_suffix=".jinja", suffix="")

        self.jinja_env = jinjatools.Environment(loader=jinja_loader)
        self.jinja_template_context = context