[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Sagemath: going further



Hi,

I've been a little busy with sage recently :

jpuydt@cauchy:~/sage-exp$ wc -l /tmp/ptestlong.log.*
  247159 /tmp/ptestlong.log.1
   91206 /tmp/ptestlong.log.2
   21563 /tmp/ptestlong.log.3
   13453 /tmp/ptestlong.log.4
   15762 /tmp/ptestlong.log.5
   12012 /tmp/ptestlong.log.6
   10320 /tmp/ptestlong.log.7
  411475 total

Let me remind you all of this is done by using as many system-installed packages as possible, in order to see which debian packages need to be modified and how. Until now, only maxima needs some love, and we're lacking packages for : libgap, cddlib, rubiks, sagenb, sagetex, singular and jmol.

I have attached my current patch ; I'm sorry it is a big contains-all patch and not a series, but it's easier to work like this for the moment. I'm exploring uncharted territory, not doing clean packaging. Yet.

The src/sage/interfaces/gp.py part has been quite painful to obtain, but might make Felix cry -- of joy!

I hope that helps,

Snark on #debian-science
diff --git a/build/deps b/build/deps
index afb6f3c..979559c 100644
--- a/build/deps
+++ b/build/deps
@@ -4,7 +4,7 @@
 ###############################################################################
 
 # Do not put an explicit path for sage-spkg here, it will be found in $PATH.
-SAGE_SPKG = sage-spkg -f
+SAGE_SPKG = sage-spkg
 PIPE = $(SAGE_ROOT)/build/pipestatus
 
 # Tell make not to look for files with these names:
@@ -506,7 +506,7 @@ $(INST)/sage: \
 		 $(INST)/csage
 	if [ -z "$$SAGE_INSTALL_FETCH_ONLY" ]; then \
 		cd $(SAGE_SRC) && source bin/sage-env && \
-		$(PIPE) 'time python setup.py install 2>&1' 'tee -a $(SAGE_LOGS)/sage-$(SAGE_VERSION).log' && \
+		$(PIPE) 'time python setup.py install --user 2>&1' 'tee -a $(SAGE_LOGS)/sage-$(SAGE_VERSION).log' && \
 		touch $@; \
 	fi
 
diff --git a/build/pkgs/sagenb/spkg-install b/build/pkgs/sagenb/spkg-install
index 65865a9..8db034a 100755
--- a/build/pkgs/sagenb/spkg-install
+++ b/build/pkgs/sagenb/spkg-install
@@ -40,9 +40,9 @@ fi
 
 # Install dependencies
 for PKG in $(cat src/install_order); do
-    easy_install -H None "src/$PKG" || die "Error installing $PKG !"
+    easy_install --user -H None "src/$PKG" || die "Error installing $PKG !"
 done
 PKG=$(ls -1 src | GREP_OPTIONS= grep sagenb-)
 
 # Install sagenb into site-packages
-easy_install -H None "src/$PKG" || die "Error installing sagenb !"
+easy_install --user -H None "src/$PKG" || die "Error installing sagenb !"
diff --git a/src/bin/sage b/src/bin/sage
index 2452a09..9857fd8 100755
--- a/src/bin/sage
+++ b/src/bin/sage
@@ -286,16 +286,16 @@ fi
 # Prepare for running Sage, either interactively or non-interactively.
 sage_setup() {
     # Check that we're not in a source tarball which hasn't been built yet (#13561).
-    if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
-        echo >&2 '************************************************************************'
-        echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
-        echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
-        echo >&2 'finished). You should run `make` in the Sage root directory first.'
-        echo >&2 'If you did not intend to build Sage from source, you should download'
-        echo >&2 'a binary tarball instead. Read README.txt for more information.'
-        echo >&2 '************************************************************************'
-        exit 1
-    fi
+    # if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
+    #     echo >&2 '************************************************************************'
+    #     echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
+    #     echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
+    #     echo >&2 'finished). You should run `make` in the Sage root directory first.'
+    #     echo >&2 'If you did not intend to build Sage from source, you should download'
+    #     echo >&2 'a binary tarball instead. Read README.txt for more information.'
+    #     echo >&2 '************************************************************************'
+    #     exit 1
+    # fi
 
     # Display the startup banner
     if [ "$SAGE_BANNER" != "no" ]; then
diff --git a/src/bin/sage-build b/src/bin/sage-build
index f7a3780..2cfba92 100755
--- a/src/bin/sage-build
+++ b/src/bin/sage-build
@@ -27,4 +27,4 @@ scons -Q install
 
 # build sage library
 cd "$SAGE_SRC"
-python setup.py install
+python setup.py install --user
diff --git a/src/bin/sage-env b/src/bin/sage-env
index 43f265b..e4d5712 100644
--- a/src/bin/sage-env
+++ b/src/bin/sage-env
@@ -247,8 +247,8 @@ fi
 # Setting Sage-related location environment variables.
 export SAGE_LOCAL="$SAGE_ROOT/local"
 export SAGE_ETC="$SAGE_LOCAL/etc"
-export SAGE_SHARE="$SAGE_LOCAL/share"
-export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
+export SAGE_SHARE="/usr/share/sagemath"
+export SAGE_EXTCODE="$SAGE_LOCAL/share/sage/ext"
 export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
 export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
 export SAGE_SRC="$SAGE_ROOT/src"
@@ -300,14 +300,14 @@ if [ -n "$MULTI_ARCH" ]; then
 fi
 
 # For PARI/GP
-GP_DATA_DIR="$SAGE_LOCAL/share/pari" && export GP_DATA_DIR
-GPHELP="$SAGE_LOCAL/bin/gphelp" && export GPHELP
-GPDOCDIR="$SAGE_LOCAL/share/pari/doc" && export GPDOCDIR
+GP_DATA_DIR="/usr/share/pari" && export GP_DATA_DIR
+GPHELP="/usr/bin/gphelp" && export GPHELP
+GPDOCDIR="/usr/share/pari/doc" && export GPDOCDIR
 
 # Allow git to work without warning messages after relocating Sage.
 # See trac #15901.
-GIT_TEMPLATE_DIR="$SAGE_LOCAL"/share/git-core/templates && export GIT_TEMPLATE_DIR
-GIT_EXEC_PATH="$SAGE_LOCAL"/libexec/git-core && export GIT_EXEC_PATH
+#GIT_TEMPLATE_DIR="$SAGE_LOCAL"/share/git-core/templates && export GIT_TEMPLATE_DIR
+#GIT_EXEC_PATH="$SAGE_LOCAL"/libexec/git-core && export GIT_EXEC_PATH
 
 SINGULARPATH="$SAGE_LOCAL/share/singular" && export SINGULARPATH
 SINGULAR_EXECUTABLE="$SAGE_LOCAL/bin/Singular" && export SINGULAR_EXECUTABLE
@@ -429,7 +429,7 @@ fi
 unset R_HOME
 unset R_PROFILE
 
-MAXIMA_PREFIX="$SAGE_ROOT/local" && export MAXIMA_PREFIX
+#MAXIMA_PREFIX="$SAGE_ROOT/local" && export MAXIMA_PREFIX
 
 ############ architecture flags
 
@@ -603,7 +603,7 @@ if [ "$UNAME" = "CYGWIN" ]; then
 fi
 
 # See trac 7186 -- this is needed if ecl is moved
-ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
+#ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
 
 # Handle parallel building/testing/...
 # See Trac Ticket #12016
diff --git a/src/c_lib/SConstruct b/src/c_lib/SConstruct
index 18092c8..5a6fc47 100644
--- a/src/c_lib/SConstruct
+++ b/src/c_lib/SConstruct
@@ -126,8 +126,8 @@ env['PYV']=platform.python_version().rsplit('.', 1)[0]
 # The SCons convenience function Split is the only strange thing
 # to python programmers. It just makes a list by splitting on
 # whitespace without the syntax clutter of lists of strings.
-includes = ['$SAGE_LOCAL/include/', '$SAGE_LOCAL/include/python$PYV/',
-            '$SAGE_LOCAL/include/NTL/', 'include']
+includes = ['/usr/include/', '/usr/include/python$PYV/',
+            '/usr/include/NTL/', '/usr/include/Lfunction', 'include']
 cFiles = Split( "convert.c  interrupt.c  memory.c  mpn_pylong.c  mpz_pylong.c") + \
          Split( "mpz_longlong.c stdsage.c  gmp_globals.c" )
 cppFiles = Split( "ZZ_pylong.cpp  ntl_wrap.cpp" )
@@ -138,7 +138,7 @@ incFiles = Split( "ccobject.h  convert.h  gmp_globals.h" ) + \
 
 lib = env.SharedLibrary( "csage", [ "src/" + x for x in srcFiles ],
                          LIBS=['ntl', 'pari', 'gmp', 'python$PYV'],
-                         LIBPATH=['$SAGE_LOCAL/lib','$SAGE_LOCAL/lib/python$PYV/config/'],
+                         LIBPATH=['/usr/lib','/usr/lib/python$PYV/config/'],
                          CPPPATH=includes )
 env.Install("$SAGE_LOCAL/lib", lib)
 env.Install("$SAGE_LOCAL/include/csage", [ os.path.join('include',x) for x in incFiles ])
diff --git a/src/module_list.py b/src/module_list.py
index 0684b95..5027109 100755
--- a/src/module_list.py
+++ b/src/module_list.py
@@ -4,7 +4,7 @@ import os
 from distutils.extension import Extension
 from sage.env import SAGE_LOCAL
 
-SAGE_INC = os.path.join(SAGE_LOCAL, 'include')
+SAGE_INC = os.path.join('/usr', 'include')
 
 #########################################################
 ### BLAS setup
@@ -741,7 +741,7 @@ ext_modules = [
               sources = ['sage/libs/lcalc/lcalc_Lfunction.pyx'],
               libraries = ['m', 'ntl', 'mpfr', 'gmp', 'gmpxx',
                            'Lfunction'],
-              include_dirs = [SAGE_INC + "/libLfunction"],
+              include_dirs = [SAGE_INC + "/Lfunction"],
               extra_compile_args=["-O3", "-ffast-math"],
               language = 'c++'),
 
diff --git a/src/sage/dev/all.py b/src/sage/dev/all.py
index a085a8c..2de0442 100644
--- a/src/sage/dev/all.py
+++ b/src/sage/dev/all.py
@@ -1,3 +1,3 @@
 from sage.misc.lazy_import import lazy_import
 
-lazy_import('sage.dev.sagedev_instance', 'dev')
+#lazy_import('sage.dev.sagedev_instance', 'dev')
diff --git a/src/sage/env.py b/src/sage/env.py
index d102c9d..ccd4c5f 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -89,7 +89,7 @@ _add_variable_or_fallback('LOCAL_IDENTIFIER','$HOSTNAME.%s'%os.getpid())
 _add_variable_or_fallback('SAGE_ROOT',       None)
 _add_variable_or_fallback('SAGE_LOCAL',      opj('$SAGE_ROOT', 'local'))
 _add_variable_or_fallback('SAGE_ETC',        opj('$SAGE_LOCAL', 'etc'))
-_add_variable_or_fallback('SAGE_SHARE',      opj('$SAGE_LOCAL', 'share'))
+_add_variable_or_fallback('SAGE_SHARE',      opj('/usr/share/sagemath'))
 
 _add_variable_or_fallback('SAGE_SRC',        opj('$SAGE_ROOT', 'src'))
 _add_variable_or_fallback('SITE_PACKAGES',   site.getsitepackages())
diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
index 3e9f93a..e94d262 100644
--- a/src/sage/interfaces/gap.py
+++ b/src/sage/interfaces/gap.py
@@ -189,7 +189,7 @@ GAP_DIR = os.path.join(DOT_SAGE, 'gap')
 
 WORKSPACE = os.path.join(GAP_DIR, 'workspace-%s'%abs(hash(SAGE_LOCAL)))
 
-GAP_BINARY = os.path.join(SAGE_LOCAL, 'bin', 'gap')
+GAP_BINARY = os.path.join('/usr', 'bin', 'gap')
 
 first_try = True
 
diff --git a/src/sage/interfaces/gp.py b/src/sage/interfaces/gp.py
index 79a6f00..f13e51d 100644
--- a/src/sage/interfaces/gp.py
+++ b/src/sage/interfaces/gp.py
@@ -212,6 +212,9 @@ class Gp(Expect):
         self.__var_store_len = 0
         self.__init_list_length = init_list_length
 
+    def _start(self, alt_message=None, block_during_init=True):
+        Expect._start(self, alt_message, block_during_init)
+        self._eval_line('default(breakloop,0);')
 
     def _repr_(self):
         """
@@ -486,7 +489,7 @@ class Gp(Expect):
             sage: gp.get_default('log')
             0
             sage: gp.get_default('datadir')
-            '.../local/share/pari'
+            '.../share/pari'
             sage: gp.get_default('seriesprecision')
             16
             sage: gp.get_default('realprecision')
@@ -1000,9 +1003,6 @@ def is_GpElement(x):
 from sage.env import DOT_SAGE, SAGE_ETC
 import os
 
-# Set GPRC environment variable to $SAGE_ETC/gprc.expect
-os.environ["GPRC"] = os.path.join(SAGE_ETC, 'gprc.expect')
-
 # An instance
 gp = Gp(logfile=os.path.join(DOT_SAGE,'gp-expect.log')) # useful for debugging!
 
diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
index d723ac2..e1b91a5 100644
--- a/src/sage/interfaces/maxima.py
+++ b/src/sage/interfaces/maxima.py
@@ -758,7 +758,7 @@ class Maxima(MaximaAbstract, Expect):
         if not wait_for_prompt:
             return
         # line_echo sometimes has randomly inserted terminal echo in front #15811
-        assert line_echo.strip().endswith(line.strip()), 'mismatch:\n' + line_echo + line
+        #assert line_echo.strip().endswith(line.strip()), 'mismatch:\n' + line_echo + line
 
         self._expect_expr(self._display_prompt)
         out = self._before()        # input echo + output prompt + output
diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
index aca815b..a88bb70 100644
--- a/src/sage/libs/gap/util.pyx
+++ b/src/sage/libs/gap/util.pyx
@@ -158,7 +158,7 @@ def gap_root():
         '/home/vbraun/opt/sage-5.3.rc0/local/gap/latest'
     """
     import os.path
-    gapdir = os.path.join(SAGE_LOCAL, 'gap', 'latest')
+    gapdir = '/usr/share/gap'
     if os.path.exists(gapdir):
         return gapdir
     print 'The gap-4.5.5.spkg (or later) seems to be not installed!'
diff --git a/src/setup.py b/src/setup.py
index f55d9e7..f351f7c 100644
--- a/src/setup.py
+++ b/src/setup.py
@@ -146,9 +146,9 @@ if os.path.exists(sage.misc.lazy_import_cache.get_cache_file()):
 # (that are likely to change on an upgrade) here:
 # [At least at the moment. Make sure the headers aren't copied with "-p",
 # or explicitly touch them in the respective spkg's spkg-install.]
-lib_headers = { "gmp":     [ os.path.join(SAGE_INC, 'gmp.h') ],   # cf. #8664, #9896
-                "gmpxx":   [ os.path.join(SAGE_INC, 'gmpxx.h') ],
-                "ntl":     [ os.path.join(SAGE_INC, 'NTL', 'config.h') ]
+lib_headers = { "gmp":     [ os.path.join('/usr/include', 'gmp.h') ],   # cf. #8664, #9896
+                "gmpxx":   [ os.path.join('/usr/include' 'gmpxx.h') ],
+                "ntl":     [ os.path.join('/usr/include', 'NTL', 'config.h') ]
               }
 
 # In the loop below, don't append to any list, since many of these
@@ -174,7 +174,7 @@ for m in ext_modules:
 
     m.extra_compile_args = m.extra_compile_args + extra_compile_args
     m.extra_link_args = m.extra_link_args + extra_link_args
-    m.library_dirs = m.library_dirs + [os.path.join(SAGE_LOCAL, "lib")]
+    m.library_dirs = m.library_dirs + [os.path.join(SAGE_LOCAL, "lib"), '/usr/lib']
     m.include_dirs = m.include_dirs + include_dirs
 
 

Reply to: