update build method
This commit is contained in:
parent
c1d4640ee8
commit
33869a746b
3 changed files with 56 additions and 44 deletions
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
|
@ -0,0 +1,4 @@
|
|||
include ez_setup.py *.txt
|
||||
recursive-include src *.pyx *.pxd *.pxi *.py
|
||||
recursive-include src/ext *.*
|
||||
recursive-include test *.*
|
92
setup.py
92
setup.py
|
@ -1,75 +1,85 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
# python setup.py sdist --formats=gztar
|
||||
|
||||
import ez_setup
|
||||
ez_setup.use_setuptools()
|
||||
import os,platform
|
||||
from setuptools import setup, Extension
|
||||
from Cython.Distutils import build_ext
|
||||
|
||||
DEBUG = False
|
||||
|
||||
root = os.getcwd()
|
||||
ext_dir = os.path.join(root,'ext')
|
||||
src_dir = os.path.join(root,'src')
|
||||
ext_dir = os.path.join(src_dir,'ext')
|
||||
build_dir = os.path.join(root,'build')
|
||||
cchardet_dir = os.path.join(src_dir,'cchardet')
|
||||
cchardet_source = os.path.join(cchardet_dir,"cchardet.pyx")
|
||||
cchardet_source2 = os.path.join(cchardet_dir,"__init__.py")
|
||||
charsetdetect_dir = os.path.join(ext_dir, 'libcharsetdetect')
|
||||
nspr_emu_dir = os.path.join(charsetdetect_dir,"nspr-emu")
|
||||
uchardet_dir = os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base")
|
||||
|
||||
uchardet_sources = [
|
||||
"ext/libcharsetdetect/charsetdetect.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/CharDistribution.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/JpCntx.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangBulgarianModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangCyrillicModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangCzechModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangFinnishModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangFrenchModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangGermanModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangGreekModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangHebrewModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangHungarianModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangPolishModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangSpanishModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangSwedishModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangThaiModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/LangTurkishModel.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsBig5Prober.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsCharSetProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsEscCharsetProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsEscSM.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsEUCJPProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsEUCKRProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsEUCTWProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsGB2312Prober.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsHebrewProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsLatin1Prober.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsMBCSGroupProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsMBCSSM.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsSBCharSetProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsSBCSGroupProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsSJISProber.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsUniversalDetector.cpp",
|
||||
"ext/libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsUTF8Prober.cpp",
|
||||
os.path.join(charsetdetect_dir,"charsetdetect.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/CharDistribution.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/JpCntx.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangBulgarianModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangCyrillicModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangCzechModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangFinnishModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangFrenchModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangGermanModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangGreekModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangHebrewModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangHungarianModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangPolishModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangSpanishModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangSwedishModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangThaiModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/LangTurkishModel.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsBig5Prober.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsCharSetProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsEscCharsetProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsEscSM.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsEUCJPProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsEUCKRProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsEUCTWProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsGB2312Prober.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsHebrewProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsLatin1Prober.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsMBCSGroupProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsMBCSSM.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsSBCharSetProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsSBCSGroupProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsSJISProber.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsUniversalDetector.cpp"),
|
||||
os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/nsUTF8Prober.cpp"),
|
||||
]
|
||||
|
||||
macros = []
|
||||
if platform.system() == "Windows":
|
||||
macros.append(("WIN32","1"))
|
||||
|
||||
cchardet_module = Extension("_cchardet",
|
||||
if DEBUG:
|
||||
macros.append(("DEBUG_chardet","1"))
|
||||
|
||||
cchardet_module = Extension("cchardet._cchardet",
|
||||
sources = uchardet_sources+[cchardet_source],
|
||||
include_dirs = [uchardet_dir,nspr_emu_dir,charsetdetect_dir],
|
||||
language = "c++",
|
||||
define_macros=macros
|
||||
define_macros=macros,
|
||||
extra_compile_args = ["-O3", "-Wall"],
|
||||
)
|
||||
|
||||
setup(
|
||||
name = 'cchardet',
|
||||
author = 'PyYoshi',
|
||||
author_email = 'yohihiro_dot_m_at_gmail_dot_com',
|
||||
url = r"https://github.com/PyYoshi/cChardet",
|
||||
description = 'Universal encoding detector',
|
||||
description = 'Universal encoding detector. This library is faster than chardet.',
|
||||
long_description= """This library is high speed universal character encoding detector. - binding to charsetdetect.
|
||||
This library is faster than chardet.
|
||||
""",
|
||||
|
@ -84,13 +94,11 @@ This library is faster than chardet.
|
|||
keywords = [
|
||||
'cython',
|
||||
'chardet',
|
||||
'universal character encoding detector',
|
||||
'charsetdetect'
|
||||
],
|
||||
ext_package='cchardet',
|
||||
package_dir = {'':src_dir},
|
||||
packages = ['cchardet'],
|
||||
cmdclass = {'build_ext': build_ext},
|
||||
package_dir = {"":src_dir},
|
||||
packages = ['cchardet',],
|
||||
ext_modules = [
|
||||
cchardet_module
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue