Warning from setup.py using minilib if paver is installed

1 view
Skip to first unread message

ssteiner

unread,
Sep 10, 2009, 4:51:33 PM9/10/09
to paver
I've generated my setup.py to use paver instead of the orginal
setuptools one.

This worked fine in my fresh test environment where I had not
installed paver itself.

Now, when I run it in the same environment, only with paver installed,
I get a simple (but complicated *looking*) warning about the paver
being added from paver-minilib.zip, then conflicting when the site-
packages egg is added.

# python setup.py develop
/Users/ssteiner/.virtualenvs/wssw1/lib/python2.6/site-packages/
setuptools-0.6c9-py2.6.egg/setuptools/command/sdist.py:4: UserWarning:
Module paver was already imported from paver-minilib.zip/paver/
__init__.py, but /Users/ssteiner/.virtualenvs/wssw1/lib/python2.6/site-
packages/Paver-1.0.1-py2.6.egg is being added to sys.path
running develop
running egg_info

I'm not sure what the best way to get rid of this is but big nasty-
looking warnings on setup are really not a good introduction for users
to a new tool.

We could try to import paver, then only import the minilib on an
exception i.e. paver's not installed.

Only concern with that, far as I know, is that there are commands
available in paver to add modules to the mini-lib and, obviously, they
wouldn't be there.

Anyone found a clever way to get around this?

Thanks,

S


Kevin Dangoor

unread,
Sep 14, 2009, 3:38:58 PM9/14/09
to pa...@googlegroups.com
Perhaps the setup script could do something like

try:
    import pkg_resources
    pkg_resources.require("Paver >=1.0")
    import paver
except:
    (add the minilib and import paver)

Kevin
--
Kevin Dangoor

work: http://labs.mozilla.com/
email: k...@blazingthings.com
blog: http://www.BlueSkyOnMars.com

sste...@gmail.com

unread,
Sep 14, 2009, 3:45:55 PM9/14/09
to pa...@googlegroups.com

On Sep 14, 2009, at 3:38 PM, Kevin Dangoor wrote:

> Perhaps the setup script could do something like
>
> try:
> import pkg_resources
> pkg_resources.require("Paver >=1.0")
> import paver
> except:
> (add the minilib and import paver)

Right, the issue is that, if anything's been added to the minilib from
outside paver, it won't get imported or be available.

Thanks,

S

Kevin Dangoor

unread,
Sep 14, 2009, 3:51:07 PM9/14/09
to pa...@googlegroups.com
then maybe like this:


try:
    import pkg_resources
    pkg_resources.require("Paver>=1.0")
    import paver
except:
    pass


(add the minilib and import paver)

That way, paver gets imported from wherever it is setuptools finds it. The second importing of paver won't do anything in that case. And the stuff in the minilib can still be found.

Kevin

sste...@gmail.com

unread,
Sep 14, 2009, 3:55:28 PM9/14/09
to pa...@googlegroups.com
On Sep 14, 2009, at 3:51 PM, Kevin Dangoor wrote:

On Mon, Sep 14, 2009 at 3:45 PM, sste...@gmail.com <sste...@gmail.com> wrote:


On Sep 14, 2009, at 3:38 PM, Kevin Dangoor wrote:

> Perhaps the setup script could do something like
>
> try:
>     import pkg_resources
>     pkg_resources.require("Paver >=1.0")
>     import paver
> except:
>     (add the minilib and import paver)

Right, the issue is that, if anything's been added to the minilib from
outside paver, it won't get imported or be available.


then maybe like this:

try:
    import pkg_resources
    pkg_resources.require("Paver>=1.0")
    import paver
except:
    pass

(add the minilib and import paver)

That way, paver gets imported from wherever it is setuptools finds it. The second importing of paver won't do anything in that case. And the stuff in the minilib can still be found.

I do believe that'll do the trick!  

I had turned off the import warning with the warnings module but I really don't like turning off warnings like that.

Thanks!

S

Reply all
Reply to author
Forward
0 new messages