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