使用setup.cfg和setup.py進行管理python
一、setup.py文件內容git
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools setuptools.setup( setup_requires=['pbr'], pbr=True)
這裏面使用到pbr模塊api
pbr會讀取和過濾setup.cfg中的數據,而後將解析後的數據提供給setup.py做爲參數。包含以下功能:
一、從git中獲取Version、AUTHORS and ChangeLog信息
二、Sphinx Autodoc。pbr會掃描project,找到全部模塊,生成stub files
三、Requirements。pbr會讀取requirements.txt,生成setup函數須要的install_requires/tests_require/dependency_links
函數
四、long_description。從README.rst, README.txt or README file中生成
long_description
參數ui
二、setup.cfg配置code
[metadata] name = trove version = 2015.1 summary = OpenStack DBaaS description-file = README.rst author = OpenStack author-email = openstack-dev@lists.openstack.org home-page = http://www.openstack.org/ classifier = Environment :: OpenStack Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 [files] packages = trove [entry_points] console_scripts = trove-api = trove.cmd.api:main trove-taskmanager = trove.cmd.taskmanager:main trove-mgmt-taskmanager = trove.cmd.taskmanager:mgmt_main