本文整理汇总了Python中twitter.pants.base.Target类的典型用法代码示例。如果您正苦于以下问题:Python Target类的具体用法?Python Target怎么用?Python Target使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Target类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: configure_target
def configure_target(target):
if target not in analyzed:
analyzed.add(target)
self.has_scala = self.has_scala or is_scala(target)
if isinstance(target, JavaLibrary) or isinstance(target, ScalaLibrary):
# TODO(John Sirois): this does not handle test resources, make test resources 1st class
# in ant build and punch this through to pants model
resources = set()
if target.resources:
resources.update(target.resources)
if target.binary_resources:
resources.update(target.binary_resources)
if resources:
self.resource_extensions.update(Project.extract_resource_extensions(resources))
configure_source_sets(ExportableJvmLibrary.RESOURCES_BASE_DIR, resources, is_test = False)
if target.sources:
test = is_test(target)
self.has_tests = self.has_tests or test
configure_source_sets(target.target_base, target.sources, is_test = test)
siblings = Target.get_all_addresses(target.address.buildfile)
return filter(accept_target, [ Target.get(a) for a in siblings if a != target.address ])
开发者ID:DikangGu,项目名称:commons,代码行数:25,代码来源:ide.py
示例2: test_sibling_references
def test_sibling_references(self):
with temporary_dir() as root_dir:
buildfile = create_buildfile(root_dir, 'a', name='BUILD',
content=dedent("""
dependencies(name='util',
dependencies=[
jar(org='com.twitter', name='util', rev='0.0.1')
]
)
""").strip()
)
sibling = create_buildfile(root_dir, 'a', name='BUILD.sibling',
content=dedent("""
dependencies(name='util-ex',
dependencies=[
pants(':util'),
jar(org='com.twitter', name='util-ex', rev='0.0.1')
]
)
""").strip()
)
ParseContext(buildfile).parse()
utilex = Target.get(Address.parse(root_dir, 'a:util-ex', is_relative=False))
utilex_deps = set(utilex.resolve())
util = Target.get(Address.parse(root_dir, 'a:util', is_relative=False))
util_deps = set(util.resolve())
self.assertEquals(util_deps, util_deps.intersection(utilex_deps))
开发者ID:alfss,项目名称:commons,代码行数:30,代码来源:test_parse_context.py
示例3: __init__
def __init__(self, name, dependencies, is_meta):
Target.__init__(self, name, is_meta)
self._injected_deps = []
self.processed_dependencies = resolve(dependencies)
self.add_label('internal')
self.dependency_addresses = OrderedSet()
self.dependencies = OrderedSet()
self.internal_dependencies = OrderedSet()
self.jar_dependencies = OrderedSet()
# TODO(John Sirois): if meta targets were truly built outside parse contexts - we could instead
# just use the more general check: if parsing: delay(doit) else: doit()
# Fix how target _ids are built / addresses to not require a BUILD file - ie: support anonymous,
# non-addressable targets - which is what meta-targets really are once created.
if is_meta:
# Meta targets are built outside any parse context - so update dependencies immediately
self.update_dependencies(self.processed_dependencies)
else:
# Defer dependency resolution after parsing the current BUILD file to allow for forward
# references
self._post_construct(self.update_dependencies, self.processed_dependencies)
self._post_construct(self.inject_dependencies)
开发者ID:ewhauser,项目名称:commons,代码行数:25,代码来源:internal.py
示例4: __init__
def __init__(self, name, sources=None):
Target.__init__(self, name)
self.add_labels('sources')
self.target_base = SourceRoot.find(self)
self.sources = None
self._sources = sources or []
开发者ID:jalons,项目名称:commons,代码行数:7,代码来源:with_sources.py
示例5: __init__
def __init__(self, requirement, dynamic=False, repository=None, name=None, version_filter=None):
self._requirement = Requirement.parse(requirement)
self._name = name or self._requirement.project_name
self._dynamic = dynamic
self._repository = repository
self._version_filter = version_filter or (lambda: True)
Target.__init__(self, self._name, False)
开发者ID:JoeEnnever,项目名称:commons,代码行数:7,代码来源:python_requirement.py
示例6: execute
def execute(self):
for buildfile in BuildFile.scan_buildfiles(self.root_dir):
for address in Target.get_all_addresses(buildfile):
target = Target.get(address)
if hasattr(target, 'sources') and target.sources is not None:
for sourcefile in target.sources:
print sourcefile, address
开发者ID:DikangGu,项目名称:commons,代码行数:7,代码来源:filemap.py
示例7: __init__
def __init__(self, name, sources=None, exclusives=None):
Target.__init__(self, name, exclusives=exclusives)
self.add_labels("sources")
self.target_base = SourceRoot.find(self)
self.sources = None
self._sources = sources or []
开发者ID:dynamicguy,项目名称:commons,代码行数:7,代码来源:with_sources.py
示例8: add_targets
def add_targets(self, error, dir, buildfile):
try:
self.targets.extend(Target.get(addr) for addr in Target.get_all_addresses(buildfile))
except (TypeError, ImportError):
error(dir, include_traceback=True)
except (IOError, SyntaxError):
error(dir)
开发者ID:soheilhy,项目名称:commons,代码行数:7,代码来源:goal.py
示例9: __init__
def __init__(self, name, dependencies, is_meta):
Target.__init__(self, name, is_meta)
self.resolved_dependencies = OrderedSet()
self.internal_dependencies = OrderedSet()
self.jar_dependencies = OrderedSet()
self.update_dependencies(dependencies)
开发者ID:DikangGu,项目名称:commons,代码行数:8,代码来源:internal.py
示例10: _find_targets
def _find_targets(self):
if len(self.context.target_roots) > 0:
for target in self.context.target_roots:
yield target
else:
for buildfile in BuildFile.scan_buildfiles(get_buildroot()):
target_addresses = Target.get_all_addresses(buildfile)
for target_address in target_addresses:
yield Target.get(target_address)
开发者ID:CodeWarltz,项目名称:commons,代码行数:9,代码来源:filemap.py
示例11: __init__
def __init__(self, name, url_builder, exclusives=None):
"""
:param string name: The name of this target, which combined with this
build file defines the target :class:`twitter.pants.base.address.Address`.
:param url_builder: Function that accepts a page target and an optional wiki config dict.
:returns: A tuple of (alias, fully qualified url).
"""
Target.__init__(self, name, exclusives=exclusives)
self.url_builder = url_builder
开发者ID:CodeWarltz,项目名称:commons,代码行数:9,代码来源:doc.py
示例12: __init__
def __init__(self, name, username=None, password=None):
"""
:name The name of these credentials
:username Either a constant username value or else a callable that can fetch one
:password Either a constant password value or else a callable that can fetch one
"""
Target.__init__(self, name, False)
self._username = username if callable(username) else lambda: username
self._password = password if callable(password) else lambda: password
开发者ID:JoeEnnever,项目名称:commons,代码行数:9,代码来源:credentials.py
示例13: __init__
def __init__(self, name, dependencies):
"""name: The name of this module target, addressable via pants via the portion of the spec
following the colon
dependencies: one or more JarDependencies this JarLibrary bundles or Pants pointing to other
JarLibraries or JavaTargets"""
assert len(dependencies) > 0, "At least one dependency must be specified"
Target.__init__(self, name, False)
self.dependencies = dependencies
开发者ID:adamsxu,项目名称:commons,代码行数:10,代码来源:jar_library.py
示例14: __init__
def __init__(self, name, url, push_db, exclusives=None):
"""name: an identifier for the repo
url: the url used to access the repo and retrieve artifacts or artifact metadata
push_db: the data file associated with this repo that records artifact push history"""
Target.__init__(self, name, exclusives=exclusives)
self.name = name
self.url = url
self.push_db = push_db
开发者ID:BabyDuncan,项目名称:commons,代码行数:10,代码来源:repository.py
示例15: execute
def execute(self, expanded_target_addresses):
buildroot = get_buildroot()
if len(self.context.target_roots) > 0:
for target in self.context.target_roots:
self._execute_target(target, buildroot)
else:
for buildfile in BuildFile.scan_buildfiles(buildroot):
target_addresses = Target.get_all_addresses(buildfile)
for target_address in target_addresses:
target = Target.get(target_address)
self._execute_target(target, buildroot)
开发者ID:alfss,项目名称:commons,代码行数:11,代码来源:filemap.py
示例16: _walk
def _walk(self, walked, work, predicate = None):
Target._walk(self, walked, work, predicate)
for dep in self.dependencies:
if isinstance(dep, Target) and not dep in walked:
walked.add(dep)
if not predicate or predicate(dep):
additional_targets = work(dep)
dep._walk(walked, work, predicate)
if additional_targets:
for additional_target in additional_targets:
additional_target._walk(walked, work, predicate)
开发者ID:benhuang-zh,项目名称:commons,代码行数:11,代码来源:internal.py
示例17: _parse_addresses
def _parse_addresses(self, spec):
if spec.endswith('::'):
dir = self._get_dir(spec[:-len('::')])
for buildfile in BuildFile.scan_buildfiles(self._root_dir, os.path.join(self._root_dir, dir)):
for address in Target.get_all_addresses(buildfile):
yield address
elif spec.endswith(':'):
dir = self._get_dir(spec[:-len(':')])
for address in Target.get_all_addresses(BuildFile(self._root_dir, dir)):
yield address
else:
yield Address.parse(self._root_dir, spec)
开发者ID:patricklaw,项目名称:twitter-commons,代码行数:12,代码来源:goal.py
示例18: __init__
def __init__(self, requirement, name=None, repository=None, version_filter=None, use_2to3=False,
compatibility=None, exclusives=None):
# TODO(wickman) Allow PythonRequirements to be specified using pip-style vcs or url identifiers,
# e.g. git+https or just http://...
self._requirement = Requirement.parse(requirement)
self._repository = repository
self._name = name or self._requirement.project_name
self._use_2to3 = use_2to3
self._version_filter = version_filter or (lambda py, pl: True)
# TODO(wickman) Unify this with PythonTarget .compatibility
self.compatibility = compatibility or ['']
Target.__init__(self, self._name, exclusives=exclusives)
开发者ID:alfss,项目名称:commons,代码行数:12,代码来源:python_requirement.py
示例19: __init__
def __init__(self, name, dependencies):
"""name: The name of this module target, addressable via pants via the portion of the spec
following the colon
dependencies: one or more JarDependencies this JarLibrary bundles or Pants pointing to other
JarLibraries or JavaTargets"""
assert len(dependencies) > 0, "At least one dependency must be specified"
Target.__init__(self, name, False)
self.add_label('jars')
self.dependencies = resolve(dependencies)
self.dependency_addresses = set()
for dependency in self.dependencies:
if hasattr(dependency, 'address'):
self.dependency_addresses.add(dependency.address)
开发者ID:ewhauser,项目名称:commons,代码行数:14,代码来源:jar_library.py
示例20: __init__
def __init__(self, spec):
# it's critical the spec is parsed 1st, the results are needed elsewhere in constructor flow
parse_context = ParseContext.locate()
def parse_address():
if spec.startswith(':'):
# the :[target] could be in a sibling BUILD - so parse using the canonical address
pathish = "%s:%s" % (parse_context.buildfile.canonical_relpath, spec[1:])
return Address.parse(parse_context.buildfile.root_dir, pathish, False)
else:
return Address.parse(parse_context.buildfile.root_dir, spec, False)
self.address = parse_address()
Target.__init__(self, self.address.target_name, False)
开发者ID:DikangGu,项目名称:commons,代码行数:15,代码来源:pants_target.py
注:本文中的twitter.pants.base.Target类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论