-
-
Notifications
You must be signed in to change notification settings - Fork 440
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
# Is there a duck-typing way to know we can't compile extensions? #80
Comments
I'm experimenting with this code:
It works, but might be a bit over-zealous in catching exceptions. The simplejson code catches BuildFailed, but I find on Windows that when I can't install the extension, it fails with ValueError:
|
Oops, sorry, just read further into the simplejson code, it throws its own BuildFailed error. I'll look into using its technique. |
Fixed in <<changeset 740b68eb8fc5 (bb)>>. |
Original comment by Domen Kožar (Bitbucket: iElectric, GitHub: iElectric) This still fails if no gcc is present: http://dpaste.org/A1WwH/ |
Original comment by Domen Kožar (Bitbucket: iElectric, GitHub: iElectric) Probably needs to use https://bitbucket.org/zzzeek/sqlalchemy/src/b91c1cc4c893741443534a112b1d2d74321fce64/setup.py?at=default#cl-115 |
Domen, thanks for the extra information. I'm afraid I've never used zc.buildout, can you provide very detailed instructions on how to reproduce this? You mention zc.buildout doesn't pass "install" to setup.py, how can that be right? Maybe I don't understand what this is all meant to accomplish. I don't see how the sqlalchemy code gets around not having a verb passed to it. |
Original comment by Domen Kožar (Bitbucket: iElectric, GitHub: iElectric) Sure:
(make sure you don't have gcc installed) |
Original comment by Domen Kožar (Bitbucket: iElectric, GitHub: iElectric) So what SQLAlchemy does different that is more bullet-proof is the following: https://bitbucket.org/zzzeek/sqlalchemy/src/b91c1cc4c893741443534a112b1d2d74321fce64/setup.py?at=default#cl-61 |
I would accept a pull request, provided I could understand it, and it supported Py2.3 - Py3.3, and worked on Windows, Linux, and Mac. This part of the setup.py doesn't have automated tests, but some guidance on how to make sure it keeps working would be good too. |
Original comment by Zooko O'Whielacronx (Bitbucket: zooko, GitHub: zooko) One way to reduce the risks of undetected breakage on different platforms would be to hew as closely as possible to what other packages do. Simplejson is very widely used and actively supported, so it's setup.py probably works: https://github.com/simplejson/simplejson/blob/master/setup.py By the way, please add PyPy to your list of platforms that you don't want to break! ☺ |
Original comment by Domen Kožar (Bitbucket: iElectric, GitHub: iElectric) (Reply via [email protected]): simplejson is doing the same thing: catching exception early and raising On Mon, Nov 26, 2012 at 4:46 PM, Zooko O'Whielacronx < |
Hmm, I have a complaint that 3.5.3 fails where 3.5.2 worked. Maybe simplejson's way is the way to go. |
Handled in the way SQLAlchemy and simplejson do (they use the same way!) in <<changeset fd9b29a3383188ae87692fdd0a030f4f2ceca858 (bb)>>. |
Originally reported by Zooko O'Whielacronx (Bitbucket: zooko, GitHub: zooko)
Is there a duck-typing way to know we can't compile extensions?
Yes! You try to build the extension and if it fails then you automatically fall back to using your pure-Python alternative. This way install will also succeed on a system without a C compiler, for example.
The example code that I crib from whenever I'm going to use this hack is simplejson:
http://simplejson.googlecode.com/svn/trunk/setup.py
The text was updated successfully, but these errors were encountered: