On Mon, Jun 25, 2012 at 3:53 AM, mbogosian <[email protected]>wrote:

>
> Perhaps I have misunderstood the intended behavior, but I thought one
> should be able to do this:
>
> % easy_install BeautifulSoup==3.0.8
> ...
> % easy_install -U BeautifulSoup
> [installs 3.1.0.1]
> ...
> % python -c 'import pkg_resources ; print
> pkg_resources.require("BeautifulSoup==3.0.8")'
> Traceback (most recent call last):
> pkg_resources.VersionConflict: (BeautifulSoup 3.1.0.1
> (.../site-packages/BeautifulSoup-3.1.0.1-py2.5.egg),
> Requirement.parse('BeautifulSoup==3.0.8'))
>

Do this instead:

python -c '__requires__=['BeautifulSoup==3.0.8']; import pkg_resources;
import beautifulsoup'

That is, if the main script declares a __requires__ variable before
importing pkg_resources, pkg_resources will allow you to override what
would normally produce a VersionConflict due to a default version being
present on the command line.

This is an undocumented but supported workaround for the issue, as it's
used internally by the scripts easy_install generates.
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to