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)
|
1
|
12 |
from distutils.core import setup, Extension
|
|
13 |
|
|
14 |
def raiseConfigError(msg):
|
|
15 |
import exceptions
|
|
16 |
class ConfigError(exceptions.Exception):
|
|
17 |
pass
|
|
18 |
raise ConfigError(msg)
|
|
19 |
|
11
|
20 |
LIBS = []
|
|
21 |
LIBRARIES=[]
|
|
22 |
EXT_MODULES = []
|
|
23 |
|
|
24 |
#building pyRXP
|
1
|
25 |
if sys.platform=="win32":
|
|
26 |
LIBS=['wsock32']
|
|
27 |
elif sys.platform=="sunos5":
|
|
28 |
LIBS=['nsl', 'socket', 'dl']
|
|
29 |
elif sys.platform=="aix4":
|
|
30 |
LIBS=['nsl_r', 'dl']
|
|
31 |
else:
|
|
32 |
LIBS=[]
|
|
33 |
|
|
34 |
rxpFiles = ('xmlparser.c', 'url.c', 'charset.c', 'string16.c', 'ctype16.c',
|
11
|
35 |
'dtd.c', 'input.c', 'stdio16.c', 'system.c', 'hash.c',
|
|
36 |
'version.c', 'namespaces.c', 'http.c', 'nf16check.c', 'nf16data.c')
|
|
37 |
pyRXPDir = os.path.join(pkgDir,'src')
|
1
|
38 |
RXPLIBSOURCES=[]
|
11
|
39 |
pyRXP_c = os.path.join(pyRXPDir,'pyRXP.c')
|
|
40 |
VERSION = re.search(r'^#\s*define\s+VERSION\s*"([^"]+)"',open(pyRXP_c,'r').read(),re.MULTILINE)
|
|
41 |
VERSION = VERSION and VERSION.group(1) or 'unknown'
|
|
42 |
RXPDIR=os.path.join(pyRXPDir,'rxp')
|
|
43 |
RXPLIBSOURCES= [os.path.join(RXPDIR,f) for f in rxpFiles]
|
17
|
44 |
EXT_MODULES = [Extension( 'pyRXPU',
|
11
|
45 |
[pyRXP_c]+RXPLIBSOURCES,
|
1
|
46 |
include_dirs=[RXPDIR],
|
17
|
47 |
define_macros=[('CHAR_SIZE', 16),],
|
1
|
48 |
library_dirs=[],
|
|
49 |
# libraries to link against
|
|
50 |
libraries=LIBS,
|
22
|
51 |
#uncomment when debugging
|
|
52 |
#extra_compile_args=['/Zi'], extra_link_args=['/DEBUG'],
|
1
|
53 |
),
|
11
|
54 |
]
|
1
|
55 |
|
|
56 |
setup( name = "pyRXP",
|
|
57 |
version = VERSION,
|
|
58 |
description = "Python RXP interface - fast validating XML parser",
|
|
59 |
author = "Robin Becker",
|
|
60 |
author_email = "robin@reportlab.com",
|
|
61 |
url = "http://www.reportlab.com",
|
|
62 |
packages = [],
|
|
63 |
ext_modules = EXT_MODULES,
|
|
64 |
#license = open(os.path.join('rxp','COPYING')).read(),
|
|
65 |
classifiers = [
|
|
66 |
'Development Status :: 5 - Production/Stable',
|
|
67 |
'Intended Audience :: Developers',
|
|
68 |
'License :: OSI Approved :: ReportLab BSD derived',
|
|
69 |
'Programming Language :: Python',
|
|
70 |
'Programming Language :: C',
|
|
71 |
'Operating System :: Unix',
|
|
72 |
'Operating System :: POSIX',
|
|
73 |
'Operating System :: Microsoft :: Windows',
|
|
74 |
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
75 |
'Topic :: Text Processing :: Markup :: XML',
|
|
76 |
]
|
|
77 |
)
|