星期三, 十一月 07, 2007

python setup.py classifiers for pypi

通过编写 setup.py 中的 classfiers,以及相应的 url/download_url 和 description,可以直接从命令行上运行 python setup.py register 将包直接上传到 pypi,从而避免每次发布新版本的时候都要登录到 web 页面填写表单这样的重复劳动。例子如下:
#!/usr/bin/python
# -*- encoding: utf-8 -*-

# Author: Roc Zhou
# Date: 2007-11-07
# Email: chowroc.z@gmail.com

from distutils.core import setup
from distutils import sysconfig

lib_prefix = sysconfig.get_python_lib()

setup(
name = 'caxes',
version = '0.1.4'
description = """
Some new Python data structure,
can be afforded as APIs for new ways of configuration.

It's a subproject of uLFS.

uLFS means "Your Manageable, Automatable and Templated Reusable Linux From Scratch",
it's a set of tools to build your own customed Linux distribution with
more managability than raw LFS(Linux From Scratch). Include source package
manager, file system backup and realtime mirror apps, and some assistant data
structure such as Tree writen in Python, etc...
""",
author = "Roc Zhou",
author_email = 'chowroc.z@gmail.com',
platforms = "Platform Independent",
license = "GPL v2.0",
url = "http://crablfs.sourceforge.net",
download_url = "http://sourceforge.net/projects/crablfs",
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Natural Language :: English",
"Natural Language :: Chinese (Simplified)",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules"
],
py_modules = ['tree'],
# data_files = [('test', ['tree_ut.py'])],
data_files = [("%s/test" % lib_prefix, ['test_tree.py'])],
# package_dir = {'caxes' : 'lib'},
# packages = ['caxes']
)
不过不知道为什么 description 却和 web 页面中的 Description 不一样,却显示在了 Summary 下面。结果 Summary 信息很长。

1 条评论:

Roc Zhou 说...

可能 Summary 对应的是 description 变量,而 Description 对应的是 long_description。