From: Pietro Battiston <me@pietrobattiston.it>
Date: Mon, 20 Jan 2014 11:16:00 +0100
Subject: Use "cythonize" for cythonization

---
 setup.py | 31 ++-----------------------------
 1 file changed, 2 insertions(+), 29 deletions(-)
 mode change 100755 => 100644 setup.py

diff --git a/setup.py b/setup.py
old mode 100755
new mode 100644
index ea428c0..2d18d56
--- a/setup.py
+++ b/setup.py
@@ -15,6 +15,7 @@ from distutils.cmd import Command
 from distutils.errors import CCompilerError, DistutilsExecError, \
     DistutilsPlatformError
 from distutils.sysconfig import get_config_var
+from Cython.Build import cythonize
 import errno
 import glob
 import os
@@ -153,35 +154,7 @@ elif sys.platform == 'win32':
 else:
     libraries = ['geos_c']
 
-
-if os.path.exists("MANIFEST.in"):
-    pyx_file = "shapely/speedups/_speedups.pyx"
-    c_file = "shapely/speedups/_speedups.c"
-
-    force_cython = False
-    if 'sdist' in sys.argv:
-        force_cython = True
-
-    try:
-        if (force_cython or not os.path.exists(c_file)
-                or os.path.getmtime(pyx_file) > os.path.getmtime(c_file)):
-            print("Updating C extension with Cython.", file=sys.stderr)
-            subprocess.check_call(["cython", "shapely/speedups/_speedups.pyx"])
-    except (subprocess.CalledProcessError, OSError):
-        print("Warning: Could not (re)create C extension with Cython.",
-              file=sys.stderr)
-        if force_cython:
-            raise
-    if not os.path.exists("shapely/speedups/_speedups.c"):
-        print("Warning: speedup extension not found", file=sys.stderr)
-
-ext_modules = [
-    Extension(
-        "shapely.speedups._speedups",
-        ["shapely/speedups/_speedups.c"],
-        libraries=libraries,
-        include_dirs=[get_config_var('INCLUDEDIR')],),
-]
+ext_modules = cythonize("shapely/speedups/_speedups.pyx")
 
 try:
     import numpy as np
