Can I create a single egg for multiple versions of python?
We have a local system which runs via a series of eggs. At the moment this means everyone must have a copy of Python 2.5 installed. Is it possible to create an egg which can be used by Python 2.5, 2.6, and 2.7 (idea开发者_C百科lly also any later versions)?
Obviously, the python code will have to run under all three versions. Equally obviously, this egg can't contain any C extensions. Slightly less obviously, the egg must contain the python source (.py) files, and not the .pyc files.
Also, I know we could create three eggs (or possibly copy the one egg with three names) - but that seems wrong.
Distribute the source tarball only; easy-install (or pip or buildout, or whatever package dependency manager / installer you use) will create an egg for you for the python version used to install it.
You only ever need to create eggs for distribution only for packages with C-extensions, and then only for Windows because most Windows system lack the tools needed to build the egg themselves.
Take a look at PyPI to see many examples of this, like the zope.interface page. Note that there are only .egg distributions there for python versions 2.4, 2.5 and 2.6 for Windows. Everything else just uses the .tar.gz
tarball download and builds the .egg
locally as needed.
You build a source tarball using the setup.py sdist
command. Personally, I use jarn.mkrelease; it automates much of the process for you (like uploading the source distribution to a distribution server).
精彩评论