标签:des blog http io ar sp 文件 div on
查看flower的源码,首先看到flower的主程序如下:
#!/usr/local/sinasrv2/bin/python2.7 # EASY-INSTALL-ENTRY-SCRIPT: ‘flower==0.7.3‘,‘console_scripts‘,‘flower‘ __requires__ = ‘flower==0.7.3‘ import sys from pkg_resources import load_entry_point if __name__ == ‘__main__‘: sys.exit( load_entry_point(‘flower==0.7.3‘, ‘console_scripts‘, ‘flower‘)()
load_entry_point,它的信息来源是entry_points.txt
entry_points.txt来源呢?
setup.py里面有entry_points 信息,会根据这些信息生成egg info目录,里面有entry_points.txt文件, 里面的内容就是setup.py里的entry_points信息
setup( name=‘flower‘, version=get_package_version(), description=‘Celery Flower‘, long_description=open(‘README.rst‘).read(), author=‘Mher Movsisyan‘, author_email=‘mher.movsisyan@gmail.com‘, url=‘https://github.com/mher/flower‘, license=‘BSD‘, classifiers=classifiers, packages=find_packages(exclude=[‘tests‘, ‘tests.*‘]), install_requires=install_requires, test_suite="tests", tests_require=get_requirements(‘test.txt‘), package_data={‘flower‘: [‘templates/*‘, ‘static/**/*‘, ‘static/*.*‘]}, entry_points={ ‘console_scripts‘: [ ‘flower = flower.__main__:main‘, ], ‘celery.commands‘: [ ‘flower = flower.command:FlowerCommand‘, ], }, )
然后将封装一个python脚本
说明flower脚本实际调用的是:
两种启动方式
[celery.commands] flower = flower.command:FlowerCommand [console_scripts] flower = flower.__main__:main
1、http://www.cnblogs.com/itech/archive/2011/02/13/1953268.html
2、http://zhiwei.li/text/2011/06/load_entry_point%E5%92%8Csetup-egg/
3、http://django-china.cn/topic/90/
标签:des blog http io ar sp 文件 div on
原文地址:http://www.cnblogs.com/gsblog/p/4042954.html