[Distutils] failing to build quadtree if the package is already installed
Phillip J. Eby
pje at telecommunity.com
Fri Jan 26 18:03:07 CET 2007
At 11:11 AM 1/26/2007 -0500, Kurt Schwehr wrote:
>Sorry if this kind of thing has already been discussed. I am packaging
>quadtree for Mac OSX/fink (deb based package management) and am getting a
>failed build if the package is alread installed and I am trying to do a
>rebuild. Can someone point me at what needs to be changed? Is this
>because quadtree is a namespace?
Yes, and it shouldn't be, since its __init__.py contains actual code, and
is missing a namespace declaration. (The whole point of a namespace
package is that the package itself shouldn't contain any code. After all,
in a --single-version-externally-managed install, the __init__.py will not
even be *there*.)
So, this is a packaging error on the part of the quadtree
developer(s). Most likely, quadtree is not really a namespace package and
should not be declared as one, because the only reason to do that is if
there are modules or subpackages under that package that are distributed
*separately*. My guess is that the author saw a namespace declaration in
some other project's setup.py and thought it was required boilerplate
instead of an option.
>20070118/externals/Quadtree/quadtree/__init__.py", line 2, in <module>
> from _tree import Quadtree
>ImportError: No module named _tree
>
>cat quadtree/__init__.py
>
>from _tree import Quadtree
>
>
>And, here is the setup.py file:
>
>from setuptools import setup, Extension
>_tree = Extension('quadtree._tree',
> sources=['quadtree/_treemodule.c',
> 'shapelib/shptree.c',
> 'shapelib/shpopen.c'],
> include_dirs=['shapelib']
> )
>setup(name = 'Quadtree',
> version = '0.1.1',
> description = 'Quadtree spatial index for Python GIS',
> license = 'BSD',
> keywords = 'spatial index',
> author = 'Sean Gillies',
> author_email = ' <mailto:sgillies at frii.com>sgillies at frii.com',
> maintainer = 'Sean Gillies',
> maintainer_email = '<mailto:sgillies at frii.com>sgillies at frii.com',
> url = '
> <http://icon.stoa.org/trac/pleiades/wiki/QuadTree>http://icon.stoa.org/trac/pleiades/wiki/QuadTree',
> packages = ['quadtree'],
> namespace_packages = ['quadtree'],
> ext_modules = [_tree],
> classifiers = [
> 'Development Status :: 3 - Alpha',
> 'Intended Audience :: Developers',
> 'Intended Audience :: Science/Research',
> 'License :: OSI Approved :: BSD License',
> 'Operating System :: OS Independent',
> 'Programming Language :: C',
> 'Programming Language :: Python',
> 'Topic :: Scientific/Engineering :: GIS',
> 'Topic :: Database',
> ],
>)
More information about the Distutils-SIG
mailing list