Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildout 2 should have a clearer warning when run with setuptools #82

Closed
reinout opened this issue Feb 20, 2013 · 4 comments · Fixed by #84
Closed

Buildout 2 should have a clearer warning when run with setuptools #82

reinout opened this issue Feb 20, 2013 · 4 comments · Fixed by #84

Comments

@reinout
Copy link
Contributor

reinout commented Feb 20, 2013

Buildout 2 requires distribute instead of setuptools. The bootstrap guarantees distribute, but we cannot guarantee that the correct bootstrap is being used.

See #81 for how easy it is to miss it and how unclear the error message is: AttributeError: 'NoneType' object has no attribute 'location'.

Would a special try/except like the following be a good idea?

something = pkg_resources.Requirement.parse('distribute')
if something is None:
    if pkg_resources.Requirement.parse('setuptoos') is not None:
        raise WhatAreYouDoingException
@mgedmin
Copy link
Member

mgedmin commented Feb 21, 2013

👍 for clear error messages.

The code itself could look something like

has_distribute = pkg_resources.working_set.find(
        pkg_resources.Requirement.parse('distribute')) is not None
has_setuptools = pkg_resources.working_set.find(
        pkg_resources.Requirement.parse('setuptools')) is not None
if has_setuptools and not has_distribute:
    sys.exit("zc.buildout 2.0.0 needs distribute, not setuptools."
                 "  Are you using an outdated bootstrap.py?  Make sure"
                 " you have the latest version downloaded from"
                 " http://downloads.buildout.org/2/bootstrap.py")

@reinout
Copy link
Contributor Author

reinout commented Feb 21, 2013

Now I've got to find a way to test this :-)

I get the feeling more and more that it would be handy to add https://pypi.python.org/pypi/mock as a test dependency.

@jaap3
Copy link
Contributor

jaap3 commented Feb 21, 2013

Yeah that would help greatly... ran into this a couple of times now already.

@reinout
Copy link
Contributor Author

reinout commented Feb 21, 2013

I copied Marius' code into #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants