1. Background
To view the source code of flower, first see the main program of Flower as follows:
#!/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_pointif __name__ = = ' __main__ ': sys.exit ( load_entry_point (' flower==0.7.3 ', ' console_scripts ', ' Flower ') ()
Load_entry_point, the source of its information is Entry_points.txt
What about the source of Entry_points.txt?
setup.py inside has entry_points information, will be based on this information to generate the egg info directory, there are entry_points.txt files, inside the content is setup.py entry_points information
Setup ( name= ' flower ', version=get_package_version (), description= ' celery flower ', long_ Description=open (' Readme.rst '). Read (), author= ' Mher Movsisyan ', author_email= ' [email protected] ', 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 ', ], }, )
A python script is then encapsulated
Description The flower script actually calls:
Two ways to start
[Celery.commands]flower = Flower.command:flowercommand[console_scripts]flower = Flower.__main__:main
2, how to make a egg package and corresponding setup.py how to write it?
3. References
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/
Python's Egg pack