Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > media > contrib-updates-src > by-pkgid > f9766b2784ead2e70f39891aff92024b > files > 18

sagemath-4.4-5mdv2010.2.src.rpm

diff -p -up sage-4.4/module_list.py.orig sage-4.4/module_list.py
--- sage-4.4/spkg/build/sage-4.4/module_list.py.orig	2010-04-28 17:34:51.802193607 -0300
+++ sage-4.4/spkg/build/sage-4.4/module_list.py	2010-04-28 17:36:36.873257276 -0300
@@ -73,7 +73,7 @@ else:
 ### Commonly used include directories
 #########################################################
 
-numpy_include_dirs = [SAGE_ROOT+'/local/lib/python/site-packages/numpy/core/include']
+numpy_include_dirs = [SAGE_ROOT+'/local/lib/python2.6/site-packages/numpy/core/include']
 
 #########################################################
 ### PolyBoRi defines
@@ -1468,33 +1468,19 @@ ext_modules = [
               language = 'c++',
               depends = [SAGE_ROOT + "/local/include/pynac/ginac.h"],
               libraries = ["pynac"]),
-
-    ]
-
-# Optional extensions :
-# These extensions are to be compiled only if the
-# corresponding packages have been installed
-
-from sage.misc.package import is_package_installed
-
-if is_package_installed('glpk'):
-    ext_modules.append(
-        Extension("sage.numerical.mip_glpk",
-                  ["sage/numerical/mip_glpk.pyx"],
-                  include_dirs = [SAGE_ROOT+"/local/include/", "sage/c_lib/include/"],
-                  language = 'c++',
-                  libraries=["csage", "stdc++", "glpk"])
-        )
-
-if is_package_installed('cbc'):
-    ext_modules.append(
-        Extension("sage.numerical.mip_coin",
-                  ["sage/numerical/mip_coin.pyx"],
-                  include_dirs = [SAGE_ROOT+"/local/include/","sage/c_lib/include/"],
-                  language = 'c++',
-                  libraries = ["csage", "stdc++", "Cbc", "CbcSolver", "Cgl", "Clp", "CoinUtils", "OsiCbc", "OsiClp", "Osi", "OsiVol", "Vol"])
-        )
     
+    Extension('sage.numerical.mip_glpk',
+    	      sources = ['sage/numerical/mip_glpk.pyx'],
+              include_dirs = [SAGE_ROOT + "/local/include/coin", "c_lib/include/"],
+              language = 'c++',
+              libraries=["csage", "stdc++", "glpk"]),
+    
+    Extension('sage.numerical.mip_coin',
+              sources = ['sage/numerical/mip_coin.pyx'],
+              include_dirs = [SAGE_ROOT + "/local/include/coin", "c_lib/include/"],
+              language = 'c++',
+              libraries = ["csage", "stdc++", "Cbc", "CbcSolver", "Cgl", "Clp", "CoinUtils", "OsiCbc", "OsiClp", "Osi", "OsiVol", "Vol"])
+    ]
 
 # Only include darwin_utilities on OS_X >= 10.5
 UNAME = os.uname()
diff -p -up sage-4.4/sage/numerical/mip_coin.pxd.orig sage-4.4/sage/numerical/mip_coin.pxd
--- sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_coin.pxd.orig	2010-04-28 17:37:00.981196825 -0300
+++ sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_coin.pxd	2010-04-28 17:38:46.907202147 -0300
@@ -1,26 +1,26 @@
 cdef extern from *:
     ctypedef double* const_double_ptr "const double*"
 
-cdef extern from "../../local/include/coin/CoinPackedVector.hpp":
+cdef extern from "coin/CoinPackedVector.hpp":
      ctypedef struct c_CoinPackedVector "CoinPackedVector":
          void insert(float, float)
      c_CoinPackedVector *new_c_CoinPackedVector "new CoinPackedVector" ()
      void del_CoinPackedVector "delete" (c_CoinPackedVector *)
-cdef extern from "../../local/include/coin/CoinPackedMatrix.hpp":
+cdef extern from "coin/CoinPackedMatrix.hpp":
      ctypedef struct c_CoinPackedMatrix "CoinPackedMatrix":
          void setDimensions(int, int)
          void appendRow(c_CoinPackedVector)
      c_CoinPackedMatrix *new_c_CoinPackedMatrix "new CoinPackedMatrix" (bool, double, double)
      void del_CoinPackedMatrix "delete" (c_CoinPackedMatrix *)
 
-cdef extern from "../../local/include/coin/CoinMessageHandler.hpp":
+cdef extern from "coin/CoinMessageHandler.hpp":
      ctypedef struct c_CoinMessageHandler "CoinMessageHandler":
          void setLogLevel (int)
      c_CoinMessageHandler *new_c_CoinMessageHandler "new CoinMessageHandler" ()
      void del_CoinMessageHandler "delete" (c_CoinMessageHandler *)
 
 
-cdef extern from "../../local/include/coin/CbcModel.hpp":
+cdef extern from "coin/CbcModel.hpp":
      ctypedef struct c_CbcModel "CbcModel":
          c_CoinMessageHandler * messageHandler ()
          void setNumberThreads (int)
@@ -29,7 +29,7 @@ cdef extern from "../../local/include/co
      c_CbcModel *new_c_CbcModel "new CbcModel" ()
      void del_CbcModel "delete" (c_CbcModel *)
 
-cdef extern from "../../local/include/coin/OsiCbcSolverInterface.hpp":
+cdef extern from "coin/OsiCbcSolverInterface.hpp":
      ctypedef struct c_OsiCbcSolverInterface "OsiCbcSolverInterface":
          double getInfinity()
          void loadProblem(c_CoinPackedMatrix, const_double_ptr, const_double_ptr, const_double_ptr, const_double_ptr, const_double_ptr)
diff -p -up sage-4.4/sage/numerical/mip_coin.pyx.orig sage-4.4/sage/numerical/mip_coin.pyx
--- sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_coin.pyx.orig	2010-04-28 17:37:15.599195887 -0300
+++ sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_coin.pyx	2010-04-28 17:38:46.909202240 -0300
@@ -1,5 +1,5 @@
 include 'mip_coin.pxd'
-include '../../../../devel/sage/sage/ext/stdsage.pxi'
+include '../ext/stdsage.pxi'
 
 cdef int BINARY = 1
 cdef int REAL = -1
diff -p -up sage-4.4/sage/numerical/mip_glpk.pxd.orig sage-4.4/sage/numerical/mip_glpk.pxd
--- sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_glpk.pxd.orig	2010-04-28 17:38:03.314196439 -0300
+++ sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_glpk.pxd	2010-04-28 17:38:46.909202240 -0300
@@ -1,7 +1,7 @@
 cdef extern from *:
     ctypedef double* const_double_ptr "const double*"
 
-cdef extern from "../../local/include/glpk.h":
+cdef extern from "glpk.h":
      ctypedef struct c_glp_prob "glp_prob":
          pass
      ctypedef struct c_glp_iocp "glp_iocp":
diff -p -up sage-4.4/sage/numerical/mip_glpk.pyx.orig sage-4.4/sage/numerical/mip_glpk.pyx
--- sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_glpk.pyx.orig	2010-04-28 17:38:06.199201879 -0300
+++ sage-4.4/spkg/build/sage-4.4/sage/numerical/mip_glpk.pyx	2010-04-28 17:38:46.910194621 -0300
@@ -5,7 +5,7 @@ AUTHOR:
 """
 
 include 'mip_glpk.pxd'
-include '../../../../devel/sage/sage/ext/stdsage.pxi'
+include '../ext/stdsage.pxi'
 
 cdef int BINARY = 1
 cdef int REAL = -1
diff -p -up sage-4.4/setup.py.orig sage-4.4/setup.py
--- sage-4.4/spkg/build/sage-4.4/setup.py.orig	2010-04-28 17:38:17.284192970 -0300
+++ sage-4.4/spkg/build/sage-4.4/setup.py	2010-04-28 17:38:46.911195754 -0300
@@ -4,6 +4,8 @@ import os, sys, time
 from distutils.core import setup
 from distutils.extension import Extension
 
+import distutils.sysconfig
+
 #########################################################
 ### List of Extensions
 ###
@@ -33,32 +35,23 @@ else:
     SAGE_LOCAL = SAGE_ROOT + '/local/'
     SAGE_DEVEL = SAGE_ROOT + '/devel/'
 
+if os.environ.has_key('DESTDIR'):
+    DESTDIR = os.environ['DESTDIR']
+else:
+    DESTDIR = ''
+
 if not os.environ.has_key('SAGE_VERSION'):
     SAGE_VERSION=0
 else:
     SAGE_VERSION = os.environ['SAGE_VERSION']
 
-SITE_PACKAGES = '%s/lib/python/site-packages/'%SAGE_LOCAL
-if not os.path.exists(SITE_PACKAGES):
-    SITE_PACKAGES = '%s/lib/python2.5/site-packages/'%SAGE_LOCAL
-    if not os.path.exists(SITE_PACKAGES):
-        SITE_PACKAGES = '%s/lib/python2.4/site-packages/'%SAGE_LOCAL
-        if not os.path.exists(SITE_PACKAGES) and os.environ.has_key('SAGE_DEBIAN'):
-            SITE_PACKAGES = '%s/lib/python2.5/site-packages/'%SAGE_LOCAL
-            os.system('mkdir -p "%s"'%SITE_PACKAGES)
-        if not os.path.exists(SITE_PACKAGES):        
-            raise RuntimeError, "Unable to find site-packages directory (see setup.py file in sage python code)."
-
 if not os.path.exists('build/sage'):
     os.makedirs('build/sage')
 
-sage_link = SITE_PACKAGES + '/sage'
-if not os.path.islink(sage_link) or not os.path.exists(sage_link):
-    os.system('rm -rf "%s"'%sage_link)
-    os.system('cd %s; ln -sf ../../../../devel/sage/build/sage .'%SITE_PACKAGES)
+SITE_PACKAGES = distutils.sysconfig.get_python_lib(plat_specific=1)
 
 include_dirs = ['%s/include'%SAGE_LOCAL, \
-                '%s/include/csage'%SAGE_LOCAL, \
+                'c_lib/include', \
                 ## this is included, but doesn't actually exist
                 ## '%s/include/python'%SAGE_LOCAL, \
                 '%s/sage/sage/ext'%SAGE_DEVEL]
@@ -124,7 +117,7 @@ for m in ext_modules:
     if os.environ.has_key('SAGE_DEBIAN'):
         m.library_dirs += ['/usr/lib','/usr/lib/eclib','/usr/lib/singular','/usr/lib/R/lib','%s/lib' % SAGE_LOCAL]
     else:
-        m.library_dirs += ['%s/lib' % SAGE_LOCAL]
+        m.library_dirs += ['c_lib', '%s/lib' % SAGE_LOCAL]
 
 
 
@@ -464,7 +457,7 @@ class sage_build_ext(build_ext):
 ###### Dependency checking
 #############################################
 
-CYTHON_INCLUDE_DIRS=[ SAGE_LOCAL + '/lib/python/site-packages/Cython/Includes/' ]
+CYTHON_INCLUDE_DIRS=[ SAGE_LOCAL + '/lib/python2.6/site-packages/Cython/Includes/' ]
 
 # matches any dependency
 import re
@@ -577,7 +570,7 @@ class DependencyTree:
                 # so we really couldn't find the dependency -- raise
                 # an exception. 
                 if not found_include:
-                    if path[-2:] != '.h':  # there are implicit headers from distutils, etc
+                    if path[-2:] != '.h' and path[-4:] != '.hpp':  # there are implicit headers from distutils, etc
                         raise IOError, "could not find dependency %s included in %s."%(path, filename)
         f.close()
         return list(deps)
@@ -668,6 +661,10 @@ def compile_command(p):
         else:
             outfile += ".c"
 
+        # speed up if doing an incremental builds
+        if os.path.exists(outfile) and os.path.getmtime(outfile) > os.path.getmtime(f):
+            return 0
+
         # call cython, abort if it failed
         cmd = "python `which cython` --embed-positions --directive cdivision=True -I%s -o %s %s"%(os.getcwd(), outfile, f)
         r = run_command(cmd)
@@ -675,7 +672,7 @@ def compile_command(p):
             return r
 
         # if cython worked, copy the file to the build directory
-        pyx_inst_file = '%s/%s'%(SITE_PACKAGES, f)
+        pyx_inst_file = '%s/%s/%s'%(DESTDIR, SITE_PACKAGES, f)
         retval = os.system('cp %s %s 2>/dev/null'%(f, pyx_inst_file))
         # we could do this more elegantly -- load the files, use
         # os.path.exists to check that they exist, etc. ... but the