terom@30: from distutils.core import setup terom@30: from distutils.extension import Extension terom@117: terom@117: import os.path terom@117: terom@117: build_root = os.path.abspath(os.path.dirname(__file__)) terom@117: terom@117: pypngtile_c = "python/pypngtile.c" terom@117: pypngtile_name = "python/pypngtile.pyx" terom@117: terom@117: cmdclass = dict() terom@117: terom@117: try : terom@117: from Cython.Distutils import build_ext terom@117: terom@117: cmdclass['build_ext'] = build_ext terom@117: terom@117: except ImportError : terom@117: path = os.path.join(build_root, pypngtile_c) terom@117: terom@117: if os.path.exists(path) : terom@117: print "Warning: falling back from .pyx -> .c due to missing Cython" terom@117: # just use the .c terom@117: pypngtile_name = pypngtile_c terom@117: terom@117: else : terom@117: # fail terom@117: raise terom@30: terom@30: setup( terom@30: name = 'pngtiles', terom@117: cmdclass = cmdclass, terom@30: ext_modules = [ terom@117: Extension("pypngtile", [pypngtile_name], terom@30: include_dirs = ['include'], terom@30: library_dirs = ['lib'], terom@30: libraries = ['pngtile'], terom@30: ), terom@30: ], terom@30: ) terom@30: