当前位置: 首页>>代码示例>>Python>>正文


Python Platform.python方法代码示例

本文整理汇总了Python中twitter.common.python.platforms.Platform.python方法的典型用法代码示例。如果您正苦于以下问题:Python Platform.python方法的具体用法?Python Platform.python怎么用?Python Platform.python使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twitter.common.python.platforms.Platform的用法示例。


在下文中一共展示了Platform.python方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from twitter.common.python.platforms import Platform [as 别名]
# 或者: from twitter.common.python.platforms.Platform import python [as 别名]
  def __init__(self,
               name,
               source=None,
               dependencies=None,
               entry_point=None,
               inherit_path=False,
               zip_safe=True,
               repositories=None,
               indices=None,
               ignore_errors=False,
               allow_pypi=False,
               platforms=(),
               interpreters=(Platform.python(),),
               provides=None,
               exclusives=None):
    """
      name: target name

      source: the python source file that becomes this binary's __main__ [optional]
              if none specified, drops into an interpreter by default

      dependencies: a list of other PythonLibrary or Pants targets this binary depends upon

      entry_point: the default entry point for this binary (by default drops
                   into the entry point defined by @source)

      inherit_path: inherit the sys.path of the environment that this binary runs in

      zip_safe: whether or not this binary is safe to run in compacted (zip-file) form

      repositories: a list of repositories to query for dependencies

      indices: a list of indices to use for packages

      allow_pypi: whether or not this binary should be allowed to hit pypi for dependency
                  management

      platforms: extra platforms to target when building this binary.

      interpreters: the interpreter versions to target when building this binary.  by default the
                    current interpreter version (specify in the form: '2.6', '2.7', '3.2' etc.)
      exclusives:   An optional map of exclusives tags. See CheckExclusives for details.
    """

    if source is None and dependencies is None:
      raise TargetDefinitionException(
          'ERROR: no source or dependencies declared for target %s' % name)
    if source and entry_point:
      raise TargetDefinitionException(
          'Can only declare an entry_point if no source binary is specified.')
    if not isinstance(platforms, (list, tuple)) and not isinstance(platforms, Compatibility.string):
      raise TargetDefinitionException('platforms must be a list, tuple or string.')
    if not isinstance(interpreters, (list, tuple)):
      raise TargetDefinitionException('interpreters must be a list or tuple.')

    self._entry_point = entry_point
    self._inherit_path = bool(inherit_path)
    self._zip_safe = bool(zip_safe)
    self._interpreters = interpreters
    self._repositories = repositories or []
    self._indices = indices or []
    self._allow_pypi = bool(allow_pypi)
    self._ignore_errors = bool(ignore_errors)

    if isinstance(platforms, Compatibility.string):
      self._platforms = [platforms]
    else:
      self._platforms = platforms
    self._platforms = tuple(self._platforms)

    PythonTarget.__init__(self, name, [] if source is None else [source],
                          dependencies=dependencies,
                          provides=provides, exclusives=exclusives)
开发者ID:BabyDuncan,项目名称:commons,代码行数:75,代码来源:python_binary.py


注:本文中的twitter.common.python.platforms.Platform.python方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。