[Distutils] pkg_resource require does not seem to find my egg

Nicholas Veeser nicholas at metaweb.com
Tue Apr 7 20:06:04 CEST 2009


I am confused.   Doesn't this setup a development environment?
I am trying to build an OS package (gentoo) for deployment to a number  
of hosts.

I want to install my package, with a SqlAlchemy package (0.5.3), and  
an existing Sqlalchemy package (0.4.4)
and have the packages all get along.

My thoughts were that with the appropriate use of pkg_resources.py, I  
could use WorkSet, Environment, etc to
build a sys.path which would correctly have the newer SqlAlchemy egg  
file in the path.

I am doing this manually now, but it seems like pkg_resources.py is a  
more readable, maintainable
method to do the same thing.


What I have working is this:
dino/__init__.py:

....

egg = "SQLAlchemy-0.5.3-py2.4.egg"
for p in sys.path[:]:
     fullname = os.path.join(p, egg)
     if os.path.exists(fullname):
         sys.path.insert(sys.path.index(p), fullname)

...



On Apr 6, 2009, at 7:49 PM, P.J. Eby wrote:

> At 05:04 PM 4/6/2009 -0700, Nicholas Veeser wrote:
>> I am working on a tool we call dino which uses sqlalchemy 0.5.3
>> Its an update of a previous version (called dino) which uses  
>> sqlalchemy 0.4.4.
>>
>> For reasons I don't have to go into, I would like to have both  
>> tools installed on the same host,
>> with almost no changes to the existing tool.   Thus both versions  
>> of sqlalchemy installed
>>
>> So my solution seemed to be use pkg_resources and egg's:
>>
>> - leave sqlalchemy 0.4.4 in:
>>   /usr/lib64/python2.4/site-packages/sqlalchemy
>> - build sqlalchemy 0.5.3 as an Egg and install into:
>>   /usr/lib64/python2.4/site-packages/SQLAlchemy-0.5.3-py2.4.egg
>> - in the root package of the new code,  specify the correct version
>>   from pkg_resources import require; require("SQLAlchemy>=0.5.0")
>
> Change this to defining that dependency in its setup.py, and develop  
> using 'setup.py develop'.  It will then work correctly.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20090407/8b0a4639/attachment.htm>


More information about the Distutils-SIG mailing list