author | robin |
Tue, 24 Aug 2021 11:27:45 +0100 | |
changeset 95 | ca1fbee6a03c |
parent 92 | 0b0a17f9d877 |
child 104 | e61305acbc68 |
permissions | -rw-r--r-- |
1 | 1 |
#!/usr/bin/env python |
85
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
2 |
#Copyright ReportLab Europe Ltd. 2000-2021 |
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 |
|
85
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
6 |
import os, sys, 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) |
|
85
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
12 |
#test to see if we've a special command |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
13 |
if 'test' in sys.argv: |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
14 |
if len(sys.argv)!=2: |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
15 |
raise ValueError('test command may only be used alone sys.argv[1:]=%s' % repr(sys.argv[1:])) |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
16 |
cmd = sys.argv[-1] |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
17 |
os.chdir(os.path.join(pkgDir,'test')) |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
18 |
r = os.system(' '.join((sys.executable, 'runAll.py'))) |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
19 |
sys.exit(('!!!!! runAll.py --> %s exited with error !!!!!' % r) if r else r) |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
20 |
elif 'null-cmd' in sys.argv or 'null-command' in sys.argv: |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
21 |
sys.exit(0) |
75ebfe9feba5
switch to using cibuildwheel, make tests easier; version --> 2.2.2
robin
parents:
65
diff
changeset
|
22 |
|
40 | 23 |
try: |
24 |
from setuptools import setup, Extension |
|
25 |
except ImportError: |
|
26 |
from distutils.core import setup, Extension |
|
1 | 27 |
|
28 |
def raiseConfigError(msg): |
|
29 |
import exceptions |
|
30 |
class ConfigError(exceptions.Exception): |
|
31 |
pass |
|
32 |
raise ConfigError(msg) |
|
33 |
||
11 | 34 |
LIBS = [] |
35 |
LIBRARIES=[] |
|
36 |
EXT_MODULES = [] |
|
49 | 37 |
EXT_KWARGS = {} |
92
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
38 |
DEFINE_MACROS=[('CHAR_SIZE', 16)] |
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
39 |
for ev in ('DEBUG_INPUT',): |
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
40 |
evv = os.environ.get(ev,'') |
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
41 |
try: |
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
42 |
evv = int(evv) |
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
43 |
except: |
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
44 |
pass |
95 | 45 |
else: |
46 |
if evv: |
|
47 |
DEFINE_MACROS.append((ev,evv)) |
|
11 | 48 |
|
49 |
#building pyRXP |
|
1 | 50 |
if sys.platform=="win32": |
51 |
LIBS=['wsock32'] |
|
57 | 52 |
if sys.version_info[:2]>=(3,5) and not int(os.environ.get('PYRXP35LONG','0')): |
49 | 53 |
EXT_KWARGS['extra_compile_args'] = ['/Od'] |
54 |
#EXT_KWARGS['extra_compile_args'] = ['/Zi'] |
|
55 |
#EXT_KWARGS['extra_link_args'] = ['/DEBUG'] |
|
1 | 56 |
elif sys.platform=="sunos5": |
57 |
LIBS=['nsl', 'socket', 'dl'] |
|
58 |
elif sys.platform=="aix4": |
|
59 |
LIBS=['nsl_r', 'dl'] |
|
60 |
else: |
|
61 |
LIBS=[] |
|
62 |
||
63 |
rxpFiles = ('xmlparser.c', 'url.c', 'charset.c', 'string16.c', 'ctype16.c', |
|
11 | 64 |
'dtd.c', 'input.c', 'stdio16.c', 'system.c', 'hash.c', |
65 |
'version.c', 'namespaces.c', 'http.c', 'nf16check.c', 'nf16data.c') |
|
66 |
pyRXPDir = os.path.join(pkgDir,'src') |
|
1 | 67 |
RXPLIBSOURCES=[] |
11 | 68 |
pyRXP_c = os.path.join(pyRXPDir,'pyRXP.c') |
69 |
VERSION = re.search(r'^#\s*define\s+VERSION\s*"([^"]+)"',open(pyRXP_c,'r').read(),re.MULTILINE) |
|
70 |
VERSION = VERSION and VERSION.group(1) or 'unknown' |
|
71 |
RXPDIR=os.path.join(pyRXPDir,'rxp') |
|
72 |
RXPLIBSOURCES= [os.path.join(RXPDIR,f) for f in rxpFiles] |
|
17 | 73 |
EXT_MODULES = [Extension( 'pyRXPU', |
11 | 74 |
[pyRXP_c]+RXPLIBSOURCES, |
1 | 75 |
include_dirs=[RXPDIR], |
92
0b0a17f9d877
add setup.py macro handling; fix test command and artifact name
robin
parents:
85
diff
changeset
|
76 |
define_macros=DEFINE_MACROS, |
1 | 77 |
library_dirs=[], |
78 |
# libraries to link against |
|
79 |
libraries=LIBS, |
|
50 | 80 |
**EXT_KWARGS |
1 | 81 |
), |
11 | 82 |
] |
1 | 83 |
|
65 | 84 |
with open('LICENSE.txt','r') as _: |
85 |
license = _.read() |
|
1 | 86 |
setup( name = "pyRXP", |
87 |
version = VERSION, |
|
88 |
description = "Python RXP interface - fast validating XML parser", |
|
89 |
author = "Robin Becker", |
|
90 |
author_email = "robin@reportlab.com", |
|
91 |
url = "http://www.reportlab.com", |
|
92 |
packages = [], |
|
65 | 93 |
license=open('LICENSE.txt','r').read(), |
1 | 94 |
ext_modules = EXT_MODULES, |
63
9ee8c8d7cc04
added a LICENSE.txt version-->2.1.2
robin <robin@reportlab.com>
parents:
62
diff
changeset
|
95 |
package_data = {'': ['pyRXP-license.txt']}, |
1 | 96 |
#license = open(os.path.join('rxp','COPYING')).read(), |
97 |
classifiers = [ |
|
98 |
'Development Status :: 5 - Production/Stable', |
|
99 |
'Intended Audience :: Developers', |
|
62
d19872af425c
fix spelling of classifier yet again
robin <robin@reportlab.com>
parents:
61
diff
changeset
|
100 |
'License :: OSI Approved :: BSD License', |
1 | 101 |
'Programming Language :: Python', |
102 |
'Programming Language :: C', |
|
103 |
'Operating System :: Unix', |
|
104 |
'Operating System :: POSIX', |
|
105 |
'Operating System :: Microsoft :: Windows', |
|
106 |
'Topic :: Software Development :: Libraries :: Python Modules', |
|
107 |
'Topic :: Text Processing :: Markup :: XML', |
|
108 |
] |
|
109 |
) |