--- python/pyGiNaC/setup.py 2001/03/15 13:48:35 1.4 +++ python/pyGiNaC/setup.py 2001/05/20 08:58:02 1.29 @@ -1,32 +1,50 @@ #!/usr/bin/env python - -import sys,os,string,time - -if eval(sys.version[0])<2: - print "You'll need Python 2.0 or higher to build PyGiNaC" - sys.exit() +# +# Setup file for building/installing PyGiNaC +# +# Requirements: +# Python 2.1 or higher (http://www.python.org/) +# GiNaC 0.8.1 or higher (http://www.ginac.de/) +# For GiNaC, you'll need CLN 1.1 (http://clisp.cons.org/~haible/packages-cln.html) +# Optional, but recommended, CLN can use GMP 3.1.1 (http://www.swox.com/gmp/) +# Boost 1.21.1 or higher (http://www.boost.org/) +# +# Usage: +# > python setup.py install # this will build and install ginac +# > python setup.py test -v # this will run doctests. +# +# In Python `import ginac'. See doc/ginac.doc.html for examples. +# See GiNaC documentation (http://www.ginac.de/tutorial/) for +# capabilities and limitations. +# +# Pearu Peterson +# 26 April 2001 + +import sys,os + +gentest = 0 +if 'test' in sys.argv: + i = sys.argv.index('test') + gentest = 1 + if len(sys.argv)>i+1 and sys.argv[i+1]=='-v': + gentest = 2 + del sys.argv[i+1] + del sys.argv[i] #++++++++++++++++++++ boost +++++++++++++++++++++ -boost_dir = '/home/pearu/cvs/boost' -boost_dir = '/usr/local/share/boost' -bpl_dir = os.path.join(boost_dir,'libs/python/src') +boost_dir = 'boost' +bpl_dir = os.path.join(boost_dir,'libs','python','src') bpl_src = map(lambda f:os.path.join(bpl_dir,f), ['classes.cpp','conversions.cpp','extension_class.cpp', 'functions.cpp','init_function.cpp','module_builder.cpp', 'objects.cpp','types.cpp']) -#++++++++++++++++++++ GiNaC +++++++++++++++++++++ - -#ginac = '/usr/local' - -#ginac_lib = - - #++++++++++++++++++++++++++++++++++++++++++++++++ from distutils.core import setup, Extension -#+++++++++++++ replace gcc with g++ +++++++++++++ +#+++HACK: replace linker gcc with g++ +++++++++++ + from distutils import sysconfig save_init_posix = sysconfig._init_posix def my_init_posix(): @@ -38,30 +56,70 @@ def my_init_posix(): print 'to',`g['LDSHARED']` sysconfig._init_posix = my_init_posix -#++++++++++++++++++++ GiNaC._ginac +++++++++++++++++++++ +#+++++++++++++++++ PyGiNaC version ++++++++++++++ -cppsrc = [os.path.join('src','_ginac.cpp')] -cppsrc = [os.path.join('tools','wrappers','ginac.cpp')] +wrapper_dir = 'wrappers3' +lib_dir = 'lib3' -ginac_ext = Extension('GiNaC._ginac', - sources=cppsrc+bpl_src, - include_dirs=[boost_dir], - libraries=['cln','ginac'], - library_dirs=[] - ) +major_version = 0 +minor_version = 4 +try: execfile(os.path.join('tools','get_revision.py')) +except: revision_version = 0 +version='%d.%d.%d'%(major_version,minor_version,revision_version) + +#++++++++++++++++ ginac._ginac +++++++++++++++++++++ + +ex_src = [ + os.path.join(wrapper_dir,'ginac_enhancements.cpp'), + os.path.join(wrapper_dir,'ex_py.cpp'), + os.path.join(wrapper_dir,'python_repr.cpp'), + os.path.join(wrapper_dir,'python_str.cpp'), + os.path.join(wrapper_dir,'python_csrc.cpp'), + os.path.join(wrapper_dir,'pyfunc.cpp'), + os.path.join(wrapper_dir,'slice.c'), + ] + +if gentest: + fon = os.path.join(lib_dir,'doc','__init__.py') + if gentest==2: + os.system('%s %s -v'%(sys.executable,fon)) + elif gentest==1: + os.system('%s %s'%(sys.executable,fon)) +if len(sys.argv)==1: + print "PyGiNaC Version",version + sys.exit() + +ginac_ext = Extension('ginac._ginac', + sources=ex_src+bpl_src, + include_dirs=[boost_dir,wrapper_dir], + libraries=['ginac','cln'], +# Add here the paths to the location +# of ginac and cln libraries: + library_dirs=[], + ) #++++++++++++++++++++ setup +++++++++++++++++++++ setup (name = "PyGiNaC", - version = "0.0.0", - description = "", + version = version, + description = "PyGiNaC --- Python Interface to GiNaC", author = "Pearu Peterson", author_email = "pearu@cens.ioc.ee", + maintainer = "Pearu Peterson", + maintainer_email = "pearu@cens.ioc.ee", licence = "LGPL", - long_description= "", - url = "", + long_description= """ +GiNaC is an open framework for symbolic computation within the C++ +programming language (http://www.ginac.de/). +PyGiNaC is a Python extension package that provides +an interface to the GiNaC library. +""", + url = "http://cens.ioc.ee/projects/pyginac/", ext_modules = [ ginac_ext ], - packages = ['GiNaC'], - package_dir = {'GiNaC': 'lib'}, + packages = ['ginac','ginac.doc'], + package_dir = {'ginac': lib_dir, + 'ginac.doc':os.path.join(lib_dir,'doc') }, ) + +print "PyGiNaC Version",version