发布脚本
项目描述
简介
Cosent.buildtools 允许您一次性发布带有多个开发egg的buildout。
目的是,在buildout/项目级别提供类似于 jarn.mkrelease 在单个egg级别提供的便利性。
Cosent.buildtools 将会
为任何有未发布更改的开发egg生成新的版本号;如果你正在进行“最终”发布,则为任何RC发布的egg。
提交、标记和发布所有更改的开发egg。
更新buildout的version.txt以反映新发布的egg。
为buildout本身生成并存储一个新的版本号。
将所有开发egg标记为新buildout的编号。
提交、标记和发布buildout本身。
假设/要求/限制
您有一个带有多个开发egg的buildout
您已安装mr.developer,并使用它来管理egg的开发状态
您在buildout配置中有一个[版本]部分
buildout本身是一个带有setup.py版本号的python egg
buildout和所有开发egg都位于git版本控制之下
版本算法只理解非常简单的版本方案,如0.2、0.2dev和0.2rc4。见下文。
这对于在 Cosent 使用的发布模式适用。YMMV。
安装
将以下内容添加到您的buildout.cfg中
[buildout] parts += buildtools [buildtools] recipe = zc.recipe.egg eggs = cosent.buildtools
这将安装两个脚本:buildtool和bumpversion。
buildtool
buildtool状态 检查您的整个工作树是否有更改
buildtool status List uncommitted changes in all working trees.
buildtool cook 准备您的egg以发布
buildtool [-n] [-f] [-s] [-c] cook Bump version, commit and tag all eggs that have unreleased commits. [-n] dry run, no changes [-f] force a new release, even if no changes [-s] skip sanity check, accept uncommitted changes [-c] create RC (0.1->0.2rc1) instead of final version (0.1->0.2)
buildtool dist 一次发布所有鸡蛋和构建工具本身
buildtool [-n] [-f] [-s] [-c] <-v versions> <-d dist> [-b name] dist Release and upload all changed eggs to distserver (via jarn.mkrelease). Update and commit buildout versionsfile to reflect the new egg versions. Tag the buildout and tag all eggs with the buildout version tag. Push all commits and tags in all eggs and the buildout. [-n] dry run, no changes [-f] force a new release, even if no changes [-s] skip sanity check, accept uncommitted changes [-c] create RC (0.1->0.2rc1) instead of final version (0.1->0.2) <-v versions> path to buildout versions.txt file <-d dist> pypirc dist location to use for uploading eggs [-b name] name of current buildout, defaults to dirname
buildtool git 在所有鸡蛋和构建工具上运行 git 命令
buildtool git <gitargs> Run 'git gitargs' on all development eggs, and on the buildout itself. Insert '--' or use extra quoting to escape arguments passed to git. Examples: bin/buildtool git -- log --oneline HEAD^^.. bin/buildtool git "commit -a -m 'your commit message'"
示例运行
bin/buildtool git tag # list tags bin/buildtool git whatchanged sometag # list changes since last release bin/buildtool status # check that we're clean bin/buildtool cook # prepare release # the actual release bin/buildtool -v versions.txt -d your.server:/var/pypi dist
与 jarn.mkrelease 不同,buildtool 期望干净的沙箱。如果遇到未提交的工作,它会中断,除非您使用 -s(–skip-checks)开关。
指定默认参数
您可以通过初始化一个 'defaults' 字典来指定默认设置,然后将默认值作为脚本的参数传递。由于某些脚本生成错误,您需要指定一个不同的脚本名称才能使此操作正常工作。
如果您像这样修改您的构建工具
[buildtools] recipe = zc.recipe.egg eggs = cosent.buildtools scripts = buildtool=release initialization = defaults = { 'versions-file':'versions.txt', 'dist-location':'pypi', 'build-name': 'cosent.buildtools'} arguments = defaults
当然,您需要提供自己的 dist-location,例如 'your.server.net:/var/www/packages/local',并将构建名称设置为您的项目名称。您可以使用 jarn.mkrelease 接受的任何 dist-location,包括在 .pypirc 中定义的别名。
现在,您将有一个独立的 bin/release 脚本,该脚本已设置默认值,这意味着您可以简单地运行
bin/release status bin/release cook bin/release dist
bumpversion
启用自动版本编号。这对于与 jarn.mkrelease 一起使用非常有用,如果编号未增加,它就会损坏。
此功能包含在 buildtool 包装器中,但也作为独立实用程序提供。
将版本提升到下一个发布候选版本
$ bin/bumpversion ./src/some.egg/setup.py
将版本提升到下一个最终版本
$ bin/bumpversion --final ./src/some.egg/setup.py
版本算法如下
rc(发布候选)
2.7 -> 2.8rc1 2.8dev -> 2.8rc1 2.8rc1 -> 2.8rc2
final(实际发布)
2.7 -> 2.8 2.8dev -> 2.8 2.8rc2 -> 2.8
该算法很简单,只理解 major.minor + “rc|dev” + seq。不同的版本号,如 2.8b3、2.8-fix2,会导致损坏。
项目详情
cosent.buildtools-1.2.1.zip 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d84d3c596333b127eef029edb9a107a7d51414349050d338392cf5fbfb1b2173 |
|
MD5 | 205a90deacb0a50617be8eeb3fa82d5c |
|
BLAKE2b-256 | 8250b6e357144885237cd23f2fafb0b2e1b51b8cbf1327d30ff045ed1b00060e |