本文整理汇总了Python中b2.manager.get_manager函数的典型用法代码示例。如果您正苦于以下问题:Python get_manager函数的具体用法?Python get_manager怎么用?Python get_manager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_manager函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: install
def install(name, sources, requirements=[], default_build=[], usage_requirements=[]):
requirements = requirements[:]
# Unless the user has explicitly asked us to hardcode dll paths, add
# <hardcode-dll-paths>false in requirements, to override default value.
if not "<hardcode-dll-paths>true" in requirements:
requirements.append("<hardcode-dll-paths>false")
if any(r.startswith("<tag>") for r in requirements):
get_manager().errors()("The <tag> property is not allowed for the 'install' rule")
from b2.manager import get_manager
t = get_manager().targets()
project = get_manager().projects().current()
return t.main_target_alternative(
InstallTargetClass(
name,
project,
t.main_target_sources(sources, name),
t.main_target_requirements(requirements, project),
t.main_target_default_build(default_build, project),
t.main_target_usage_requirements(usage_requirements, project),
)
)
开发者ID:Bandeira,项目名称:sps,代码行数:27,代码来源:stage.py
示例2: make_test
def make_test(target_type, sources, requirements, target_name=None):
if not target_name:
target_name = stem(os.path.basename(sources[0]))
# Having periods (".") in the target name is problematic because the typed
# generator will strip the suffix and use the bare name for the file
# targets. Even though the location-prefix averts problems most times it
# does not prevent ambiguity issues when referring to the test targets. For
# example when using the XML log output. So we rename the target to remove
# the periods, and provide an alias for users.
real_name = target_name.replace(".", "~")
project = get_manager().projects().current()
# The <location-prefix> forces the build system for generate paths in the
# form '$build_dir/array1.test/gcc/debug'. This is necessary to allow
# post-processing tools to work.
t = get_manager().targets().create_typed_target(
type.type_from_rule_name(target_type), project, real_name, sources,
requirements + ["<location-prefix>" + real_name + ".test"], [], [])
# The alias to the real target, per period replacement above.
if real_name != target_name:
get_manager().projects().project_rules().all_names_["alias"](
target_name, [t])
# Remember the test (for --dump-tests). A good way would be to collect all
# given a project. This has some technical problems: e.g. we can not call
# this dump from a Jamfile since projects referred by 'build-project' are
# not available until the whole Jamfile has been loaded.
__all_tests.append(t)
return t
开发者ID:ash-github,项目名称:FatCat-Server,代码行数:32,代码来源:testing.py
示例3: __ensure_type
def __ensure_type (targets):
""" Ensures all 'targets' have types. If this is not so, exists with
error.
"""
for t in targets:
if not t.type ():
get_manager().errors()("target '%s' has no type" % str (t))
开发者ID:vidjogamer,项目名称:ProjectTemplate,代码行数:7,代码来源:generators.py
示例4: process
def process (self, target, matches, binding):
angle = regex.transform (matches, "<(.*)>")
quoted = regex.transform (matches, '"(.*)"')
g = str(id(self))
b = os.path.normpath(os.path.dirname(binding[0]))
# Attach binding of including file to included targets.
# When target is directly created from virtual target
# this extra information is unnecessary. But in other
# cases, it allows to distinguish between two headers of the
# same name included from different places.
# We don't need this extra information for angle includes,
# since they should not depend on including file (we can't
# get literal "." in include path).
g2 = g + "#" + b
g = "<" + g + ">"
g2 = "<" + g2 + ">"
angle = [g + x for x in angle]
quoted = [g2 + x for x in quoted]
all = angle + quoted
bjam.call("mark-included", target, all)
engine = get_manager().engine()
engine.set_target_variable(angle, "SEARCH", get_value(self.includes_))
engine.set_target_variable(quoted, "SEARCH", [b] + get_value(self.includes_))
# Just propagate current scanner to includes, in a hope
# that includes do not change scanners.
get_manager().scanners().propagate(self, angle + quoted)
开发者ID:Beman,项目名称:build,代码行数:33,代码来源:builtin.py
示例5: __validate1
def __validate1 (property):
""" Exit with error if property is not valid.
"""
msg = None
f = get_grist (property)
if f:
value = get_value (property)
if not feature.valid (f):
f = ungrist (get_grist (property)) # Ungrist for better error messages
msg = "Unknown feature '%s'" % f
elif value and not 'free' in feature.attributes (f):
feature.validate_value_string (f, value)
elif not value:
f = ungrist (get_grist (property)) # Ungrist for better error messages
msg = "No value specified for feature '%s'" % f
else:
f = feature.implied_feature (property)
feature.validate_value_string (f, property)
if msg:
# FIXME: don't use globals like this. Import here to
# break circular dependency.
from b2.manager import get_manager
get_manager().errors()("Invalid property '%s': %s" % (property, msg))
开发者ID:elemel,项目名称:boost-python,代码行数:29,代码来源:property.py
示例6: lib
def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]):
"""The implementation of the 'lib' rule. Beyond standard syntax that rule allows
simplified: 'lib a b c ;'."""
if len(names) > 1:
if any(r.startswith('<name>') for r in requirements):
get_manager().errors()("When several names are given to the 'lib' rule\n" +
"it is not allowed to specify the <name> feature.")
if sources:
get_manager().errors()("When several names are given to the 'lib' rule\n" +
"it is not allowed to specify sources.")
project = get_manager().projects().current()
result = []
for name in names:
r = requirements[:]
# Support " lib a ; " and " lib a b c ; " syntax.
if not sources and not any(r.startswith("<name>") for r in requirements) \
and not any(r.startswith("<file") for r in requirements):
r.append("<name>" + name)
result.append(targets.create_typed_metatarget(name, "LIB", sources,
r,
default_build,
usage_requirements))
return result
开发者ID:Beman,项目名称:build,代码行数:29,代码来源:builtin.py
示例7: process
def process(self, target, matches, binding):
target_path = os.path.normpath(os.path.dirname(binding[0]))
bjam.call("mark-included", target, matches)
get_manager().engine().set_target_variable(matches, "SEARCH", [target_path] + self.includes)
get_manager().scanners().propagate(self, matches)
开发者ID:devJunpark,项目名称:PJHEngine,代码行数:7,代码来源:scanner.py
示例8: reverse
def reverse(path):
"""Returns path2 such that `os.path.join(path, path2) == '.'`.
`path` may not contain '..' or be rooted.
Args:
path (str): the path to reverse
Returns:
the string of the reversed path
Example:
>>> p1 = 'path/to/somewhere'
>>> p2 = reverse('path/to/somewhere')
>>> p2
'../../..'
>>> os.path.normpath(os.path.join(p1, p2))
'.'
"""
if is_rooted(path) or '..' in path:
from b2.manager import get_manager
get_manager().errors()(
'reverse(path): path is either rooted or contains ".." in the path')
if path == '.':
return path
path = os.path.normpath(path)
# os.sep.join() is being used over os.path.join() due
# to an extra '..' that is created by os.path.join()
return os.sep.join('..' for t in path.split(os.sep))
开发者ID:DesignD,项目名称:build,代码行数:29,代码来源:path.py
示例9: determine_output_name
def determine_output_name(self, sources):
"""Determine the name of the produced target from the
names of the sources."""
assert is_iterable_typed(sources, virtual_target.VirtualTarget)
# The simple case if when a name
# of source has single dot. Then, we take the part before
# dot. Several dots can be caused by:
# - Using source file like a.host.cpp
# - A type which suffix has a dot. Say, we can
# type 'host_cpp' with extension 'host.cpp'.
# In the first case, we want to take the part till the last
# dot. In the second case -- no sure, but for now take
# the part till the last dot too.
name = os.path.splitext(sources[0].name())[0]
for s in sources[1:]:
n2 = os.path.splitext(s.name())
if n2 != name:
get_manager().errors()(
"%s: source targets have different names: cannot determine target name"
% (self.id_))
# Names of sources might include directory. We should strip it.
return self.determine_target_name(sources[0].name())
开发者ID:zjutjsj1004,项目名称:third,代码行数:25,代码来源:generators.py
示例10: register
def register(type, suffixes=[], base_type=None):
""" Registers a target type, possibly derived from a 'base-type'.
If 'suffixes' are provided, they list all the suffixes that mean a file is of 'type'.
Also, the first element gives the suffix to be used when constructing and object of
'type'.
type: a string
suffixes: None or a sequence of strings
base_type: None or a string
"""
# Type names cannot contain hyphens, because when used as
# feature-values they will be interpreted as composite features
# which need to be decomposed.
if __re_hyphen.search(type):
raise BaseException('type name "%s" contains a hyphen' % type)
# it's possible for a type to be registered with a
# base type that hasn't been registered yet. in the
# check for base_type below and the following calls to setdefault()
# the key `type` will be added to __types. When the base type
# actually gets registered, it would fail after the simple check
# of "type in __types"; thus the check for "'base' in __types[type]"
if type in __types and "base" in __types[type]:
raise BaseException('Type "%s" is already registered.' % type)
entry = __types.setdefault(type, {})
entry["base"] = base_type
entry.setdefault("derived", [])
entry.setdefault("scanner", None)
if base_type:
__types.setdefault(base_type, {}).setdefault("derived", []).append(type)
if len(suffixes) > 0:
# Generated targets of 'type' will use the first of 'suffixes'
# (this may be overriden)
set_generated_target_suffix(type, [], suffixes[0])
# Specify mapping from suffixes to type
register_suffixes(suffixes, type)
feature.extend("target-type", [type])
feature.extend("main-target-type", [type])
feature.extend("base-target-type", [type])
if base_type:
feature.compose("<target-type>" + type, [replace_grist(base_type, "<base-target-type>")])
feature.compose("<base-target-type>" + type, ["<base-target-type>" + base_type])
import b2.build.generators as generators
# Adding a new derived type affects generator selection so we need to
# make the generator selection module update any of its cached
# information related to a new derived type being defined.
generators.update_cached_information_with_a_new_type(type)
# FIXME: resolving recursive dependency.
from b2.manager import get_manager
get_manager().projects().project_rules().add_rule_for_type(type)
开发者ID:boostorg,项目名称:build,代码行数:59,代码来源:type.py
示例11: inherit
def inherit(toolset, base):
assert isinstance(toolset, basestring)
assert isinstance(base, basestring)
get_manager().projects().load_module(base, ['.']);
inherit_generators(toolset, [], base)
inherit_flags(toolset, base)
inherit_rules(toolset, base)
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:8,代码来源:toolset.py
示例12: handle_input_files
def handle_input_files(input_files):
if len(input_files) > 1:
# Check that sorting made when creating property-set instance will not
# change the ordering.
if sorted(input_files) != input_files:
get_manager().errors()("Names of input files must be sorted alphabetically\n" +
"due to internal limitations")
return ["<testing.input-file>" + f for f in input_files]
开发者ID:ash-github,项目名称:FatCat-Server,代码行数:8,代码来源:testing.py
示例13: option
def option(self, name, value):
assert is_iterable(name) and isinstance(name[0], basestring)
assert is_iterable(value) and isinstance(value[0], basestring)
name = name[0]
if not name in ["site-config", "user-config", "project-config"]:
get_manager().errors()("The 'option' rule may be used only in site-config or user-config")
option.set(name, value[0])
开发者ID:Cabriter,项目名称:abelkhan,代码行数:8,代码来源:project.py
示例14: set_default
def set_default(self, value):
assert isinstance(value, basestring)
for attr in ('free', 'optional'):
if getattr(self, attr):
get_manager().errors()('"{}" feature "<{}>" cannot have a default value.'
.format(attr, self.name))
self.default = value
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:8,代码来源:feature.py
示例15: __ensure_type
def __ensure_type (targets):
""" Ensures all 'targets' have types. If this is not so, exists with
error.
"""
assert is_iterable_typed(targets, virtual_target.VirtualTarget)
for t in targets:
if not t.type ():
get_manager().errors()("target '%s' has no type" % str (t))
开发者ID:zjutjsj1004,项目名称:third,代码行数:8,代码来源:generators.py
示例16: run
def run(self, project, name, ps, sources):
pass
action_name = ps.get("action")[0]
if action_name[0] == "@":
action = virtual_target.Action(get_manager(), sources, action_name[1:], ps)
else:
action = virtual_target.Action(get_manager(), sources, "notfile.run", ps)
return [get_manager().virtual_targets().register(virtual_target.NotFileTarget(name, project, action))]
开发者ID:Bandeira,项目名称:sps,代码行数:9,代码来源:notfile.py
示例17: gcc_compile_cpp
def gcc_compile_cpp(targets, sources, properties):
# Some extensions are compiled as C++ by default. For others, we need to
# pass -x c++. We could always pass -x c++ but distcc does not work with it.
extension = os.path.splitext (sources [0]) [1]
lang = ''
if not extension in ['.cc', '.cp', '.cxx', '.cpp', '.c++', '.C']:
lang = '-x c++'
get_manager().engine().set_target_variable (targets, 'LANG', lang)
engine.add_dependency(targets, bjam.call('get-target-variable', targets, 'PCH_FILE'))
开发者ID:vidjogamer,项目名称:ProjectTemplate,代码行数:9,代码来源:gcc.py
示例18: message
def message(name, *args):
if type(name) == type([]):
name = name[0]
t = get_manager().targets()
project = get_manager().projects().current()
return t.main_target_alternative(MessageTargetClass(*((name, project) + args)))
开发者ID:Bandeira,项目名称:sps,代码行数:10,代码来源:message.py
示例19: register
def register(type, suffixes=[], base_type=None):
""" Registers a target type, possibly derived from a 'base-type'.
If 'suffixes' are provided, they list all the suffixes that mean a file is of 'type'.
Also, the first element gives the suffix to be used when constructing and object of
'type'.
type: a string
suffixes: None or a sequence of strings
base_type: None or a string
"""
# Type names cannot contain hyphens, because when used as
# feature-values they will be interpreted as composite features
# which need to be decomposed.
if __re_hyphen.search(type):
raise BaseException('type name "%s" contains a hyphen' % type)
if __types.has_key(type):
raise BaseException('Type "%s" is already registered.' % type)
entry = {}
entry["base"] = base_type
entry["derived"] = []
entry["scanner"] = None
__types[type] = entry
if base_type:
__types[base_type]["derived"].append(type)
if len(suffixes) > 0:
# Generated targets of 'type' will use the first of 'suffixes'
# (this may be overriden)
set_generated_target_suffix(type, [], suffixes[0])
# Specify mapping from suffixes to type
register_suffixes(suffixes, type)
feature.extend("target-type", [type])
feature.extend("main-target-type", [type])
feature.extend("base-target-type", [type])
if base_type:
feature.compose("<target-type>" + type, replace_grist(base_type, "<base-target-type>"))
feature.compose("<base-target-type>" + type, "<base-target-type>" + base_type)
import b2.build.generators as generators
# Adding a new derived type affects generator selection so we need to
# make the generator selection module update any of its cached
# information related to a new derived type being defined.
generators.update_cached_information_with_a_new_type(type)
# FIXME: resolving recursive dependency.
from b2.manager import get_manager
get_manager().projects().project_rules().add_rule_for_type(type)
开发者ID:ibrahim01832891988,项目名称:ssh-rd,代码行数:54,代码来源:type.py
示例20: alias
def alias(name, sources=[], requirements=[], default_build=[], usage_requirements=[]):
project = get_manager().projects().current()
targets = get_manager().targets()
targets.main_target_alternative(AliasTarget(
name, project,
targets.main_target_sources(sources, name, no_renaming=True),
targets.main_target_requirements(requirements or [], project),
targets.main_target_default_build(default_build, project),
targets.main_target_usage_requirements(usage_requirements or [], project)))
开发者ID:Bandeira,项目名称:sps,代码行数:11,代码来源:alias.py
注:本文中的b2.manager.get_manager函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论