[Distutils] requiring python 2.5

Phillip J. Eby pje at telecommunity.com
Sat Jun 9 22:04:45 CEST 2007


At 09:26 PM 6/8/2007 -0500, Rick Ratzel wrote:

>    Is there a way to have my package tell setuptools to "ignore" 
> certain other
>packages?

Only through version specifications; i.e., request the exact versions you want.


>    I've tried removing all the "enthought." eggs from sys.path 
> before anything
>else gets imported, but even that doesn't work (and it just felt wrong, and
>probably is).

If "enthought" is a namespace package, you would need to either be 
using an 0.7-development version of setuptools (i.e., a trunk SVN 
version), or else you'd need to remove those eggs from the path 
*before* pkg_resources is first imported.  Otherwise, it would indeed not work.


>I looked at the docs for manipulating the WorkingSet, but made no
>progress there either...python always managed to find the incompatible
>enthought.traits code in the enthought.traits egg.  When I remove the
>incompatible enthought.traits, all works fine.
>
>    What I'd like to do is simply say "do not use any enthought.* 
> eggs".  Is this
>possible?  Thanks in advance!

Not without using an 0.7 version of setuptools, or manipulating 
enthought.__path__.  The straightforward way to do it would be for 
enstaller's __init__.py to do this:

    import enthought, os
    enthought.__path__ = os.path.dirname(os.path.dirname(__file__))

This will ensure that all enthought.* modules imported from then on 
will only be from within the parent directory of enstaller.

I don't think I'd recommend this to anyone in the general case, but 
this might be a reasonable workaround if you truly want to 
"de-namespace" the package.  (It will *not*, however, prevent new 
eggs from being added to __path__ if you add anything to sys.path or 
the working set afterward.)



More information about the Distutils-SIG mailing list