Skip to content

Commit

Permalink
change the way to build in the absence of Cython
Browse files Browse the repository at this point in the history
  • Loading branch information
PyYoshi committed May 8, 2013
1 parent ea5a35d commit 5925c24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
@@ -1,4 +1,4 @@
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 test *.*
16 changes: 12 additions & 4 deletions setup.py
Expand Up @@ -5,10 +5,16 @@

import ez_setup
ez_setup.use_setuptools()
import os,platform
import os
import sys
import platform
from setuptools import setup, Extension
import glob
import Cython.Compiler.Main as cython_compiler
try:
import Cython.Compiler.Main as cython_compiler
have_cython = True
except ImportError:
have_cython = False
from distutils.command.build_ext import build_ext

DEBUG = False
Expand All @@ -21,8 +27,10 @@
nspr_emu_dir = os.path.join(charsetdetect_dir,"nspr-emu/")
uchardet_dir = os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/")

pyx_sources = glob.glob(cchardet_dir+'*.pyx')
cython_compiler.compile(pyx_sources,options=cython_compiler.CompilationOptions(cplus=True))
if have_cython:
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))
cchardet_sources = glob.glob(cchardet_dir+'*.cpp')
sources = cchardet_sources + [os.path.join(charsetdetect_dir,"charsetdetect.cpp")] + glob.glob(uchardet_dir+'*.cpp')

Expand Down

0 comments on commit 5925c24

Please sign in to comment.