On 10/30/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > I just read an IBM Developerworks article on setuptools today, its > linked at: > > http://www-128.ibm.com/developerworks/linux/library/l-cppeak3.html? > ca=dgr-lnxw07PythonEggWithSetuptools > > it refers to the ability to use pkg_resources.require() in a Python > script to specify any particular version of a package that happens to > exist in site-packages, overriding the currently active > package...something i used to think setuptools could do, but then > figured it couldnt (even though it seems like obviously useful > functionality), and it seems that it still cannot. from the > article's example: > > # install Gnosis_Utils (latest version is 1.2.1) > easy_install -f http://gnosis.cx/download/Gnosis_Utils.More/ > Gnosis_Utils > > # install version 1.2.0 of Gnosis_Utils > easy_install -f http://gnosis.cx/download/Gnosis_Utils.More/ > "Gnosis_Utils==1.2.0" > > # re-activate version 1.2.1 > easy_install "Gnosis_Utils==1.2.1" > > # run a script that requires version 1.2.0 > from pkg_resources import require > require("Gnosis_Utils==1.2.0") > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ > python2.4/site-packages/setuptools-0.6c3-py2.4.egg/pkg_resources.py", > line 585, in require > needed = self.resolve(parse_requirements(requirements)) > File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ > python2.4/site-packages/setuptools-0.6c3-py2.4.egg/pkg_resources.py", > line 487, in resolve > raise VersionConflict(dist,req) # XXX put more info here > pkg_resources.VersionConflict: (Gnosis-Utils 1.2.1 (/Library/ > Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ > Gnosis_Utils-1.2.1-py2.4.egg), Requirement.parse('Gnosis-Utils==1.2.0')) > > > bug ? or feature ?
Feature. It can do multi-version installs, but only if explicitly specified. The problem is that 1.2.1 is already on sys.path, so setuptools gives up because it doesn't know if something is using Gnosis-Utils or not. If the directory *containing* the egg was on sys.path, then it would pick the exact version... but then you must *always* require it before it is imported. -bob _______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
