import setuptools # In python < 2.7.4, a lazy loading of package `pbr` will break # setuptools if some other modules registered functions in `atexit`. # solution from: http://bugs.python.org/issue15881#msg170215 try: import multiprocessing # noqa except ImportError: pass setuptools.setup( setup_requires=['pbr>=1.8'], pbr=True)
这个是setup.py文件,从中看到只是使用了setuptools这个库
1.setuptools是什么和能做什么
它 是一组Python的 distutilsde工具的增强工具(适用于 Python 2.3.5 以上的版本,64 位平台则适用于 Python 2.4 以上的版本),可以让程序员更方便的创建和发布 Python 包,特别是那些对其它包具有依赖性的状况。
2.setuptools怎么使用
http://guoyunsky.iteye.com/blog/1659824,请参考该作者的实例,谢谢作者提供的例子
3.setuptools中的pbr是用来做什么的
setup.py会使用pbr从setup.cfg文件读取参数,执行命令
http://blog.csdn.net/joelovegreen/article/details/46373619,请参考该作者的实例,谢谢作者提供的例子
[entry_points] oslo.config.opts = #这是表示这是一个命名空间或者一个组 nova = nova.opts:list_opts #nova.opts表示一个包的路径,list_opts表示一个方法 nova.conf = nova.conf.opts:list_opts nova.api = nova.api.opts:list_opts nova.cells = nova.cells.opts:list_opts nova.compute = nova.compute.opts:list_opts nova.network = nova.network.opts:list_opts nova.network.neutronv2 = nova.network.neutronv2.api:list_opts nova.virt = nova.virt.opts:list_opts nova.cache_utils = nova.cache_utils:list_opts oslo.config.opts.defaults = nova.api = nova.common.config:set_middleware_defaults nova.compute.monitors.cpu = virt_driver = nova.compute.monitors.cpu.virt_driver