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
|
import sys, os
from distutils.core import setup, Extension
# monkey-patch distutils if it can't cope with the "classifiers" and
# "download_url" keywords
if sys.version < '2.2.3':
from distutils.dist import DistributionMetadata
DistributionMetadata.classifiers = None
DistributionMetadata.download_url = None
# Check if MPIR or GMP should be used.
mplib='gmp'
for token in sys.argv:
if token.startswith('-D') and 'MPIR' in token:
mplib='mpir'
break
# determine include and library dirs
incdirs = libdirs = ()
if sys.version.find('MSC') == -1:
# Unix-like build (including MacOSX)
incdirs = ['./src']
dirord = ['/opt/local', '/usr/local']
for adir in dirord:
lookin = '%s/include' % adir
if os.path.isfile(lookin + '/' + mplib + '.h'):
incdirs.append(lookin)
break
for adir in dirord:
lookin = '%s/lib' % adir
if os.path.isfile(lookin + '/lib' + mplib + '.a'):
libdirs = [lookin]
break
# decomment next line (w/gcc, only!) to support gcov
# os.environ['CFLAGS'] = '-fprofile-arcs -ftest-coverage -O0'
# prepare the extension for building
gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'],
include_dirs=incdirs,
library_dirs=libdirs,
libraries=[mplib])
setup (name = "gmpy",
version = "1.11",
maintainer = "Alex Martelli",
maintainer_email = "aleaxit@gmail.com",
url = "http://code.google.com/p/gmpy/",
description = "MPIR/GMP interface to Python 2.4+ and 3.x",
# download_url = "http://http://prdownloads.sourceforge.net/gmpy/gmpy-sources-101.zip?download",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
'Natural Language :: English',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: C',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development :: Libraries :: Python Modules',
],
ext_modules = [ gmpy_ext ]
)
|