--- a/setup.py Tue Jan 26 20:42:55 2010 +0200
+++ b/setup.py Tue Jan 26 20:49:05 2010 +0200
@@ -1,12 +1,37 @@
from distutils.core import setup
from distutils.extension import Extension
-from Cython.Distutils import build_ext
+
+import os.path
+
+build_root = os.path.abspath(os.path.dirname(__file__))
+
+pypngtile_c = "python/pypngtile.c"
+pypngtile_name = "python/pypngtile.pyx"
+
+cmdclass = dict()
+
+try :
+ from Cython.Distutils import build_ext
+
+ cmdclass['build_ext'] = build_ext
+
+except ImportError :
+ path = os.path.join(build_root, pypngtile_c)
+
+ if os.path.exists(path) :
+ print "Warning: falling back from .pyx -> .c due to missing Cython"
+ # just use the .c
+ pypngtile_name = pypngtile_c
+
+ else :
+ # fail
+ raise
setup(
name = 'pngtiles',
- cmdclass = {'build_ext': build_ext},
+ cmdclass = cmdclass,
ext_modules = [
- Extension("pypngtile", ["python/pypngtile.pyx"],
+ Extension("pypngtile", [pypngtile_name],
include_dirs = ['include'],
library_dirs = ['lib'],
libraries = ['pngtile'],