-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
108 lines (94 loc) · 2.49 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/python
#from distutils.core import setup, Extension
from setuptools import setup, Extension
import os
import sys
import re
import string
def readme() :
with open('README.md') as f:
return f.read()
incdir = []
libdir = []
libs = [ 'chardet', 'stdc++' ]
defs = []
major_version = sys.version[0]
try:
import pkgconfig
pkg = pkgconfig.parse ('chardet')
libdir += pkg['library_dirs']
incdir += pkg['include_dirs']
except ImportError:
chardet_env = (os.popen ('chardet-config --libs')).read ()
envlist = chardet_env.split ()
for arg in envlist :
if arg[1] == 'L' :
libdir.append (arg[2:])
del envlist
chardet_defs = (os.popen ('chardet-config --defs')).read ()
envlist = chardet_defs.split ()
for arg in envlist :
if arg[1] == 'I' :
incdir.append (arg[2:])
del envlist
setup (
name = 'chardet',
version = '2.0.1',
description = 'python binding for libchardet API',
long_description=readme(),
author = 'JoungKyun.Kim',
author_email = '[email protected]',
url = 'http://oops.org',
license = 'MPL 1.1',
platforms = 'x86/x86_64',
packages = { 'chardet' },
ext_modules = [
Extension (
'chardet._chardet',
[ 'src/chardet.c', 'src/common.c' ],
include_dirs = incdir,
library_dirs = libdir,
libraries = libs,
define_macros = defs
),
Extension (
'chardet.universaldetector',
[ 'src/universaldetector.c', 'src/common.c' ],
include_dirs = incdir,
library_dirs = libdir,
libraries = libs,
define_macros = defs
),
Extension (
'chardet_c',
[ 'src/chardet_c.c', 'src/common.c' ],
include_dirs = incdir,
library_dirs = libdir,
libraries = libs,
define_macros = defs
),
],
classifiers = [
("License :: OSI Approved :: MIT License" +
" Public License (LGPL)"),
"Programming Language :: C++",
"Programming Language :: Python",
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules'
],
keywords = [ 'encoding', 'charset', 'i18n' ]
)
#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noet sw=4 ts=4 fdm=marker
# vim<600: noet sw=4 ts=4
#