#################################################################################1#2# (c) Copyright 2010 William Stein3#4# This file is part of PSAGE5#6# PSAGE is free software: you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by8# the Free Software Foundation, either version 3 of the License, or9# (at your option) any later version.10#11# PSAGE is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU General Public License for more details.15#16# You should have received a copy of the GNU General Public License17# along with this program. If not, see <http://www.gnu.org/licenses/>.18#19#################################################################################202122import os, sys232425if sys.maxint != 2**63 - 1:26print "*"*7027print "The PSAGE library only works on 64-bit computers. Terminating build."28print "*"*7029sys.exit(1)303132import build_system3334SAGE_ROOT = os.environ['SAGE_ROOT']35SAGE_LOCAL = os.environ['SAGE_LOCAL']3637INCLUDES = ['%s/%s/'%(SAGE_ROOT,x) for x in38('devel/sage/sage/ext', 'devel/sage', 'devel/sage/sage/gsl', \39'src/build/cythonized/sage/ext', 'src')] \40+ ['%s/%s/'%(SAGE_LOCAL,x) for x in41('include', 'include/python', 'lib/python2.7/site-packages/cysignals')] + ['../','../../','.','../../../','../../../../']42if '-ba' in sys.argv:43print "Rebuilding all Cython extensions."44sys.argv.remove('-ba')45FORCE = True46else:47FORCE = False4849def Extension(*args, **kwds):50if not kwds.has_key('include_dirs'):51kwds['include_dirs'] = INCLUDES52else:53kwds['include_dirs'] += INCLUDES54if not kwds.has_key('force'):55kwds['force'] = FORCE5657# Disable warnings when running GCC step -- cython has already parsed the code and58# generated any warnings; the GCC ones are noise.59if not kwds.has_key('extra_compile_args'):60kwds['extra_compile_args'] = ['-w']61else:62kwds['extra_compile_args'].append('-w')6364return build_system.Extension(*args, **kwds)656667numpy_include_dirs = [os.path.join(SAGE_LOCAL,68'lib/python/site-packages/numpy/core/include')]6970ext_modules = [71# Extension("psage.ellff.ellff",72# ["psage/ellff/ellff.pyx",73# "psage/ellff/ell.cpp",74# "psage/ellff/ell_surface.cpp",75# "psage/ellff/euler.cpp",76# "psage/ellff/helper.cpp",77# "psage/ellff/jacobi.cpp",78# "psage/ellff/lzz_pEExtra.cpp",79# "psage/ellff/lzz_pEratX.cpp"],80# language = 'c++'),81#82# Extension("psage.function_fields.function_field_element",83# ["psage/function_fields/function_field_element.pyx"]),84#85# Extension("psage.modform.jacobiforms.jacobiformd1nn_fourierexpansion_cython",86# ["psage/modform/jacobiforms/jacobiformd1nn_fourierexpansion_cython.pyx"]),87#88# Extension("psage.modform.paramodularforms.siegelmodularformg2_misc_cython",89# ["psage/modform/paramodularforms/siegelmodularformg2_misc_cython.pyx"]),90#91# Extension("psage.modform.paramodularforms.siegelmodularformg2_fourierexpansion_cython",92# ["psage/modform/paramodularforms/siegelmodularformg2_fourierexpansion_cython.pyx"]),93#94# Extension("psage.modform.paramodularforms.siegelmodularformg2vv_fegenerators_cython",95# ["psage/modform/paramodularforms/siegelmodularformg2vv_fegenerators_cython.pyx"]),96#97# Extension("psage.modform.paramodularforms.paramodularformd2_fourierexpansion_cython",98# ["psage/modform/paramodularforms/paramodularformd2_fourierexpansion_cython.pyx"]),99#100# Extension("psage.modform.siegel.fastmult",101# ["psage/modform/siegel/fastmult.pyx"]),102#103# Extension('psage.modform.maass.mysubgroups_alg',104# ['psage/modform/maass/mysubgroups_alg.pyx']),105#106# Extension('psage.modform.maass.maass_forms_alg',107# ['psage/modform/maass/maass_forms_alg.pyx'],108# include_dirs = numpy_include_dirs),109#110# Extension('psage.modform.maass.lpkbessel',111# ['psage/modform/maass/lpkbessel.pyx']),112113114# Extension("psage.modform.rational.modular_symbol_map",115# ["psage/modform/rational/modular_symbol_map.pyx"]),116117# Extension("psage.modform.rational.padic_elliptic_lseries_fast",118# ["psage/modform/rational/padic_elliptic_lseries_fast.pyx"]),119120Extension("psage.modform.hilbert.sqrt5.sqrt5_fast",121["psage/modform/hilbert/sqrt5/sqrt5_fast.pyx"],122libraries = ['ntl', 'gmp'],123language = 'c++'),124125Extension("psage.ellcurve.lseries.sqrt5",126["psage/ellcurve/lseries/sqrt5.pyx"],127libraries = ['ntl', 'gmp'],128language = 'c++'),129130Extension("psage.ellcurve.lseries.helper",131["psage/ellcurve/lseries/helper.pyx"]),132133Extension('psage.ellcurve.galrep.wrapper',134sources = ['psage/ellcurve/galrep/wrapper.pyx', 'psage/ellcurve/galrep/galrep.c'],135libraries = ['gmp']),136137Extension('psage.ellcurve.minmodel.sqrt5',138sources = ['psage/ellcurve/minmodel/sqrt5.pyx'],139libraries = ['gmp']),140141# Extension('psage.rh.mazur_stein.game',142# sources = ['psage/rh/mazur_stein/game.pyx']),143144# Extension('psage.rh.mazur_stein.book_cython',145# sources = ['psage/rh/mazur_stein/book_cython.pyx']),146147Extension("psage.ellcurve.lseries.fast_twist",148["psage/ellcurve/lseries/fast_twist.pyx"],149libraries = ['gsl']),150151Extension("psage.ellcurve.lseries.aplist_sqrt5",152["psage/ellcurve/lseries/aplist_sqrt5.pyx"],153language = 'c++'),154155Extension("psage.number_fields.sqrt5.prime",156["psage/number_fields/sqrt5/prime.pyx"],157libraries = ['pari']),158159# Extension("psage.modform.rational.special_fast",160# ["psage/modform/rational/special_fast.pyx"],161# libraries = ['gmp', 'flint'],162# language = 'c++',163# include_dirs = [SAGE_LOCAL + '/include/FLINT/', SAGE_ROOT + '/devel/sage/sage/libs/flint/'],164# extra_compile_args = ['-std=c99']),165166Extension("psage.ellcurve.xxx.rankbound",167sources = [ 'psage/ellcurve/xxx/rankbound.pyx',168'psage/ellcurve/xxx/rankbound_.cc',169'psage/ellcurve/xxx/mathlib.cc',170'psage/libs/smalljac/wrapper_g1.c'],171libraries = ['gmp', 'm'],172include_dirs = ['psage/libs/smalljac/'],173language = 'c'174)175]176177for g in [1, 2]:178e = Extension('psage.libs.smalljac.wrapper%s'%g,179sources = ['psage/libs/smalljac/wrapper%s.pyx'%g,180'psage/libs/smalljac/wrapper_g%s.c'%g],181libraries = ['gmp', 'm'])182ext_modules.append(e)183184185186# I just had a long chat with Robert Bradshaw (a Cython dev), and he187# told me the following functionality -- turning an Extension with188# Cython code into one without -- along with proper dependency189# checking, is now included in the latest development version of190# Cython (Nov 2, 2010). It's supposed to be a rewrite he did of the191# code in the Sage library. Hence once that gets released, we should192# switch to using it here.193194build_system.cythonize(ext_modules)195196build_system.setup(197name = 'psage',198version = "2011.01.06",199description = "PSAGE: Software for Arithmetic Geometry",200author = 'William Stein',201author_email = '[email protected]',202url = 'http://purple.sagemath.org',203license = 'GPL v2+',204packages = ['psage',205'psage.ellcurve',206'psage.ellcurve.lseries',207208#'psage.ellff',209210#'psage.function_fields',211212'psage.lmfdb',213'psage.lmfdb.ellcurves',214'psage.lmfdb.ellcurves.sqrt5',215216'psage.modform',217218#'psage.modform.fourier_expansion_framework',219#'psage.modform.fourier_expansion_framework.gradedexpansions',220#'psage.modform.fourier_expansion_framework.modularforms',221#'psage.modform.fourier_expansion_framework.monoidpowerseries',222223'psage.modform.hilbert',224'psage.modform.hilbert.sqrt5',225226'psage.modform.rational',227228#'psage.modform.siegel',229#'psage.modform.jacobiforms',230#'psage.modform.maass',231232'psage.number_fields',233'psage.number_fields.sqrt5',234235#'psage.rh',236#'psage.rh.mazur_stein'237],238platforms = ['any'],239download_url = 'NA',240ext_modules = ext_modules241)242243244245