本文整理汇总了Python中SCons.Builder.BuilderBase类的典型用法代码示例。如果您正苦于以下问题:Python BuilderBase类的具体用法?Python BuilderBase怎么用?Python BuilderBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BuilderBase类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: __init__
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)
示例3: _execute
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)
示例4: _execute
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)
示例5: __call__
def __call__(self, env, target=None, source=None, chdir=_null, **kw):
"Override __call__ from the base class to register the target library."
Debug("_LibraryBuilder.__call__ for target(%s)" % (target), env)
ret = BuilderBase.__call__(self, env, target, source, chdir, **kw)
if target:
env.AddLibraryTarget(target, ret)
else:
Debug("library builder returned None!", env)
return ret
示例6: __init__
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
)
示例7: _execute
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)
示例8: _execute
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
示例9: _execute
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)]
示例10: __init__
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