1
|
1 |
#!/usr/bin/env python
|
11
|
2 |
#Copyright ReportLab Europe Ltd. 2000-2012
|
1
|
3 |
#see license.txt for license details
|
|
4 |
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/rl_addons/pyRXP/setup.py
|
|
5 |
if __name__=='__main__': #NO RUNTESTS
|
|
6 |
import os, sys, shutil, re
|
11
|
7 |
pkgDir=os.path.dirname(sys.argv[0])
|
|
8 |
if not pkgDir:
|
|
9 |
pkgDir=os.getcwd()
|
|
10 |
elif not os.path.isabs(pkgDir):
|
|
11 |
pkgDir=os.path.abspath(pkgDir)
|
40
|
12 |
try:
|
|
13 |
from setuptools import setup, Extension
|
|
14 |
except ImportError:
|
|
15 |
from distutils.core import setup, Extension
|
1
|
16 |
|
|
17 |
def raiseConfigError(msg):
|
|
18 |
import exceptions
|
|
19 |
class ConfigError(exceptions.Exception):
|
|
20 |
pass
|
|
21 |
raise ConfigError(msg)
|
|
22 |
|
11
|
23 |
LIBS = []
|
|
24 |
LIBRARIES=[]
|
|
25 |
EXT_MODULES = []
|
49
|
26 |
EXT_KWARGS = {}
|
11
|
27 |
|
|
28 |
#building pyRXP
|
1
|
29 |
if sys.platform=="win32":
|
|
30 |
LIBS=['wsock32']
|
49
|
31 |
if sys.version_info[:2]==(3,5) and not int(os.environ.get('PYRXP35LONG','0')):
|
|
32 |
EXT_KWARGS['extra_compile_args'] = ['/Od']
|
|
33 |
#EXT_KWARGS['extra_compile_args'] = ['/Zi']
|
|
34 |
#EXT_KWARGS['extra_link_args'] = ['/DEBUG']
|
1
|
35 |
elif sys.platform=="sunos5":
|
|
36 |
LIBS=['nsl', 'socket', 'dl']
|
|
37 |
elif sys.platform=="aix4":
|
|
38 |
LIBS=['nsl_r', 'dl']
|
|
39 |
else:
|
|
40 |
LIBS=[]
|
|
41 |
|
|
42 |
rxpFiles = ('xmlparser.c', 'url.c', 'charset.c', 'string16.c', 'ctype16.c',
|
11
|
43 |
'dtd.c', 'input.c', 'stdio16.c', 'system.c', 'hash.c',
|
|
44 |
'version.c', 'namespaces.c', 'http.c', 'nf16check.c', 'nf16data.c')
|
|
45 |
pyRXPDir = os.path.join(pkgDir,'src')
|
1
|
46 |
RXPLIBSOURCES=[]
|
11
|
47 |
pyRXP_c = os.path.join(pyRXPDir,'pyRXP.c')
|
|
48 |
VERSION = re.search(r'^#\s*define\s+VERSION\s*"([^"]+)"',open(pyRXP_c,'r').read(),re.MULTILINE)
|
|
49 |
VERSION = VERSION and VERSION.group(1) or 'unknown'
|
|
50 |
RXPDIR=os.path.join(pyRXPDir,'rxp')
|
|
51 |
RXPLIBSOURCES= [os.path.join(RXPDIR,f) for f in rxpFiles]
|
17
|
52 |
EXT_MODULES = [Extension( 'pyRXPU',
|
11
|
53 |
[pyRXP_c]+RXPLIBSOURCES,
|
1
|
54 |
include_dirs=[RXPDIR],
|
17
|
55 |
define_macros=[('CHAR_SIZE', 16),],
|
1
|
56 |
library_dirs=[],
|
|
57 |
# libraries to link against
|
|
58 |
libraries=LIBS,
|
49
|
59 |
**EXT_KWARGS,
|
1
|
60 |
),
|
11
|
61 |
]
|
1
|
62 |
|
|
63 |
setup( name = "pyRXP",
|
|
64 |
version = VERSION,
|
|
65 |
description = "Python RXP interface - fast validating XML parser",
|
|
66 |
author = "Robin Becker",
|
|
67 |
author_email = "robin@reportlab.com",
|
|
68 |
url = "http://www.reportlab.com",
|
|
69 |
packages = [],
|
|
70 |
ext_modules = EXT_MODULES,
|
|
71 |
#license = open(os.path.join('rxp','COPYING')).read(),
|
|
72 |
classifiers = [
|
|
73 |
'Development Status :: 5 - Production/Stable',
|
|
74 |
'Intended Audience :: Developers',
|
|
75 |
'License :: OSI Approved :: ReportLab BSD derived',
|
|
76 |
'Programming Language :: Python',
|
|
77 |
'Programming Language :: C',
|
|
78 |
'Operating System :: Unix',
|
|
79 |
'Operating System :: POSIX',
|
|
80 |
'Operating System :: Microsoft :: Windows',
|
|
81 |
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
82 |
'Topic :: Text Processing :: Markup :: XML',
|
|
83 |
]
|
|
84 |
)
|