setup.py
changeset 117 2da34e3aa885
parent 30 53e99e552122
child 132 0260aeca943c
equal deleted inserted replaced
116:6841b56e128b 117:2da34e3aa885
     1 from distutils.core import setup
     1 from distutils.core import setup
     2 from distutils.extension import Extension
     2 from distutils.extension import Extension
     3 from Cython.Distutils import build_ext
     3 
       
     4 import os.path
       
     5 
       
     6 build_root = os.path.abspath(os.path.dirname(__file__))
       
     7 
       
     8 pypngtile_c = "python/pypngtile.c"
       
     9 pypngtile_name = "python/pypngtile.pyx"
       
    10 
       
    11 cmdclass = dict()
       
    12 
       
    13 try :
       
    14     from Cython.Distutils import build_ext
       
    15     
       
    16     cmdclass['build_ext'] = build_ext
       
    17 
       
    18 except ImportError :
       
    19     path = os.path.join(build_root, pypngtile_c)
       
    20 
       
    21     if os.path.exists(path) :
       
    22         print "Warning: falling back from .pyx -> .c due to missing Cython"
       
    23         # just use the .c
       
    24         pypngtile_name = pypngtile_c
       
    25     
       
    26     else :
       
    27         # fail
       
    28         raise
     4 
    29 
     5 setup(
    30 setup(
     6     name = 'pngtiles',
    31     name = 'pngtiles',
     7     cmdclass = {'build_ext': build_ext},
    32     cmdclass = cmdclass,
     8     ext_modules = [
    33     ext_modules = [
     9         Extension("pypngtile", ["python/pypngtile.pyx"],
    34         Extension("pypngtile", [pypngtile_name],
    10             include_dirs = ['include'],
    35             include_dirs = ['include'],
    11             library_dirs = ['lib'],
    36             library_dirs = ['lib'],
    12             libraries = ['pngtile'],
    37             libraries = ['pngtile'],
    13         ),
    38         ),
    14     ],
    39     ],