summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-02-13 18:29:41 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-02-13 18:29:41 +0000
commit93b23d09e7621adde819c2bb2ee6318903f40837 (patch)
tree5f9310db6c4178a1bacde965a291e0b15d4da852
parent722e6b589b63350e7db31383a389ae44a454c32e (diff)
Goodbye stupid setuptool problems with Cython.
setuptools is maybe one of the most stupid tools out there, it patches distutils aiming to "fix" it, but it actually make things worse. One example is that although both Pyrex and Cython (an old Pyrex fork that is now much more active and maintained), it will check just for Pyrex and break distutils, that works perfectly with Cython! My trick is to force Cython module into sys.modules as the name 'Pyrex', before setuptools is imported and patches stuff. This works nicely, but is ugly as hell. So far setuptools usefulness is quite limited. I'm thinking about going straight to distutils or even automake/autoconf, so we can avoid those hacks around pkgconfig. SVN revision: 46149
-rwxr-xr-xbuild.sh3
-rw-r--r--setup.py17
2 files changed, 7 insertions, 13 deletions
diff --git a/build.sh b/build.sh
index 110f79b..cb6138e 100755
--- a/build.sh
+++ b/build.sh
@@ -81,9 +81,6 @@ fi
81if ! which cython >/dev/null; then 81if ! which cython >/dev/null; then
82 die "cython is not installed" 82 die "cython is not installed"
83fi 83fi
84if ! which pyrexc >/dev/null; then
85 die "pyrexc (python-pyrex) is not installed"
86fi
87 84
88if [ -z "$TMPDIR" ]; then 85if [ -z "$TMPDIR" ]; then
89 TMPDIR="/tmp" 86 TMPDIR="/tmp"
diff --git a/setup.py b/setup.py
index 95ec96f..b04ae2f 100644
--- a/setup.py
+++ b/setup.py
@@ -3,15 +3,13 @@ import os
3 3
4if not os.path.exists("ethumb/ethumb.c_ethumb.c"): 4if not os.path.exists("ethumb/ethumb.c_ethumb.c"):
5 try: 5 try:
6 import Cython 6 from Cython.Distutils import build_ext
7 # work around stupid setuptools that insists on just checking pyrex
8 sys.modules['Pyrex'] = sys.modules['Cython']
7 except ImportError: 9 except ImportError:
8 raise SystemExit("You need Cython -- http://cython.org/") 10 raise SystemExit("You need Cython -- http://cython.org/")
9 try: 11else:
10 import Pyrex 12 from distutils.command.build_ext import build_ext
11 except ImportError:
12 raise SystemExit(
13 "You need Pyrex -- "
14 "http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/")
15 13
16from ez_setup import use_setuptools 14from ez_setup import use_setuptools
17use_setuptools('0.6c9') 15use_setuptools('0.6c9')
@@ -20,8 +18,6 @@ from setuptools import setup, find_packages, Extension
20import subprocess 18import subprocess
21import shlex 19import shlex
22 20
23from Cython.Distutils import build_ext
24
25def getstatusoutput(cmdline): 21def getstatusoutput(cmdline):
26 cmd = shlex.split(cmdline) 22 cmd = shlex.split(cmdline)
27 p = subprocess.Popen(cmd, stdout=subprocess.PIPE) 23 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
@@ -106,7 +102,8 @@ class ethumb_build_ext(build_ext):
106 def finalize_options(self): 102 def finalize_options(self):
107 build_ext.finalize_options(self) 103 build_ext.finalize_options(self)
108 self.include_dirs.insert(0, 'include') 104 self.include_dirs.insert(0, 'include')
109 self.pyrex_include_dirs.extend(self.include_dirs) 105 if hasattr(self, "pyrex_include_dirs"):
106 self.pyrex_include_dirs.extend(self.include_dirs)
110 107
111 108
112module_list = [ethumbmodule] 109module_list = [ethumbmodule]