跳转到主要内容

zc.buildout配方,用于解析pip配置文件并在构建中使用解析信息。

项目描述

collective.recipe.pip

构建配方,可以解析pip配置文件(通常命名为requirements.txt),允许独立使用pip和buildout进行同一项目的构建。

https://travis-ci.org/collective/collective.recipe.pip.png https://pypip.in/v/collective.recipe.pip/badge.png https://coveralls.io/repos/collective/collective.recipe.pip/badge.png?branch=master

概述

该配方允许将pip配置文件(通常是requirements.txt)解析成用于构建out其他部分的egg列表。

该配方将解析的egg列表镜像到其部分中,例如${pip:eggs}将给出解析的egg列表。

来自url(例如来自github)的egg列表也导出到urls参数中:${pip:urls}将给出解析的egg url列表。

目前该配方只有一个选项configs - 要解析的配置文件列表。

配置文件在解析Recipe实例的初始化期间解析,即读取buildout.cfg之后,但在安装或更新任何配方之前。

示例用法:使用环境变量

让我们创建测试配置文件

>>> write('requirements.txt',
... """
... some.egg
... -e http://some.package.git.url#egg=develop.egg
... --use-wheel
... http://sourceforge.net/projects/pychecker/files/latest/download?source=files#egg=pychecker==0.8.19
... fabric>=0.9b1
... # some comment
... xlrd # reading excel worksheets
... html5lib==0.95
... """)
>>> write('requirements-included.txt',
... """
... some.included.egg
... """)
>>> write('requirements-included2.txt',
... """
... some.included.egg2
... """)
>>> mkdir('file.package')
>>> write('file.package/setup.py',
... """
... from setuptools import setup
... setup(name='file.package')
... """)
>>> write('requirements2.txt',
... """
... -r requirements-included.txt
... --requirement requirements-included2.txt
... some2.egg
... django>=1.3,<1.4
... django-extensions #django extension requirements (not mandatory, but useful on dev)
... -e http://some2.package.git.url#egg=develop2.egg
... -e file.package
... --extra-index-url=http://some.index.url
... -f http://git.fabfile.org
... """)

我们首先创建一个使用该配方的构建

>>> write('buildout.cfg',
... r"""
... [buildout]
... parts = pip print
...
... [some-section]
... eggs = ${pip:eggs}
...
... [pip]
... recipe = collective.recipe.pip
... configs = requirements.txt
...           requirements2.txt
... versions = versions
...
... [versions]
...
... [print]
... recipe = mr.scripty
... install =
...     ... print(self.buildout['some-section']['eggs'])
...     ... print('\n[versions]')
...     ... print('\n'.join(i + ' = ' + k for i, k in sorted(self.buildout['versions'].items())))
...     ... print('\n[urls]')
...     ... print(self.buildout['pip']['urls'])
...     ... print('# done')
...     ... return []
... """)

使用 mr.scripty 脚本可以打印出 ${some-section:some-option} 选项的值。

运行 buildout 会得到以下内容

>>> import sys
>>> sys.stdout.write('start\n' + system(buildout))
start...
Installing pip.
Installing print.
develop.egg
develop2.egg
django-extensions
django>=1.3,<1.4
fabric>=0.9b1
html5lib==0.95
pychecker==0.8.19
some.egg
some.included.egg
some.included.egg2
some2.egg
xlrd
[versions]
django = >=1.3,<1.4
fabric = >=0.9b1
html5lib = 0.95
pychecker = 0.8.19
zc.buildout = ...
zc.recipe.egg = ...
[urls]
/sample-buildout/file.package
git+http://some.package.git.url#egg=develop.egg
git+http://some2.package.git.url#egg=develop2.egg
http://sourceforge.net/projects/pychecker/files/latest/download?source=files#egg=pychecker==0.8.19
...

联系方式

如果您有任何问题、错误报告、建议等,请在此 GitHub 项目页面 上创建一个问题。

许可证

本软件采用 MIT 许可证

查看 许可证文件

© 2013 Anatoly Bubenkov 及其他人员。

贡献者

变更日志

0.3.4 (2016-05-25)

  • 支持最新的 pip 8.1.2 (ridha)

0.3.2 (2015-07-19)

  • 对旧版 pip 的向后兼容性 (ccomb)

0.3.1 (2015-05-27)

  • 支持最新的 pip (7.x.x) (ridha)

0.3.0 (2015-03-17)

  • 支持最新的 pip (6.x.x) (ridha)

0.2.0 (2014-02-06)

  • 正确解析 –use-wheel

0.1.9 (2013-12-05)

  • 支持本地可编辑的 eggs

0.1.7 (2013-06-27)

  • 支持在 urls 参数中查看自定义 url-eggs

0.1.6 (2013-03-11)

  • 不可预测的需求解析案例已修复

0.1.5 (2013-02-18)

  • 添加了 Buildout 2.0.1 支持

0.1.4 (2013-01-29)

  • 修复了主页 URL,删除了不必要的 README.txt

0.1.3 (2013-01-25)

  • 重构了解析以使用原生 pip 配置解析器,因此现在可以通过 -r 标志嵌套配置,就像使用 pip 一样

0.1.2 (2013-01-05)

  • 添加了解析版本的部分

0.1.1 (2012-12-22)

  • 改进了版本解析

0.1.0 (2012-12-22)

  • 首次发布。

项目详情


下载文件

下载适用于您平台的项目文件。如果您不确定要选择哪个,请了解更多关于 安装包 的信息。

源分布

collective.recipe.pip-0.3.4.tar.gz (7.0 kB 查看哈希值)

上传日期

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面