pkg_resources ?
Ned Deily
nad at acm.org
Tue Jun 14 16:50:12 EDT 2011
In article <BANLkTi=-=jjLK_4awQgNA3H7kv3AA9Y5tw at mail.gmail.com>,
km <srikrishnamohan at gmail.com> wrote:
> I am trying to look at the source code of a python script (run.py). But
> it reads
> ###########code - run.py ########################
> #!/usr/bin/env python
> # EASY-INSTALL-SCRIPT: 'pbpy==0.1','run.py'
> __requires__ = 'pbpy==0.1'
> import pkg_resources
> pkg_resources.run_script('pbpy==0.1', 'run.py')
> ##############code #####################
>
> What are the advantages of using pkg_resources stuff ?
What you are seeing is boiler-plate code automatically generated by
setuptools (or the Distribute clone of setuptools) when a script is
installed with easy_install. The main reason for the wrapper is to
allow multiple versions of a Python "package" (in the PyPi sense) to be
installed in one Python instance. There's more information here:
http://peak.telecommunity.com/DevCenter/setuptools
--
Ned Deily,
nad at acm.org
More information about the Python-list
mailing list