[Distutils] Disabling --single-version-externally-managed

Toshio Kuratomi a.badger at gmail.com
Sat Sep 1 00:26:33 CEST 2007


Phillip J. Eby wrote:
> At 01:14 AM 8/29/2007 -0400, Ignacio Vazquez-Abrams wrote:
>> I have some packages that I'm using the following with:
>>
>> %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
>>
>> I now need to install multiple versions of one of the packages and so
>> need to disable the implicit --single-version-externally-managed. How
>> can I do so and still use setup.py install?
> 
> You can't.  You can use something like this, though, to make an RPM 
> that installs a non-active egg:
> 
>     setup.py easy_install --prefix=$RPM_BUILD_ROOT/usr -mx .
> 
Hmmm... So I've been experimenting a bit with this to make some new
guidelines for actually utilizing setuptools to make rpm packages [1]_
and found something a little strange.

I'm using sqlalchemy0.3 and sqlalchemy0.4 as my test case.  Install
sqlalchemy0.3 using::
  easy_install --prefix=$RPM_BUILD_ROOT/usr -m dist/SQLAlchemy-0.3*.egg

Then install sqlalchemy0.4 using::
  python setup.py install --root=$RPM_BUILD_ROOT%{python_sitelib}

This creates the following in site_packages::
  SQLAlchemy-0.3.10-py2.5.egg:
    EGG-INFO  sqlalchemy
  SQLAlchemy-0.4.0beta4-py2.5.egg-info:
    dependency_links.txt  entry_points.txt  PKG-INFO  SOURCES.txt
    top_level.txt
  sqlalchemy (0.4.0)

At this point I expect import sqlalchemy to import the 0.4 version and
pkg_resources to give me access to 0.3.10 or 0.4.0beta4 depending on how
I specify my versions.  But in fact, 0.4.0 is not available::

  pkg_require >=0.3,<0.4.0beta1...  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 626,
in require
      needed = self.resolve(parse_requirements(requirements))
    File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 528,
in resolve
      raise VersionConflict(dist,req) # XXX put more info here
  pkg_resources.VersionConflict: (SQLAlchemy 0.4.0beta4
(/usr/lib/python2.5/site-packages),
Requirement.parse('SQLAlchemy>=0.3,<0.4.0beta1'))

This also happens when I use *.pth files instead of installing 0.4 as an
active egg.

Is this a bug?  I can get my desired behaviour by installing both 0.3
and 0.4 as inactive eggs.  Then manually copying/symlinking the 0.4
version into site-packages.

I'll attach a small script I use to test this.

.. _[1]: http://fedoraproject.org/wiki/PackagingDrafts/PythonEggs

-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-sql.sh
Type: application/x-shellscript
Size: 919 bytes
Desc: not available
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20070831/73e2d6f1/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20070831/73e2d6f1/attachment.pgp 


More information about the Distutils-SIG mailing list