change the way to build in the absence of Cython
This commit is contained in:
parent
ea5a35d137
commit
5925c2415f
2 changed files with 13 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
include ez_setup.py *.txt
|
include ez_setup.py *.txt
|
||||||
recursive-include src *.pyx *.pxd *.pxi *.py
|
recursive-include src *.pyx *.pxd *.pxi *.py *.cpp
|
||||||
recursive-include src/ext *.*
|
recursive-include src/ext *.*
|
||||||
recursive-include test *.*
|
recursive-include test *.*
|
10
setup.py
10
setup.py
|
@ -5,10 +5,16 @@
|
||||||
|
|
||||||
import ez_setup
|
import ez_setup
|
||||||
ez_setup.use_setuptools()
|
ez_setup.use_setuptools()
|
||||||
import os,platform
|
import os
|
||||||
|
import sys
|
||||||
|
import platform
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
import glob
|
import glob
|
||||||
|
try:
|
||||||
import Cython.Compiler.Main as cython_compiler
|
import Cython.Compiler.Main as cython_compiler
|
||||||
|
have_cython = True
|
||||||
|
except ImportError:
|
||||||
|
have_cython = False
|
||||||
from distutils.command.build_ext import build_ext
|
from distutils.command.build_ext import build_ext
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
@ -21,7 +27,9 @@ charsetdetect_dir = os.path.join(ext_dir, 'libcharsetdetect/')
|
||||||
nspr_emu_dir = os.path.join(charsetdetect_dir,"nspr-emu/")
|
nspr_emu_dir = os.path.join(charsetdetect_dir,"nspr-emu/")
|
||||||
uchardet_dir = os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/")
|
uchardet_dir = os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/")
|
||||||
|
|
||||||
|
if have_cython:
|
||||||
pyx_sources = glob.glob(cchardet_dir+'*.pyx')
|
pyx_sources = glob.glob(cchardet_dir+'*.pyx')
|
||||||
|
sys.stderr.write("cythonize: %r\n" % (pyx_sources,))
|
||||||
cython_compiler.compile(pyx_sources,options=cython_compiler.CompilationOptions(cplus=True))
|
cython_compiler.compile(pyx_sources,options=cython_compiler.CompilationOptions(cplus=True))
|
||||||
cchardet_sources = glob.glob(cchardet_dir+'*.cpp')
|
cchardet_sources = glob.glob(cchardet_dir+'*.cpp')
|
||||||
sources = cchardet_sources + [os.path.join(charsetdetect_dir,"charsetdetect.cpp")] + glob.glob(uchardet_dir+'*.cpp')
|
sources = cchardet_sources + [os.path.join(charsetdetect_dir,"charsetdetect.cpp")] + glob.glob(uchardet_dir+'*.cpp')
|
||||||
|
|
Loading…
Reference in a new issue