瀏覽代碼

Fix setuptools Cython issue

Jonas Borgström 13 年之前
父節點
當前提交
6ffa7e851c
共有 4 個文件被更改,包括 19 次插入3 次删除
  1. 1 0
      fake_pyrex/Pyrex/Distutils/__init__.py
  2. 6 0
      fake_pyrex/Pyrex/Distutils/build_ext.py
  3. 1 0
      fake_pyrex/Pyrex/__init__.py
  4. 11 3
      setup.py

+ 1 - 0
fake_pyrex/Pyrex/Distutils/__init__.py

@@ -0,0 +1 @@
+# This is a python package

+ 6 - 0
fake_pyrex/Pyrex/Distutils/build_ext.py

@@ -0,0 +1,6 @@
+from distutils.command.build_ext import build_ext
+#
+#def build_ext(*args, **kw):
+#    from distutils import build_ext as build_ext_orig
+#    return build_ext_orig(*args, **kw)
+

+ 1 - 0
fake_pyrex/Pyrex/__init__.py

@@ -0,0 +1 @@
+# This is a python package

+ 11 - 3
setup.py

@@ -3,6 +3,13 @@
 import os
 import sys
 from glob import glob
+
+try:
+    import Cython
+    sys.path.insert(0, os.path.join(os.path.dirname(__file__), "fake_pyrex"))
+except ImportError:
+    pass
+
 from setuptools import setup, Extension
 from setuptools.command.sdist import sdist
 hashindex_sources = ['darc/hashindex.pyx', 'darc/_hashindex.c']
@@ -18,9 +25,10 @@ try:
                                         cython_compiler.default_options)
             sdist.__init__(self, *args, **kwargs)
 
-        def run(self):
-            sdist.run(self)
-            self.filelist.append('darc/hashindex.c', 'darc/hashindex.h')
+        def make_distribution(self):
+            self.filelist.append('darc/hashindex.c')
+            self.filelist.append('darc/hashindex.h')
+            sdist.make_distribution(self)
 
 except ImportError:
     hashindex_sources[0] = hashindex_sources[0].replace('.pyx', '.c')