當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。