[Distutils] spurious warning when multiple ez_setup instances are present
Phillip J. Eby
pje at telecommunity.com
Tue Apr 10 18:19:44 CEST 2007
At 02:14 PM 4/10/2007 +0200, Antoine Pitrou wrote:
>Hi,
>
>I occasionally get this warning when using a setuptools-enabled setup.py
>from a third-party package:
>
>/usr/lib/python2.5/site-packages/setuptools/command/sdist.py:3:
>UserWarning: Module ez_setup was already imported
>from /home/antoine/nose/config-file/ez_setup.pyc, but /home/antoine/XXX
>is being added to sys.path
>
>It seems to me that this warning conveys no useful information (yes,
>several independent packages can have their own copy of ez_setup.py...
>so what?), and that it would be better to remove it.
This isn't a warning about ez_setup specifically - it's a warning that
occurs whenever an imported module will be shadowed by an egg being added
to sys.path.
However, this should only happen for modules and packages specifically
included in a project... and ez_setup should *not* be included in a
project's installed modules or packages.
Further investigation suggests that the issue is actually find_packages(),
which includes 'ez_setup' as a package if run against the project root
without 'exclude=["ez_setup"]'. In other words, you can get rid of this
message by changing the find_packages() call being used in the package at
/home/antoine/XXX.
I'll also change find_packages() to ensure that it always excludes ez_setup
in future, since if someone wants to force ez_setup to be included in the
installation (as opposed to the source distribution), they can always
explicitly add it to their package list.
I am somewhat concerned as to whether this will still cause ez_setup to be
packaged with a source distribution in the case where someone is not using
revision control; I'll have to test that case to be sure.
More information about the Distutils-SIG
mailing list