tarek / distribute

The fellowship of the packaging

Clone this repository (size: 3.1 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/tarek/distribute/
follow

I tried to install Sphinx using ``easy_install -U Sphinx`` and while trying to install Jinja an exception is thrown::

File "/Users/brett/.local/lib/python2.6/site-packages/distribute-0.6.1-py2.6.egg/setuptools/command/build_ext.py", line 85, in get_ext_filename ext = self.ext_map[fullname] KeyError: '_speedups'

Looks like something about trying to build extensions is failing. This is Python 2.6.2+, non-framework on OS X 10.6 using Distribute 0.6.1.

Status: resolved Responsible: Tarek Ziadé / tarek Type: bug
Milestone: none Component: none Version: none

Attachments

Comments and changes

#1

Tarek Ziadé / tarek

→ Changed responsible from nobody to tarek.

That's strange because Jinja provides its own build_ext command in its setup.py file, that does the work, by calling distutils's build_ext command and dealing with compile errors.

I couldn't reproduce that problem (I am on Mac OS X Leopard - py2.6).

Do you still have the full traceback by any chance ?


#2

Brett Cannon / brettsky

The attached file to the issue contains the complete traceback.


#3

Tarek Ziadé / tarek

→ Changed status from new to open.

Ok thanks, I've found the problem.

Here's the explanation, I hope it's not too complex to understand:

Distribute (well Setuptools in fact) overrides Distutils 'get_ext_filename' which is suppose to return a path. But in this implementation, it does a lot more and makes the assumption that the provided argument *is* an extension name and *is* a fullname. (if you look at setuptools code, it even changed the argument name to "fullname", when it's called "ext_name" in Distutils)

Distribute uses in this method self.ext_map which is filled properly *only* when the method is called with an extension fullname.

Unfortunately, Distutils uses this function since 2.6.2 in another context to get a filename that is not a fullname (yes you can ;) ), so if Distribute is present, it will break.

The solution is to keep this method returning what it is suppose to return and not making such assumptions. A refactoring is required on Distribute side, to make it work properly

Unfortunately, starting at 2.6.2, people that compile extensions using the Setuptools project will have this problem.

A quick fix is:

$ hg di setuptools/command/build_ext.py
diff -r 48c7bb55039e setuptools/command/build_ext.py
--- a/setuptools/command/build_ext.py   Sat Sep 12 09:06:05 2009 +0200
+++ b/setuptools/command/build_ext.py   Sun Sep 13 00:07:57 2009 +0200
@@ -82,6 +82,8 @@
 
     def get_ext_filename(self, fullname):
         filename = _build_ext.get_ext_filename(self,fullname)
+        if fullname not in self.ext_map:
+            return filename
         ext = self.ext_map[fullname]
         if isinstance(ext,Library):
             fn, ext = os.path.splitext(filename)

I doubt that Setuptools itself will be fixed then released, but this problem will be fixed in Distribute 0.6.2.


#4

Brett Cannon / brettsky

I don't care about setuptools, only Distribute. =) Thanks for the quick debugging, Tarek! Look forward to 0.6.2.


#6

Brett Cannon / brettsky

I can confirm that in 0.6.2dev this is fixed for me.


Add comment / attachment

Show/hide preview

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?