reformat
This commit is contained in:
parent
9f5f50ad7d
commit
a9d0533a1c
1 changed files with 36 additions and 33 deletions
69
setup.py
69
setup.py
|
@ -13,8 +13,10 @@ except ImportError:
|
||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import Cython.Compiler.Main as cython_compiler
|
import Cython.Compiler.Main as cython_compiler
|
||||||
|
|
||||||
have_cython = True
|
have_cython = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
have_cython = False
|
have_cython = False
|
||||||
|
@ -31,51 +33,52 @@ else:
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
src_dir = 'src'
|
src_dir = 'src'
|
||||||
ext_dir = os.path.join(src_dir,'ext')
|
ext_dir = os.path.join(src_dir, 'ext')
|
||||||
build_dir = 'build'
|
build_dir = 'build'
|
||||||
cchardet_dir = os.path.join(src_dir,'cchardet/')
|
cchardet_dir = os.path.join(src_dir, 'cchardet/')
|
||||||
charsetdetect_dir = os.path.join(ext_dir, 'libcharsetdetect/')
|
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:
|
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,))
|
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')
|
||||||
|
|
||||||
macros = []
|
macros = []
|
||||||
extra_compile_args = []
|
extra_compile_args = []
|
||||||
extra_link_args = []
|
extra_link_args = []
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == 'Windows':
|
||||||
macros.append(("WIN32","1"))
|
macros.append(('WIN32', '1'))
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
macros.append(("DEBUG_chardet","1"))
|
macros.append(('DEBUG_chardet', '1'))
|
||||||
extra_compile_args.append("-g"),
|
extra_compile_args.append('-g'),
|
||||||
extra_link_args.append("-g"),
|
extra_link_args.append('-g'),
|
||||||
|
|
||||||
cchardet_module = Extension("cchardet._cchardet",
|
cchardet_module = Extension(
|
||||||
sources = sources,
|
'cchardet._cchardet',
|
||||||
include_dirs = [uchardet_dir,nspr_emu_dir,charsetdetect_dir],
|
sources=sources,
|
||||||
language = "c++",
|
include_dirs=[uchardet_dir, nspr_emu_dir, charsetdetect_dir],
|
||||||
|
language='c++',
|
||||||
define_macros=macros,
|
define_macros=macros,
|
||||||
)
|
)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'cchardet',
|
name='cchardet',
|
||||||
author = 'PyYoshi',
|
author='PyYoshi',
|
||||||
author_email = 'myoshi321go_at_gmail_dot_com',
|
author_email='myoshi321go_at_gmail_dot_com',
|
||||||
url = r"https://github.com/PyYoshi/cChardet",
|
url=r'https://github.com/PyYoshi/cChardet',
|
||||||
description = 'Universal encoding detector. This library is faster than chardet.',
|
description='Universal encoding detector. This library is faster than chardet.',
|
||||||
long_description= """cChardet is high speed universal character encoding detector. - binding to charsetdetect.
|
long_description='''cChardet is high speed universal character encoding detector. - binding to charsetdetect.
|
||||||
This library is faster than chardet.
|
This library is faster than chardet.
|
||||||
""",
|
''',
|
||||||
version = '1.0.0',
|
version='1.0.0',
|
||||||
license = 'MIT License',
|
license='MIT License',
|
||||||
classifiers = [
|
classifiers=[
|
||||||
'License :: OSI Approved :: MIT License',
|
'License :: OSI Approved :: MIT License',
|
||||||
'Programming Language :: Cython',
|
'Programming Language :: Cython',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
|
@ -83,15 +86,15 @@ This library is faster than chardet.
|
||||||
'Programming Language :: Python :: 2',
|
'Programming Language :: Python :: 2',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
],
|
],
|
||||||
keywords = [
|
keywords=[
|
||||||
'cython',
|
'cython',
|
||||||
'chardet',
|
'chardet',
|
||||||
'charsetdetect'
|
'charsetdetect'
|
||||||
],
|
],
|
||||||
cmdclass = {'build_ext': build_ext},
|
cmdclass={'build_ext': build_ext},
|
||||||
package_dir = {"":src_dir},
|
package_dir={'': src_dir},
|
||||||
packages = ['cchardet',],
|
packages=['cchardet', ],
|
||||||
ext_modules = [
|
ext_modules=[
|
||||||
cchardet_module
|
cchardet_module
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue