用法
Tags2sdists提供tags2sdists命令
Usage: tags2sdists CHECKOUTDIR SDISTDIR
CHECKOUTDIR: directory with checkouts
SDISTDIR: directory with sdist package directories
Options:
-a, --build-all Build all releases (=don't stop if the newest tag is found)
-h, --help Show this help message and exit
-v, --verbose Show debug output
-q, --quiet Show minimal output
使用--build-all,构建所有标签。默认行为有助于处理表现不佳的旧标签,但如果所有软件包都干净,则--build-all是一个好的选择,因为它也会构建旧版本的错误修复版本。
设置
安装tags2sdists本身就像pip install tags2sdists或easy_install tags2sdists或以常规方式将其包含在您的buildout中一样简单。
接下来,您需要CHECKOUTDIR和SDISTDIR目录。
CHECKOUTDIR:您需要一个包含签出的目录。手动操作即可。但是当您使用svn时,一个包含 svn:externals 的目录可能更为方便。对于其他所有情况(包括svn),我会使用 checkoutmanager。创建一个配置文件(checkoutmanager.cfg),如下所示
[internalprojects]
vcs = git
basedir = /srv/packages/var/checkouts/
checkouts =
git@github.com:lizardsystem/nensskel.git
git@github.com:lizardsystem/lizard-ui.git
git@github.com:lizardsystem/tags2sdists.git
设置一个cron作业,运行 checkoutmanager --configfile=YOURCONFIGFILE,它将更新您配置的基础目录中的签出。 (在同一cron作业中,之后启动 tags2sdists)。
SDISTDIR:任何地方的目录都行。您将在其中获得类似pypi的目录结构。
像tags2sdists生成的结构对于easy_install和buildout来说是一个完美的索引,如果让apache托管它。唯一的问题是:您只能有一个索引(注意:pip显然支持多个索引)。您可以通过在apache中重定向您到pypi来解决问题,当找不到内容时。
以下是一个示例apache配置片段
# Allow indexing
Options +Indexes
IndexOptions FancyIndexing VersionSort
# Start of rewriterules to use our own var/private/* packages
# when available and to redirect to pypi if not.
RewriteEngine On
# Use our robots.txt:
RewriteRule ^/robots.txt - [L]
# Use our apache's icons:
RewriteRule ^/icons/.* - [L]
# We want OUR index. Specified in a weird way as apache
# searches in a weird way for index.htm index.html index.php etc.
RewriteRule ^/index\..* - [L]
# Use our var/private/PROJECTNAME if available,
# redirect to pypi otherwise:
RewriteCond /path/on/server/var/private/$1 !-f
RewriteCond /path/on/server/var/private/$1 !-d
RewriteRule ^/([^/]+)/?$ http://pypi.python.org/pypi/$1/ [P,L]
# Use our var/private/PROJECTNAME/project-0.1.tar.gz if available,
# redirect to pypi otherwise:
RewriteCond /path/on/server/var/private/$1 !-d
RewriteRule ^/([^/]+)/([^/]+)$ http://pypi.python.org/pypi/$1/$2 [P,L]