summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libre/sagemath/PKGBUILD34
-rw-r--r--libre/sagemath/ecm-7.patch79
-rw-r--r--libre/sagemath/gap-4.8.patch378
-rw-r--r--libre/sagemath/is-package-installed.patch387
-rw-r--r--libre/sagemath/linbox-1.4.patch470
-rw-r--r--libre/sagemath/paths.patch2
6 files changed, 956 insertions, 394 deletions
diff --git a/libre/sagemath/PKGBUILD b/libre/sagemath/PKGBUILD
index 292176d53..e074b7bc0 100644
--- a/libre/sagemath/PKGBUILD
+++ b/libre/sagemath/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 171916 2016-04-26 17:25:19Z arojas $
+# $Id: PKGBUILD 175566 2016-05-17 19:19:04Z arojas $
# Maintainer (Arch): Evgeniy Alekseev <arcanis.arch at gmail dot com>
# Maintainer (Arch): Antonio Rojas <arojas@archlinux.org>
# Contributor (Arch): Daniel Wallace <danielwallace at gtmanfred dot com>
@@ -10,14 +10,14 @@
# Maintainer: André Silva <emulatorman@parabola.nu>
pkgname=sagemath
-pkgver=7.1
-pkgrel=9.parabola1
+pkgver=7.2
+pkgrel=2.parabola1
pkgdesc="Free Mathematics Software, free software replacement of Magma, Maple, Mathematica, and Matlab, without nonfree nauty support"
arch=(i686 x86_64 armv7h)
url="http://www.sagemath.org"
license=(GPL)
depends=(ipython2 cysignals ppl mpfi palp brial singular cliquer maxima-ecl gfan sympow tachyon python2-rpy2
- python2-matplotlib python2-scipy python2-sympy python2-networkx python2-igraph python2-pillow libgap flintqs lcalc lrcalc lrs arb
+ python2-matplotlib python2-scipy python2-sympy python2-networkx python2-igraph python2-pillow libgap flintqs lcalc lrcalc arb
eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox gsl rubiks pari-galdata pari-seadata-small planarity rankwidth
sage-data-combinatorial_designs sage-data-elliptic_curves sage-data-graphs sage-data-polytopes_db sage-data-conway_polynomials)
optdepends=('cython2: to compile cython code' 'jmol: 3D plots' 'sage-notebook: Browser-based (flask) notebook interface'
@@ -26,6 +26,7 @@ optdepends=('cython2: to compile cython code' 'jmol: 3D plots' 'sage-notebook: B
'buckygen: for generating fullerene graphs' 'plantri: for generating some classes of graphs' 'benzene: for generating fusenes and benzenoids'
'modular_decomposition: modular decomposition of graphs' 'ffmpeg: to export animations to video' 'imagemagick: to show animations'
'coxeter3: Coxeter groups implementation' 'cryptominisat: SAT solver' 'gap-data: for computing Galois groups'
+ 'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes'
'jupyter-notebook: Jupyter notebook interface' 'atlas-lapack: improved performance for some linear algebra operations')
makedepends=(cython2 boost ratpoints symmetrica fflas-ffpack python2-jinja coin-or-cbc
mcqd coxeter3 cryptominisat modular_decomposition bliss-graphs tdlib python2-pkgconfig meataxe) # libfes
@@ -34,22 +35,24 @@ replaces=(sage-mathematics)
provides=(sage-mathematics)
source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
pexpect.zip::"https://github.com/pexpect/pexpect/archive/524495960dd8898ddd30f7ba37298de51beee773.zip"
- anal.h package.patch env.patch paths.patch clean.patch skip-check.patch cython-sys-path.patch
- disable-fes.patch jupyter-path.patch test-optional.patch python-2.7.11.patch gap-4.8.patch)
-md5sums=('c68e846444b9370fe79f43395cdc2725'
+ anal.h env.patch paths.patch clean.patch skip-check.patch cython-sys-path.patch is-package-installed.patch package.patch
+ disable-fes.patch jupyter-path.patch test-optional.patch python-2.7.11.patch linbox-1.4.patch ecm-7.patch)
+md5sums=('2afeb8f75a33107fef5d509698c0eabc'
'a346bb2c0350c1cb17d5325235c5e38a'
'a906a180d198186a39820b0a2f9a9c63'
- '9ba81f717ffd4e20b8b2f2a318307488'
'f6c62f0ccc168c5e6e3dd9d6f73f6389'
- '0f746ed394fd7eb7a6b3963014976098'
+ '52d30e91110183489f66d7bf73c36c64'
'6d9ae0978ce6a05a0da2cafdfb178a09'
'5947a420a0b1483f0cbc74c76895789b'
'a1bcdd3fe620dbae60ed8b0e98b2ece7'
+ '541988696465f204235d595a349017f3'
+ '9ba81f717ffd4e20b8b2f2a318307488'
'4eb23a3c7363258bc9ba764d6e5512ba'
'16b529194c6105c3364127bd8f1efa83'
'cdcabd475b80afe0534a5621e972736e'
'ef927896f2071b442b1d07d7e69f5f3a'
- '8f631f4132d3a97dade07e4c60044aed')
+ '9f1cef3e477bafebe2ad301db56db8a2'
+ '0c9a57d35de80c2cd418ebec912efbbb')
prepare(){
cd sage-$pkgver
@@ -71,9 +74,6 @@ prepare(){
patch -p0 -i ../skip-check.patch
# supress warning about GAP install dir
sed -e "s|gapdir = os.path.join(SAGE_LOCAL, 'gap', 'latest')|gapdir = '/usr/lib/gap'|" -i src/sage/libs/gap/util.pyx
-# fix Cremona database detection
- sed -e "s|is_package_installed('database_cremona_ellcurve')|os.path.exists('/usr/share/sage/cremona/cremona.db')|" \
- -i src/sage/databases/cremona.py
# find bliss headers
sed -e 's|graph.hh|bliss/graph.hh|' -i src/sage/graphs/bliss.pyx
# don't list optional packages when running tests
@@ -84,14 +84,18 @@ prepare(){
patch -p0 -i ../python-2.7.11.patch
# search system paths for cython includes
patch -p1 -i ../cython-sys-path.patch
+# fix regressions with ECM 7
+ patch -p1 -i ../ecm-7.patch
# Upstream patches
# fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209
# patch -p0 -i ../fes02.patch
# disable fes module, fails to compile
patch -p0 -i ../disable-fes.patch
-# port to GAP 4.8 http://trac.sagemath.org/ticket/19911
- patch -p1 -i ../gap-4.8.patch
+# port to new givaro/fflas-ffpack/linbox http://trac.sagemath.org/ticket/17635
+ patch -p1 -i ../linbox-1.4.patch
+# replace is_package_installed usage http://trac.sagemath.org/ticket/20377
+ patch -p1 -i ../is-package-installed.patch
# use python2
sed -e 's|#!/usr/bin/env python|#!/usr/bin/env python2|' -e 's|exec python|exec python2|' -i src/bin/*
diff --git a/libre/sagemath/ecm-7.patch b/libre/sagemath/ecm-7.patch
new file mode 100644
index 000000000..617e18d98
--- /dev/null
+++ b/libre/sagemath/ecm-7.patch
@@ -0,0 +1,79 @@
+--- a/src/sage/interfaces/ecm.py.orig 2016-05-16 22:18:03.894827738 +0200
++++ b/src/sage/interfaces/ecm.py 2016-05-16 22:19:14.674904932 +0200
+@@ -140,9 +140,6 @@
+ - ``ve`` -- integer `n`. Verbosely show short (`< n`
+ character) expressions on each loop
+
+- - ``cofdec`` -- boolean. Force cofactor output in decimal
+- (even if expressions are used )
+-
+ - ``B2scale`` -- integer. Multiplies the default B2 value
+
+ - ``go`` -- integer. Preload with group order val, which can
+@@ -395,15 +392,15 @@
+ if m is not None:
+ factor = m.group('factor')
+ primality = m.group('primality')
+- assert primality in ['probable prime', 'composite']
+- result += [(ZZ(factor), primality == 'probable prime')]
++ assert primality in ['prime', 'composite']
++ result += [(ZZ(factor), primality == 'prime')]
+ continue # cofactor on the next line
+ m = self._found_cofactor_re.match(line)
+ if m is not None:
+ cofactor = m.group('cofactor')
+ primality = m.group('primality')
+- assert primality in ['Probable prime', 'Composite']
+- result += [(ZZ(cofactor), primality == 'Probable prime')]
++ assert primality in ['Prime', 'Composite']
++ result += [(ZZ(cofactor), primality == 'Prime')]
+ # assert len(result) == 2
+ return result
+ raise ValueError('failed to parse ECM output')
+@@ -501,7 +498,6 @@
+ if factor_digits is not None:
+ B1 = self.recommended_B1(factor_digits)
+ kwds['one'] = True
+- kwds['cofdec'] = True
+ cmd = self._make_cmd(B1, None, kwds)
+ out = self._run_ecm(cmd, n)
+ return self._parse_output(n, out)
+@@ -828,8 +828,8 @@
+ Step 1 took 12ms
+ Step 2 took 17ms
+ ********** Factor found in step 2: 79792266297612017
+-Found probable prime factor of 17 digits: 79792266297612017
+-Probable prime cofactor 6366805760909027985741435139224233 has 34 digits
++Found prime factor of 17 digits: 79792266297612017
++Prime cofactor 6366805760909027985741435139224233 has 34 digits
+ """
+
+ TEST_ECM_OUTPUT_2 = """
+@@ -839,8 +839,8 @@
+ Step 1 took 2ms
+ Step 2 took 3ms
+ ********** Factor found in step 2: 179424673
+-Found probable prime factor of 9 digits: 179424673
+-Probable prime cofactor 179424673 has 9 digits
++Found prime factor of 9 digits: 179424673
++Prime cofactor 179424673 has 9 digits
+ """
+
+ TEST_ECM_OUTPUT_3 = """
+@@ -858,7 +858,7 @@
+ Step 1 took 5ms
+ Step 2 took 4ms
+ ********** Factor found in step 2: 197002597249
+-Found probable prime factor of 12 digits: 197002597249
++Found prime factor of 12 digits: 197002597249
+ Composite cofactor 339872432034468861533158743041639097889948066859 has 48 digits
+ """
+
+@@ -870,5 +870,5 @@
+ Step 2 took 2ms
+ ********** Factor found in step 2: 265748496095531068869578877937
+ Found composite factor of 30 digits: 265748496095531068869578877937
+-Probable prime cofactor 251951573867253012259144010843 has 30 digits
++Prime cofactor 251951573867253012259144010843 has 30 digits
+ """
+
diff --git a/libre/sagemath/gap-4.8.patch b/libre/sagemath/gap-4.8.patch
deleted file mode 100644
index af8ed5027..000000000
--- a/libre/sagemath/gap-4.8.patch
+++ /dev/null
@@ -1,378 +0,0 @@
-diff --git a/src/ext/gap/console.g b/src/ext/gap/console.g
-index 57043ff..db8b925 100644
---- a/src/ext/gap/console.g
-+++ b/src/ext/gap/console.g
-@@ -1,6 +1,6 @@
--# If we are loaded with a workspace then $SAGE will be defined and in
-+# If we are loaded with a workspace then \$SAGE will be defined and in
- # that case we need to call StartInteract so that the pager will be
- # set correctly. See trac #5043.
--if IsBound($SAGE) then
-- $SAGE.StartInteract();
-+if IsBound(\$SAGE) then
-+ \$SAGE.StartInteract();
- fi;
-diff --git a/src/ext/gap/sage.g b/src/ext/gap/sage.g
-index 8535b7d..2216fda 100644
---- a/src/ext/gap/sage.g
-+++ b/src/ext/gap/sage.g
-@@ -2,15 +2,15 @@
- #
- # SAGE support utilities to read into the GAP session.
- #
--$SAGE := rec();
-+\$SAGE := rec();
-
--$SAGE.OldPager := Pager;
-+\$SAGE.OldPager := Pager;
-
-
--$SAGE.NewPager :=
-+\$SAGE.NewPager :=
- function( data )
- local str, lines, line, fn, start;
-- str := OutputTextFile($SAGE.tempfile,false);
-+ str := OutputTextFile(\$SAGE.tempfile,false);
- start := 1;
- if IsRecord(data) then
- lines := data.lines;
-@@ -30,38 +30,38 @@ $SAGE.NewPager :=
- Print("Page from ",start,"\n");
- end;
-
--$SAGE.StartInteract := function()
-+\$SAGE.StartInteract := function()
- MakeReadWriteGlobal("Pager");
-- Pager := $SAGE.OldPager;
-- HELP_VIEWER_INFO.screen.show := $SAGE.OldPager;
-+ Pager := \$SAGE.OldPager;
-+ HELP_VIEWER_INFO.screen.show := \$SAGE.OldPager;
- MakeReadOnlyGlobal("Pager");
- end;
-
-
--$SAGE.StopInteract := function()
-+\$SAGE.StopInteract := function()
- MakeReadWriteGlobal("Pager");
-- Pager := $SAGE.NewPager;
-- HELP_VIEWER_INFO.screen.show := $SAGE.NewPager;
-+ Pager := \$SAGE.NewPager;
-+ HELP_VIEWER_INFO.screen.show := \$SAGE.NewPager;
- MakeReadOnlyGlobal("Pager");
- end;
-
-
--$SAGE.StopInteract();
-+\$SAGE.StopInteract();
-
--#$SAGE.ErrorHandler := function(m,a,m2,mode)
-+#\$SAGE.ErrorHandler := function(m,a,m2,mode)
- # PrintTo("*errout*", m);
- # if a <> fail then
- # PrintTo("*errout*",a);
- # fi;
--# SetErrorHandler($SAGE.ErrorHandler);
-+# SetErrorHandler(\$SAGE.ErrorHandler);
- # return true;
- #end;
-
--#SetErrorHandler($SAGE.ErrorHandler);
-+#SetErrorHandler(\$SAGE.ErrorHandler);
-
- SetAllInfoLevels(0);
-
--$SAGE.OperationsAdmittingFirstArgument := function(obj)
-+\$SAGE.OperationsAdmittingFirstArgument := function(obj)
- local hits, myflags, i, flagss, flags;
- hits := [];
- myflags := FlagsType(TypeObj(obj));
-@@ -78,7 +78,7 @@ $SAGE.OperationsAdmittingFirstArgument := function(obj)
- end;
-
-
--$SAGE.CleanOperationName := function(name)
-+\$SAGE.CleanOperationName := function(name)
- local lt, ls;
- lt := Length("Tester(");
- if Length(name) > lt and name{[1..lt]} = "Tester(" then
-@@ -91,7 +91,7 @@ $SAGE.CleanOperationName := function(name)
- return name;
- end;
-
--$SAGE.HasAtLeastOneMethodAsFirstArgument := function(op,obj)
-+\$SAGE.HasAtLeastOneMethodAsFirstArgument := function(op,obj)
- local t, f, n, meths, i;
- t := TypeObj(obj);
- f := FlagsType(t);
-@@ -107,11 +107,11 @@ $SAGE.HasAtLeastOneMethodAsFirstArgument := function(op,obj)
- end;
-
-
--$SAGE.PlausibleTabCompletionsForSage := function(o)
-+\$SAGE.PlausibleTabCompletionsForSage := function(o)
- local ops, opnames;
-- ops := Filtered($SAGE.OperationsAdmittingFirstArgument(o), op ->
-- $SAGE.HasAtLeastOneMethodAsFirstArgument(op,o));
-- opnames := List(ops, op -> $SAGE.CleanOperationName(NameFunction(op)));
-+ ops := Filtered(\$SAGE.OperationsAdmittingFirstArgument(o), op ->
-+ \$SAGE.HasAtLeastOneMethodAsFirstArgument(op,o));
-+ opnames := List(ops, op -> \$SAGE.CleanOperationName(NameFunction(op)));
- return Concatenation(opnames, GLOBAL_FUNCTION_NAMES);
- end;
-
-diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
-index 92a4393..fd856ef 100644
---- a/src/sage/groups/finitely_presented.py
-+++ b/src/sage/groups/finitely_presented.py
-@@ -1168,9 +1168,7 @@ class FinitelyPresentedGroup(GroupMixinLibGAP, UniqueRepresentation,
- You can attempt to reduce the presentation of the output group::
-
- sage: D = C2.semidirect_product(C8, hom); D
-- Finitely presented group < a, b, c, d |
-- a^2, b^-1*a^-1*b*a*d^-1*c^-1, c^-1*a^-1*c*a*d^-1, d^-1*a^-1*d*a,
-- b^2*c^-1, c^-1*b^-1*c*b, d^-1*b^-1*d*b, c^2*d^-1, d^-1*c^-1*d*c, d^2 >
-+ Finitely presented group < a, b | a^2, b^8, a^-1*b*a*b >
- sage: D = C2.semidirect_product(C8, hom, reduced=True); D
- Finitely presented group < a, b | a^2, (a*b)^2, b^8 >
-
-@@ -1178,10 +1176,9 @@ class FinitelyPresentedGroup(GroupMixinLibGAP, UniqueRepresentation,
- sage: C4 = groups.presentation.Cyclic(4)
- sage: hom = (C3.gens(), [(C4.gens(), C4.gens())])
- sage: C3.semidirect_product(C4, hom)
-- Finitely presented group < a, b, c |
-- a^3, b^-1*a^-1*b*a, c^-1*a^-1*c*a, b^2*c^-1, c^-1*b^-1*c*b, c^2 >
-+ Finitely presented group < a, b | a^3, b^4, a^-1*b*a*b^-1 >
- sage: D = C3.semidirect_product(C4, hom, reduced=True); D
-- Finitely presented group < a, b | a^3, b^4, b^-1*a^-1*b*a >
-+ Finitely presented group < a, b | a^3, b^4, a^-1*b*a*b^-1 >
- sage: D.as_permutation_group().is_cyclic()
- True
-
-@@ -1193,9 +1190,7 @@ class FinitelyPresentedGroup(GroupMixinLibGAP, UniqueRepresentation,
- sage: C12 = groups.presentation.Cyclic(12)
- sage: hom = (C5.gens(), [(C12.gens(), C12.gens())])
- sage: sp = C5.semidirect_product(C12, hom, check=False); sp
-- Finitely presented group < a, b, c, d |
-- a^5, b^-1*a^-1*b*a, c^-1*a^-1*c*a, d^-1*a^-1*d*a, b^2*d^-1,
-- c^-1*b^-1*c*b, d^-1*b^-1*d*b, c^3, d^-1*c^-1*d*c, d^2 >
-+ Finitely presented group < a, b | a^5, b^12, a^-1*b*a*b^-1 >
- sage: sp.as_permutation_group().is_cyclic(), sp.order()
- (True, 60)
-
-diff --git a/src/sage/groups/matrix_gps/matrix_group.py b/src/sage/groups/matrix_gps/matrix_group.py
-index 698a587..3e200e6 100644
---- a/src/sage/groups/matrix_gps/matrix_group.py
-+++ b/src/sage/groups/matrix_gps/matrix_group.py
-@@ -584,19 +584,19 @@ class MatrixGroup_gap(GroupMixinLibGAP, MatrixGroup_generic, ParentLibGAP):
- sage: i = iter(GL(6,5))
- sage: [ next(i) for j in range(8) ]
- [
-- [1 0 0 0 0 0] [4 0 0 0 0 1] [0 4 0 0 0 0] [0 4 0 0 0 0]
-- [0 1 0 0 0 0] [4 0 0 0 0 0] [0 0 4 0 0 0] [0 0 4 0 0 0]
-- [0 0 1 0 0 0] [0 4 0 0 0 0] [0 0 0 4 0 0] [0 0 0 4 0 0]
-- [0 0 0 1 0 0] [0 0 4 0 0 0] [0 0 0 0 4 0] [0 0 0 0 4 0]
-- [0 0 0 0 1 0] [0 0 0 4 0 0] [0 0 0 0 0 4] [0 0 0 0 0 4]
-- [0 0 0 0 0 1], [0 0 0 0 4 0], [1 4 0 0 0 0], [2 4 0 0 0 0],
-+ [1 0 0 0 0 0] [2 0 0 0 0 0] [3 0 0 0 0 0] [3 2 0 0 0 0]
-+ [0 1 0 0 0 0] [0 1 0 0 0 0] [0 1 0 0 0 0] [0 1 0 0 0 0]
-+ [0 0 1 0 0 0] [0 0 1 0 0 0] [0 0 1 0 0 0] [0 0 1 0 0 0]
-+ [0 0 0 1 0 0] [0 0 0 1 0 0] [0 0 0 1 0 0] [0 0 0 1 0 0]
-+ [0 0 0 0 1 0] [0 0 0 0 1 0] [0 0 0 0 1 0] [0 0 0 0 1 0]
-+ [0 0 0 0 0 1], [0 0 0 0 0 1], [0 0 0 0 0 1], [0 0 0 0 0 1],
- <BLANKLINE>
-- [3 0 0 0 0 1] [4 0 0 1 3 3] [0 0 0 2 0 0] [1 0 0 0 4 4]
-- [3 0 0 0 0 0] [4 0 0 0 3 3] [0 0 0 0 4 0] [1 0 0 0 0 4]
-- [0 4 0 0 0 0] [3 0 0 0 0 1] [2 2 0 0 0 2] [1 0 0 0 0 0]
-- [0 0 4 0 0 0] [3 0 0 0 0 0] [1 4 0 0 0 0] [0 1 0 0 0 0]
-- [0 0 0 4 0 0] [0 4 0 0 0 0] [0 2 4 0 0 0] [0 0 1 0 0 0]
-- [4 0 0 0 2 3], [2 0 3 4 4 4], [0 0 1 4 0 0], [0 0 0 1 0 0]
-+ [2 1 0 0 0 0] [3 3 0 2 3 0] [2 4 0 1 4 0] [1 2 4 1 0 3]
-+ [0 1 0 0 0 0] [0 1 0 0 0 0] [0 1 0 0 0 0] [0 1 0 0 0 0]
-+ [0 0 1 0 0 0] [0 0 1 0 0 0] [0 0 1 0 0 0] [0 0 1 0 0 0]
-+ [0 0 0 1 0 0] [0 0 0 1 0 0] [0 0 0 1 0 0] [0 0 0 1 0 0]
-+ [0 0 0 0 1 0] [0 0 0 0 1 0] [0 0 0 0 1 0] [0 0 0 0 1 0]
-+ [0 0 0 0 0 1], [0 0 0 0 0 1], [0 0 0 0 0 1], [0 0 0 0 0 1]
- ]
-
- This is the direct computation in GAP, which will just run
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 2a426f1..5295949 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -1548,18 +1548,23 @@ class PermutationGroup_generic(group.FiniteGroup):
-
- EXAMPLES::
-
-- sage: SymmetricGroup(10).stabilizer(4)._order()
-+ sage: G = SymmetricGroup(10).subgroup([(i, 10) for i in range(1, 10) if i != 4])
-+ sage: G._order()
- 362880
-- sage: SymmetricGroup(10).stabilizer(4).stabilizer(5)._order()
-- 40320
-- sage: SymmetricGroup(200).stabilizer(100)._order() == factorial(199) # this should be very fast
-- True
-
- TESTS::
-
- sage: [SymmetricGroup(n).stabilizer(1)._gap_().Size() for n in [4..10]]
- [6, 24, 120, 720, 5040, 40320, 362880]
-- sage: [SymmetricGroup(n).stabilizer(1)._order() for n in [4..10]]
-+ sage: special_gens = [
-+ ....: [(3,4), (2,4)],
-+ ....: [(4,5), (3,5), (2,5)],
-+ ....: [(5,6), (4,6), (3,6), (2,6)],
-+ ....: [(6,7), (5,7), (4,7), (3,7), (2,7)],
-+ ....: [(7,8), (6,8), (5,8), (4,8), (3,8), (2,8)],
-+ ....: [(8,9), (7,9), (6,9), (5,9), (4,9), (3,9), (2,9)],
-+ ....: [(9,10), (8,10), (7,10), (6,10), (5,10), (4,10), (3,10), (2,10)]]
-+ sage: [SymmetricGroup(n).subgroup(gen)._order() for gen in special_gens]
- [6, 24, 120, 720, 5040, 40320, 362880]
- """
- gens = self.gens()
-diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
-index 756f701..88dbf82 100644
---- a/src/sage/interfaces/expect.py
-+++ b/src/sage/interfaces/expect.py
-@@ -1423,13 +1423,13 @@ class StdOutContext:
- return self.interface
-
- def __exit__(self, typ, value, tb):
-- """
-+ r"""
- EXAMPLE::
-
- sage: from sage.interfaces.expect import StdOutContext
- sage: with StdOutContext(gap):
- ....: gap('1+1')
-- $sage...
-+ \$sage...
- """
- if self.silent:
- return
-diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
-index 1f446aa..198fe84 100644
---- a/src/sage/interfaces/gap.py
-+++ b/src/sage/interfaces/gap.py
-@@ -716,7 +716,7 @@ class Gap_generic(ExtraTabCompletion, Expect):
- sage: gap.eval('quit;')
- ''
- sage: a = gap(3)
-- ** Gap crashed or quit executing '$sage...:=3;;' **
-+ ** Gap crashed or quit executing '\$sage...:=3;;' **
- Restarting Gap and trying again
- sage: a
- 3
-@@ -858,7 +858,7 @@ class Gap_generic(ExtraTabCompletion, Expect):
- EXAMPLES::
-
- sage: print gap.version()
-- 4.7...
-+ 4.8...
- """
- return self.eval('VERSION')[1:-1]
-
-@@ -1162,25 +1162,29 @@ class Gap(Gap_generic):
- return reduce_load_GAP, tuple([])
-
- def _next_var_name(self):
-- """
-+ r"""
- Returns the next unused variable name.
-
-+ Note that names starting with dollar signs are valid GAP
-+ identifiers, but need to be escaped with a backslash starting
-+ with GAP-4.8.
-+
- EXAMPLES::
-
- sage: g = Gap()
- sage: g._next_var_name()
-- '$sage1'
-+ '\\$sage1'
- sage: g(2)^2
- 4
- sage: g._next_var_name()
-- '$sage...'
-+ '\\$sage...'
- """
- if len(self._available_vars) != 0:
- v = self._available_vars[0]
- del self._available_vars[0]
- return v
- self.__seq += 1
-- return '$sage%s'%self.__seq
-+ return r'\$sage%s'%self.__seq
-
- def _start(self):
- """
-@@ -1324,7 +1328,7 @@ class Gap(Gap_generic):
- else:
- tmp_to_use = self._local_tmpfile()
- self.eval('SetGAPDocTextTheme("none")')
-- self.eval('$SAGE.tempfile := "%s";'%tmp_to_use)
-+ self.eval(r'\$SAGE.tempfile := "%s";'%tmp_to_use)
- line = Expect.eval(self, "? %s"%s)
- Expect.eval(self, "? 1")
- match = re.search("Page from (\d+)", line)
-@@ -1384,7 +1388,7 @@ class Gap(Gap_generic):
- sage: gap._pre_interact()
- sage: gap._post_interact()
- """
-- self._eval_line("$SAGE.StartInteract();")
-+ self._eval_line(r'\$SAGE.StartInteract();')
-
- def _post_interact(self):
- """
-@@ -1393,7 +1397,7 @@ class Gap(Gap_generic):
- sage: gap._pre_interact()
- sage: gap._post_interact()
- """
-- self._eval_line("$SAGE.StopInteract();")
-+ self._eval_line(r'\$SAGE.StopInteract();')
-
- def _eval_line_using_file(self, line):
- i = line.find(':=')
-@@ -1641,7 +1645,7 @@ class GapElement(GapElement_generic):
- """
- from sage.misc.misc import uniq
- P = self.parent()
-- v = P.eval('$SAGE.OperationsAdmittingFirstArgument(%s)'%self.name())
-+ v = P.eval(r'\$SAGE.OperationsAdmittingFirstArgument(%s)'%self.name())
- v = v.replace('Tester(','').replace('Setter(','').replace(')','').replace('\n', '')
- v = v.split(',')
- v = [ oper.split('"')[1] for oper in v ]
-diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
-index bd945c7..fa23ba5 100644
---- a/src/sage/libs/gap/gap_includes.pxd
-+++ b/src/sage/libs/gap/gap_includes.pxd
-@@ -131,7 +131,7 @@ cdef extern from "gap/objects.h":
- cdef int libGAP_LAST_TESTING_TNUM
-
- cdef extern from "gap/read.h":
-- void* libGAP_ReadEvalCommand(libGAP_Obj context)
-+ void* libGAP_ReadEvalCommand(libGAP_Obj context, libGAP_UInt *dualSemicolon)
- void* libGAP_ReadEvalFile()
- void* libGAP_ReadEvalResult
- bint libGAP_READ_ERROR()
-diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
-index 52a75be..d62b8e9 100644
---- a/src/sage/libs/gap/util.pyx
-+++ b/src/sage/libs/gap/util.pyx
-@@ -280,7 +280,7 @@ cdef libGAP_Obj gap_eval(str gap_string) except? NULL:
- libgap_start_interaction(cmd)
- try:
- sig_on()
-- status = libGAP_ReadEvalCommand(libGAP_BottomLVars)
-+ status = libGAP_ReadEvalCommand(libGAP_BottomLVars, NULL)
- if status != libGAP_STATUS_END:
- libgap_call_error_handler()
- sig_off()
-@@ -464,7 +464,7 @@ def command(command_string):
- libgap_start_interaction(cmd)
- try:
- sig_on()
-- status = libGAP_ReadEvalCommand(libGAP_BottomLVars)
-+ status = libGAP_ReadEvalCommand(libGAP_BottomLVars, NULL)
- if status != libGAP_STATUS_END:
- libgap_call_error_handler()
- sig_off()
diff --git a/libre/sagemath/is-package-installed.patch b/libre/sagemath/is-package-installed.patch
new file mode 100644
index 000000000..3b6efc22b
--- /dev/null
+++ b/libre/sagemath/is-package-installed.patch
@@ -0,0 +1,387 @@
+diff --git a/src/sage/databases/cremona.py b/src/sage/databases/cremona.py
+index 0a5f794..2969d92 100644
+--- a/src/sage/databases/cremona.py
++++ b/src/sage/databases/cremona.py
+@@ -52,7 +52,6 @@ from sage.misc.prandom import randint
+
+ import sage.schemes.elliptic_curves.constructor as elliptic
+ from sql_db import SQLDatabase, verify_column
+-from sage.misc.package import is_package_installed
+ from sage.env import SAGE_SHARE
+ from sage.misc.all import walltime
+
+@@ -827,7 +826,7 @@ class MiniCremonaDatabase(SQLDatabase):
+ if N < self.largest_conductor():
+ message = "There is no elliptic curve with label " + label \
+ + " in the database"
+- elif is_package_installed('database_cremona_ellcurve'):
++ elif os.path.isfile(os.path.join(SAGE_SHARE, "cremona", "cremona.db")):
+ message = "There is no elliptic curve with label " + label \
+ + " in the currently available databases"
+ else:
+@@ -1676,7 +1675,7 @@ def CremonaDatabase(name=None,mini=None,set_global=None):
+ if name is None and not set_global:
+ return _db
+ if set_global and name is None:
+- if is_package_installed('database_cremona_ellcurve'):
++ if os.path.isfile(os.path.join(SAGE_SHARE, "cremona", "cremona.db")):
+ name = 'cremona'
+ else:
+ name = 'cremona mini'
+diff --git a/src/sage/game_theory/normal_form_game.py b/src/sage/game_theory/normal_form_game.py
+index b917d2a..80fb20c 100644
+--- a/src/sage/game_theory/normal_form_game.py
++++ b/src/sage/game_theory/normal_form_game.py
+@@ -612,8 +612,9 @@ from sage.rings.all import QQ
+ from sage.structure.sage_object import SageObject
+ from sage.matrix.constructor import matrix
+ from sage.matrix.constructor import vector
+-from sage.misc.package import is_package_installed
+ from sage.misc.temporary_file import tmp_filename
++import os
++from sage.env import SAGE_LOCAL
+
+ try:
+ from gambit import Game
+@@ -1315,13 +1316,13 @@ class NormalFormGame(SageObject, MutableMapping):
+ raise ValueError("utilities have not been populated")
+
+ if not algorithm:
+- if is_package_installed('lrslib'):
++ if os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'lrs')):
+ algorithm = "lrs"
+ else:
+ algorithm = "enumeration"
+
+ if algorithm == "lrs":
+- if not is_package_installed('lrslib'):
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'lrs')):
+ raise NotImplementedError("lrslib is not installed")
+
+ return self._solve_lrs(maximization)
+diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py
+index 2f58d8b..eb519a2 100644
+--- a/src/sage/geometry/polyhedron/base.py
++++ b/src/sage/geometry/polyhedron/base.py
+@@ -20,7 +20,6 @@ import six
+ from sage.structure.element import Element, coerce_binop, is_Vector
+
+ from sage.misc.all import cached_method, prod
+-from sage.misc.package import is_package_installed
+
+ from sage.rings.all import QQ, ZZ
+ from sage.rings.real_double import RDF
+@@ -3690,7 +3689,9 @@ class Polyhedron_base(Element):
+
+ David Avis's lrs program.
+ """
+- if not is_package_installed('lrslib'):
++ import os
++ from sage.env import SAGE_LOCAL
++ if os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'lrs')) != True:
+ raise NotImplementedError('You must install the optional lrslib package '
+ 'for this function to work')
+
+diff --git a/src/sage/graphs/generators/classical_geometries.py b/src/sage/graphs/generators/classical_geometries.py
+index e80f2a5..04cd9ce 100644
+--- a/src/sage/graphs/generators/classical_geometries.py
++++ b/src/sage/graphs/generators/classical_geometries.py
+@@ -1287,10 +1287,9 @@ def CossidentePenttilaGraph(q):
+ raise ValueError('q(={}) must be an odd prime power'.format(q))
+
+ from sage.libs.gap.libgap import libgap
+- from sage.misc.package import is_package_installed, PackageNotFoundError
++ from sage.interfaces.gap import gap
+
+- if not is_package_installed('gap_packages'):
+- raise PackageNotFoundError('gap_packages')
++ gap.load_package("grape")
+
+ adj_list=libgap.function_factory("""function(q)
+ local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x;
+diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py
+index 252984f..ce19682 100644
+--- a/src/sage/graphs/generic_graph.py
++++ b/src/sage/graphs/generic_graph.py
+@@ -7833,7 +7833,6 @@ class GenericGraph(GenericGraph_pyx):
+ sage: abs(flow_ff-flow_igraph) < 0.00001 # optional python_igraph
+ True
+ """
+- from sage.misc.package import is_package_installed
+ self._scream_if_not_simple(allow_loops=True)
+ if vertex_bound and algorithm in ["FF", "igraph"]:
+ raise ValueError("This method does not support both " +
+@@ -7851,10 +7850,12 @@ class GenericGraph(GenericGraph_pyx):
+ if algorithm is None:
+ if vertex_bound:
+ algorithm = "LP"
+- elif is_package_installed("python_igraph"):
+- algorithm = "igraph"
+ else:
+- algorithm = "FF"
++ algorithm = "igraph"
++ try:
++ import igraph
++ except ImportError:
++ algorithm = "FF"
+
+ if (algorithm == "FF"):
+ return self._ford_fulkerson(x,y, value_only=value_only, integer=integer, use_edge_labels=use_edge_labels)
+@@ -20134,17 +20135,22 @@ class GenericGraph(GenericGraph_pyx):
+ Subgroup of (Permutation Group with generators [(0,7)(1,4)(2,3)(6,8)]) generated by [(0,7)(1,4)(2,3)(6,8)]]
+
+ """
+- from sage.misc.package import is_package_installed
++ has_bliss=True
++ try:
++ from sage.graphs.bliss import automorphism_group
++ except ImportError:
++ has_bliss=False
++
+ if (algorithm == 'bliss' or # explicit choice from the user; or
+ (algorithm is None and # by default
+ not edge_labels and
+- is_package_installed('bliss'))):
++ has_bliss)):
++
++ if (not has_bliss):
++ raise NotImplementedError("you need to install bliss or set algorithm=sage to use this command")
++
+ if edge_labels:
+ raise ValueError("bliss cannot be used when edge_labels is True")
+- try:
+- from sage.graphs.bliss import automorphism_group
+- except ImportError:
+- raise ImportError("You must install the 'bliss' package to run this command.")
+
+ A = automorphism_group(self, partition)
+
+@@ -20786,17 +20792,22 @@ class GenericGraph(GenericGraph_pyx):
+ True
+
+ """
+- from sage.misc.package import is_package_installed
++ has_bliss=True
++ try:
++ from sage.graphs.bliss import canonical_form
++ except ImportError:
++ has_bliss=False
++
+ if (algorithm == 'bliss' or # explicit request; or
+ (algorithm is None and # default choice
+- is_package_installed('bliss') and
++ has_bliss and
+ not edge_labels)):
++
++ if (not has_bliss):
++ raise NotImplementedError("you need to install bliss or set algorithm=sage to use this command")
++
+ if edge_labels:
+ raise ValueError("bliss cannot be used when edge_labels is True")
+- try:
+- from sage.graphs.bliss import canonical_form
+- except ImportError:
+- raise ImportError("You must install the 'bliss' package to run this command.")
+ return canonical_form(self, partition, return_graph, certify)
+
+ if (algorithm is not None and
+diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py
+index 5919ab3..1766796 100644
+--- a/src/sage/graphs/graph_generators.py
++++ b/src/sage/graphs/graph_generators.py
+@@ -1192,8 +1192,9 @@ class GraphGenerators():
+ .. [buckygen] \G. Brinkmann, J. Goedgebeur and B.D. McKay, Generation of Fullerenes,
+ Journal of Chemical Information and Modeling, 52(11):2910-2918, 2012.
+ """
+- from sage.misc.package import is_package_installed
+- if not is_package_installed("buckygen"):
++ import os
++ from sage.env import SAGE_LOCAL
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'buckygen')):
+ raise TypeError("the optional buckygen package is not installed")
+
+ # number of vertices should be positive
+@@ -1277,8 +1278,9 @@ class GraphGenerators():
+ .. [benzene] \G. Brinkmann, G. Caporossi and P. Hansen, A Constructive Enumeration of Fusenes and Benzenoids,
+ Journal of Algorithms, 45:155-166, 2002.
+ """
+- from sage.misc.package import is_package_installed
+- if not is_package_installed("benzene"):
++ import os
++ from sage.env import SAGE_LOCAL
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'benzene')):
+ raise TypeError("the optional benzene package is not installed")
+
+ # number of hexagons should be positive
+@@ -1430,8 +1432,9 @@ class GraphGenerators():
+ .. [plantri] \G. Brinkmann and B.D. McKay, Fast generation of planar graphs,
+ MATCH-Communications in Mathematical and in Computer Chemistry, 58(2):323-357, 2007.
+ """
+- from sage.misc.package import is_package_installed
+- if not is_package_installed("plantri"):
++ import os
++ from sage.env import SAGE_LOCAL
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'plantri')):
+ raise TypeError("the optional plantri package is not installed")
+
+ # number of vertices should be positive
+@@ -1629,8 +1632,9 @@ class GraphGenerators():
+ sage: [g.size() for g in graphs.triangulations(6, minimum_connectivity=3)] # optional plantri
+ [12, 12]
+ """
+- from sage.misc.package import is_package_installed
+- if not is_package_installed("plantri"):
++ import os
++ from sage.env import SAGE_LOCAL
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'plantri')):
+ raise TypeError("the optional plantri package is not installed")
+
+ # number of vertices should be positive
+@@ -1783,8 +1787,9 @@ class GraphGenerators():
+ sage: [len(g) for g in graphs.quadrangulations(12, no_nonfacial_quadrangles=True, dual=True)] # optional plantri
+ [10, 10]
+ """
+- from sage.misc.package import is_package_installed
+- if not is_package_installed("plantri"):
++ import os
++ from sage.env import SAGE_LOCAL
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'plantri')):
+ raise TypeError("the optional plantri package is not installed")
+
+ # number of vertices should be positive
+diff --git a/src/sage/graphs/lovasz_theta.py b/src/sage/graphs/lovasz_theta.py
+index 0d345c9..60948d2 100644
+--- a/src/sage/graphs/lovasz_theta.py
++++ b/src/sage/graphs/lovasz_theta.py
+@@ -65,10 +65,9 @@ def lovasz_theta(graph):
+ from sage.misc.temporary_file import tmp_filename
+ import os, subprocess
+ from sage.env import SAGE_LOCAL
+- from sage.misc.package import is_package_installed, PackageNotFoundError
+
+- if not is_package_installed('csdp'):
+- raise PackageNotFoundError("csdp")
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'theta')):
++ raise NotImplementedError("You must install csdp before using this function")
+
+ g = graph.relabel(inplace=False, perm=range(1,n+1)).networkx_graph()
+ tf_name = tmp_filename()
+diff --git a/src/sage/groups/generic.py b/src/sage/groups/generic.py
+index c801636..f43e6d9 100644
+--- a/src/sage/groups/generic.py
++++ b/src/sage/groups/generic.py
+@@ -1396,15 +1396,15 @@ def structure_description(G, latex=False):
+ sage: groups.matrix.GL(4,2).structure_description() # optional - database_gap
+ 'A8'
+ """
+- import re
+- from sage.misc.package import is_package_installed
++ import re, os
++ from sage.env import SAGE_LOCAL
+ def correct_dihedral_degree(match):
+ return "%sD%d" % (match.group(1), int(match.group(2))/2)
+
+ try:
+ description = str(G._gap_().StructureDescription())
+ except RuntimeError:
+- if not is_package_installed('database_gap'):
++ if not os.path.isfile(os.path.join(SAGE_LOCAL, "gap", "latest", "small", "readsml.g")):
+ raise RuntimeError("You must install the optional database_gap package first.")
+ raise
+
+diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
+index e42db61..d4d5684 100644
+--- a/src/sage/groups/perm_gps/permgroup.py
++++ b/src/sage/groups/perm_gps/permgroup.py
+@@ -143,7 +143,6 @@ from sage.groups.perm_gps.permgroup_element import PermutationGroupElement, stan
+ from sage.groups.abelian_gps.abelian_group import AbelianGroup
+ from sage.misc.cachefunc import cached_method
+ from sage.groups.class_function import ClassFunction
+-from sage.misc.package import is_package_installed
+ from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
+ from sage.categories.all import FiniteEnumeratedSets
+ from sage.groups.conjugacy_classes import ConjugacyClassGAP
+@@ -188,8 +187,6 @@ def hap_decorator(f):
+ """
+ @wraps(f)
+ def wrapped(self, n, p=0):
+- if not is_package_installed('gap_packages'):
+- raise RuntimeError("You must install the optional gap_packages package.")
+ load_hap()
+ from sage.arith.all import is_prime
+ if not (p == 0 or is_prime(p)):
+@@ -1681,9 +1678,7 @@ class PermutationGroup_generic(group.FiniteGroup):
+ try:
+ return [Integer(n) for n in self._gap_().IdGroup()]
+ except RuntimeError:
+- if not is_package_installed('database_gap'):
+- raise RuntimeError("You must install the optional database_gap package first.")
+- raise
++ raise RuntimeError("You must install the optional gap_packages package.")
+
+ def id(self):
+ """
+@@ -1734,9 +1729,7 @@ class PermutationGroup_generic(group.FiniteGroup):
+ try:
+ return Integer(self._gap_().PrimitiveIdentification())
+ except RuntimeError:
+- if not is_package_installed('database_gap'):
+- raise RuntimeError("You must install the optional database_gap package first.")
+- raise
++ raise RuntimeError("You must install the optional gap_packages package.")
+
+ def center(self):
+ """
+@@ -4112,8 +4105,6 @@ class PermutationGroup_generic(group.FiniteGroup):
+ - David Joyner and Graham Ellis
+
+ """
+- if not is_package_installed('gap_packages'):
+- raise RuntimeError("You must install the optional gap_packages package.")
+ load_hap()
+ from sage.arith.all import is_prime
+ if not (p == 0 or is_prime(p)):
+diff --git a/src/sage/misc/all.py b/src/sage/misc/all.py
+index 90e6985..21daeb0 100644
+--- a/src/sage/misc/all.py
++++ b/src/sage/misc/all.py
+@@ -52,11 +52,6 @@ from fpickle import pickle_function, unpickle_function
+
+ from dist import install_scripts
+
+-from package import (install_package,
+- installed_packages, is_package_installed,
+- standard_packages, optional_packages, experimental_packages,
+- upgrade, package_versions)
+-
+ from pager import pager
+
+ lazy_import('sage.misc.sagedoc', ['browse_sage_doc',
+diff --git a/src/sage/rings/polynomial/multi_polynomial_sequence.py b/src/sage/rings/polynomial/multi_polynomial_sequence.py
+index da41cb0..49cae0b 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_sequence.py
++++ b/src/sage/rings/polynomial/multi_polynomial_sequence.py
+@@ -158,7 +158,6 @@ from sage.misc.cachefunc import cached_method
+
+ from types import GeneratorType
+ from sage.misc.converting_dict import KeyConvertingDict
+-from sage.misc.package import is_package_installed
+
+ from sage.structure.sequence import Sequence, Sequence_generic
+
+@@ -1428,10 +1427,11 @@ class PolynomialSequence_gf2(PolynomialSequence_generic):
+
+ if S != []:
+ if algorithm == "exhaustive_search":
+- if not is_package_installed('fes'):
+- from sage.misc.package import PackageNotFoundError
+- raise PackageNotFoundError("fes")
+- from sage.libs.fes import exhaustive_search
++ try:
++ from sage.libs.fes import exhaustive_search
++ except ImportError:
++ raise RuntimeError("You must install the optional fes package.")
++
+ solutions = exhaustive_search(S, max_sols=n, verbose=verbose, **kwds)
+
+ elif algorithm == "polybori":
diff --git a/libre/sagemath/linbox-1.4.patch b/libre/sagemath/linbox-1.4.patch
new file mode 100644
index 000000000..5897df763
--- /dev/null
+++ b/libre/sagemath/linbox-1.4.patch
@@ -0,0 +1,470 @@
+diff --git a/src/module_list.py b/src/module_list.py
+index a49ed36..7798cb8 100644
+--- a/src/module_list.py
++++ b/src/module_list.py
+@@ -27,6 +27,18 @@ lapack_libs = list(lapack_pc['libraries'])
+ lapack_library_dirs = list(lapack_pc['library_dirs'])
+ lapack_include_dirs = list(lapack_pc['include_dirs'])
+
++# FFLAS-FFPACK
++fflas_ffpack_pc = pkgconfig.parse('fflas-ffpack')
++fflas_ffpack_libs = list(fflas_ffpack_pc['libraries'])
++fflas_ffpack_library_dirs = list(fflas_ffpack_pc['library_dirs'])
++fflas_ffpack_cflags = pkgconfig.cflags('fflas-ffpack').split()
++
++# Givaro
++givaro_pc = pkgconfig.parse('givaro')
++givaro_libs = list(givaro_pc['libraries'])
++givaro_library_dirs = list(givaro_pc['library_dirs'])
++givaro_cflags = pkgconfig.cflags('givaro').split()
++
+ # GNU Scientific Library
+ # Note we replace the built-in gslcblas with the above cblas
+ gsl_pc = pkgconfig.parse('gsl')
+@@ -40,6 +52,12 @@ gd_libs = list(gd_pc['libraries'])
+ gd_library_dirs = list(gd_pc['library_dirs'])
+ gd_include_dirs = list(gd_pc['include_dirs'])
+
++# LinBox
++linbox_pc = pkgconfig.parse('linbox')
++linbox_libs = list(linbox_pc['libraries'])
++linbox_library_dirs = list(linbox_pc['library_dirs'])
++linbox_cflags = pkgconfig.cflags('linbox').split()
++
+ # PNG image library
+ png_pc = pkgconfig.parse('libpng')
+ png_libs = list(png_pc['libraries'])
+@@ -58,9 +76,18 @@ zlib_include_dirs = list(zlib_pc['include_dirs'])
+ #########################################################
+
+ aliases = dict(
++ FFLASFFPACK_CFLAGS=fflas_ffpack_cflags,
++ FFLASFFPACK_LIBRARIES=fflas_ffpack_libs,
++ FFLASFFPACK_LIBDIR=fflas_ffpack_library_dirs,
++ GIVARO_CFLAGS=givaro_cflags,
++ GIVARO_LIBRARIES=givaro_libs,
++ GIVARO_LIBDIR=givaro_library_dirs,
+ GSL_LIBRARIES=gsl_libs,
+ GSL_LIBDIR=gsl_library_dirs,
+ GSL_INCDIR=gsl_include_dirs,
++ LINBOX_CFLAGS=linbox_cflags,
++ LINBOX_LIBRARIES=linbox_libs,
++ LINBOX_LIBDIR=linbox_library_dirs,
+ )
+
+ #########################################################
+@@ -85,12 +112,6 @@ except ValueError:
+ singular_libs = ['singular', 'flint', 'ntl', 'gmpxx', 'gmp', 'readline', 'm']
+
+ #########################################################
+-### Givaro flags
+-#########################################################
+-
+-givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS']
+-
+-#########################################################
+ ### Library order
+ #########################################################
+
+@@ -105,8 +126,7 @@ givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS']
+ # at the very end of the list.
+ library_order_list = [
+ "singular", "ec", "ecm",
+- "linboxsage", "ntl", "iml", "linbox", "givaro",
+-] + gsl_libs + [
++] + linbox_libs + gsl_libs + [
+ "pari", "flint", "ratpoints", "ecl", "glpk", "ppl",
+ "arb", "fplll", "mpfi", "mpfr", "mpc", "gmp", "gmpxx",
+ "polybori",
+@@ -593,13 +613,10 @@ ext_modules = [
+
+ Extension('sage.libs.linbox.linbox',
+ sources = ['sage/libs/linbox/linbox.pyx'],
+- libraries = ['linboxsage', 'ntl', 'iml', 'linbox',
+- 'givaro', 'mpfr', 'gmp', 'gmpxx'] + cblas_libs,
++ libraries = linbox_libs,
+ language = 'c++',
+ library_dirs = cblas_library_dirs,
+- include_dirs = cblas_include_dirs,
+- extra_compile_args = givaro_extra_compile_args,
+- depends = [os.path.join(SAGE_INC, 'givaro', 'givconfig.h')]),
++ include_dirs = cblas_include_dirs),
+
+ Extension('sage.libs.lcalc.lcalc_Lfunction',
+ sources = ['sage/libs/lcalc/lcalc_Lfunction.pyx'],
+@@ -645,9 +662,8 @@ ext_modules = [
+
+ Extension('sage.libs.singular.singular',
+ sources = ['sage/libs/singular/singular.pyx'],
+- libraries = ['givaro'] + singular_libs,
+- language="c++",
+- extra_compile_args = givaro_extra_compile_args),
++ libraries = singular_libs,
++ language="c++"),
+
+ Extension('sage.libs.singular.polynomial',
+ sources = ['sage/libs/singular/polynomial.pyx'],
+@@ -667,8 +683,7 @@ ext_modules = [
+ Extension('sage.libs.singular.function',
+ sources = ['sage/libs/singular/function.pyx'],
+ libraries = singular_libs,
+- language="c++",
+- extra_compile_args = givaro_extra_compile_args),
++ language="c++"),
+
+ Extension('sage.libs.singular.option',
+ sources = ['sage/libs/singular/option.pyx'],
+@@ -923,19 +938,17 @@ ext_modules = [
+ Extension('sage.matrix.matrix_modn_dense_float',
+ sources = ['sage/matrix/matrix_modn_dense_float.pyx'],
+ language="c++",
+- libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs,
++ libraries = linbox_libs + cblas_libs,
+ library_dirs = cblas_library_dirs,
+- include_dirs = cblas_include_dirs,
+- extra_compile_args = ['-DDISABLE_COMMENTATOR'] + givaro_extra_compile_args),
++ include_dirs = cblas_include_dirs),
+
+ Extension('sage.matrix.matrix_modn_dense_double',
+ sources = ['sage/matrix/matrix_modn_dense_double.pyx'],
+ language="c++",
+- libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs,
++ libraries = linbox_libs + cblas_libs,
+ library_dirs = cblas_library_dirs,
+ include_dirs = cblas_include_dirs,
+- extra_compile_args = ["-D_XPG6", "-DDISABLE_COMMENTATOR"]
+- + m4ri_extra_compile_args + givaro_extra_compile_args),
++ extra_compile_args = ["-D_XPG6"]),
+
+ Extension('sage.matrix.matrix_modn_sparse',
+ sources = ['sage/matrix/matrix_modn_sparse.pyx']),
+@@ -1374,8 +1387,7 @@ ext_modules = [
+ Extension('sage.rings.finite_rings.element_givaro',
+ sources = ["sage/rings/finite_rings/element_givaro.pyx"],
+ libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'],
+- language='c++',
+- extra_compile_args = givaro_extra_compile_args),
++ language='c++'),
+
+ Extension('sage.rings.finite_rings.element_ntl_gf2e',
+ sources = ['sage/rings/finite_rings/element_ntl_gf2e.pyx'],
+@@ -1395,8 +1407,7 @@ ext_modules = [
+ sources = ["sage/rings/finite_rings/hom_finite_field_givaro.pyx"],
+ # this order is needed to compile under windows.
+ libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'],
+- language='c++',
+- extra_compile_args = givaro_extra_compile_args),
++ language='c++'),
+
+ ################################
+ ##
+@@ -1548,8 +1559,7 @@ ext_modules = [
+ Extension('sage.rings.polynomial.plural',
+ sources = ['sage/rings/polynomial/plural.pyx'],
+ libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'],
+- language="c++",
+- extra_compile_args = givaro_extra_compile_args),
++ language="c++"),
+
+ Extension('sage.rings.polynomial.multi_polynomial_libsingular',
+ sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'],
+diff --git a/src/sage/libs/linbox/echelonform.pxd b/src/sage/libs/linbox/echelonform.pxd
+index 3097c8b..cf4902d 100644
+--- a/src/sage/libs/linbox/echelonform.pxd
++++ b/src/sage/libs/linbox/echelonform.pxd
+@@ -1,23 +1,27 @@
++# distutils: extra_compile_args = LINBOX_CFLAGS
++# distutils: libraries = LINBOX_LIBRARIES
++# distutils: library_dirs = LINBOX_LIBDIR
++
+ from sage.libs.linbox.modular cimport ModDoubleField, ModDoubleFieldElement, ModFloatField, ModFloatFieldElement
+ from libc.stdint cimport uint64_t
+
+-cdef extern from "linbox/matrix/blas-matrix.h" namespace "LinBox":
+- cdef cppclass BlasMatrixDouble "LinBox::BlasMatrix<LinBox::Modular<double> >":
++cdef extern from "linbox/matrix/dense-matrix.h" namespace "LinBox":
++ cdef cppclass BlasMatrixDouble "LinBox::DenseMatrix<Givaro::Modular<double> >":
+ BlasMatrixDouble(ModDoubleField F, uint64_t nrows, uint64_t ncols)
+ void setEntry(size_t i, size_t j, ModDoubleFieldElement t)
+ ModDoubleFieldElement &getEntry(size_t i, size_t j)
+
+- cdef cppclass BlasMatrixFloat "LinBox::BlasMatrix<LinBox::Modular<float> >":
++ cdef cppclass BlasMatrixFloat "LinBox::DenseMatrix<Givaro::Modular<float> >":
+ BlasMatrixFloat(ModFloatField F, uint64_t nrows, uint64_t ncols)
+ void setEntry(size_t i, size_t j, ModFloatFieldElement t)
+ ModFloatFieldElement &getEntry(size_t i, size_t j)
+
+ cdef extern from "linbox/algorithms/echelon-form.h":
+- cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<LinBox::Modular<double> >":
++ cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<Givaro::Modular<double> >":
+ EchelonFormDomainDouble(ModDoubleField)
+ int rowReducedEchelon(BlasMatrixDouble, BlasMatrixDouble)
+
+- cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<LinBox::Modular<float> >":
++ cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<Givaro::Modular<float> >":
+ EchelonFormDomainFloat(ModFloatField)
+ int rowReducedEchelon(BlasMatrixFloat, BlasMatrixFloat)
+
+diff --git a/src/sage/libs/linbox/fflas.pxd b/src/sage/libs/linbox/fflas.pxd
+index e102004..01ab1b1 100644
+--- a/src/sage/libs/linbox/fflas.pxd
++++ b/src/sage/libs/linbox/fflas.pxd
+@@ -1,3 +1,7 @@
++# distutils: extra_compile_args = FFLASFFPACK_CFLAGS
++# distutils: libraries = FFLASFFPACK_LIBRARIES
++# distutils: library_dirs = FFLASFFPACK_LIBDIR
++
+ from modular cimport ModDoubleField, ModFloatField, ModDoubleFieldElement, ModFloatFieldElement
+
+ cdef extern from "fflas-ffpack/fflas-ffpack.h" namespace "std":
+diff --git a/src/sage/libs/linbox/linbox.pyx b/src/sage/libs/linbox/linbox.pyx
+index e932347..a9bd6d1 100644
+--- a/src/sage/libs/linbox/linbox.pyx
++++ b/src/sage/libs/linbox/linbox.pyx
+@@ -1,3 +1,7 @@
++# distutils: extra_compile_args = LINBOX_CFLAGS
++# distutils: libraries = LINBOX_LIBRARIES
++# distutils: library_dirs = LINBOX_LIBDIR
++
+ r"""
+ Linbox interface
+ """
+diff --git a/src/sage/libs/linbox/modular.pxd b/src/sage/libs/linbox/modular.pxd
+index 7ef204c..ea5fb29 100644
+--- a/src/sage/libs/linbox/modular.pxd
++++ b/src/sage/libs/linbox/modular.pxd
+@@ -1,10 +1,10 @@
+-cdef extern from "linbox/field/modular.h":
++cdef extern from "givaro/modular.h":
+ # double
+
+- cdef cppclass ModDoubleFieldElement "LinBox::Modular<double>::Element":
++ cdef cppclass ModDoubleFieldElement "Givaro::Modular<double>::Element":
+ pass
+
+- cdef cppclass ModDoubleField "LinBox::Modular<double>":
++ cdef cppclass ModDoubleField "Givaro::Modular<double>":
+ ModDoubleField(int modulus)
+ ModDoubleFieldElement init(ModDoubleFieldElement res, int v)
+ ModDoubleFieldElement init(ModDoubleFieldElement res, double v)
+@@ -20,10 +20,10 @@ cdef extern from "linbox/field/modular.h":
+
+
+ # float
+- cdef cppclass ModFloatFieldElement "LinBox::Modular<float>::Element":
++ cdef cppclass ModFloatFieldElement "Givaro::Modular<float>::Element":
+ pass
+
+- cdef cppclass ModFloatField "LinBox::Modular<float>":
++ cdef cppclass ModFloatField "Givaro::Modular<float>":
+ ModFloatField(int modulus)
+ ModFloatFieldElement init(ModFloatFieldElement res, int v)
+ ModFloatFieldElement init(ModFloatFieldElement res, double v)
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index 33d7f7ec..77f6e0a 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -22,6 +22,7 @@ cdef extern from "limits.h":
+
+ import os
+
++from libc.stdint cimport int64_t
+ from sage.libs.singular.decl cimport intvec
+ from sage.libs.singular.decl cimport SR_HDL, SR_INT, SR_TO_INT
+ from sage.libs.singular.decl cimport singular_options, singular_verbose_options
+@@ -155,7 +156,7 @@ cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache):
+ order = cache.objectptr.cardinality() - 1
+
+ while z:
+- c = cache.objectptr.initi(c, <long>napGetCoeff(z))
++ c = cache.objectptr.initi(c, <int64_t>napGetCoeff(z))
+ e = napGetExpFrom(z,1, _ring)
+ if e == 0:
+ ret = cache.objectptr.add(ret, c, ret)
+diff --git a/src/sage/rings/finite_rings/element_givaro.pxd b/src/sage/rings/finite_rings/element_givaro.pxd
+index 68def46..91c4ed7 100644
+--- a/src/sage/rings/finite_rings/element_givaro.pxd
++++ b/src/sage/rings/finite_rings/element_givaro.pxd
+@@ -1,9 +1,15 @@
+-from sage.structure.element cimport Element, RingElement, ModuleElement
+-from sage.rings.finite_rings.element_base cimport FinitePolyExtElement
++# distutils: extra_compile_args = GIVARO_CFLAGS
++
++from libcpp.vector cimport vector
++ctypedef vector[int] intvec
++
++from libc.stdint cimport int64_t
+
+-from sage.structure.parent cimport Parent
++from sage.rings.finite_rings.element_base cimport FinitePolyExtElement
++from sage.structure.parent cimport Parent
+ from sage.structure.sage_object cimport SageObject
+
++
+ cdef extern from "givaro/givconfig.h":
+ pass
+
+@@ -13,16 +19,7 @@ cdef extern from "givaro/givrandom.h":
+
+ GivRandom GivRandomSeeded "Givaro::GivRandom"(unsigned long seed)
+
+-cdef extern from "givaro/givgfq.h":
+- ctypedef struct intvec "std::vector<unsigned int>":
+- void (* push_back)(int elem)
+-
+- ctypedef struct constintvec "const std::vector<unsigned int>"
+-
+- intvec intvec_factory "std::vector<unsigned int>"(int len)
+-
+-cdef extern from "givaro/givgfq.h":
+-
++cdef extern from "givaro/gfq.h":
+ ctypedef struct GivaroGfq "Givaro::GFqDom<int>":
+ #attributes
+ unsigned int one
+@@ -40,10 +37,10 @@ cdef extern from "givaro/givgfq.h":
+ unsigned int (* cardinality)()
+ int (* exponent)()
+ int (* random)(GivRandom gen, int res)
+- int (* initi "init")(int res, int e)
++ int (* initi "init")(int res, int64_t e)
+ int (* initd "init")(int res, double e)
+ int (* indeterminate)()
+- int (* convert)(int r, int p)
++ int (* convert)(int64_t r, int p)
+ int (* read)(int r, int p)
+ int (* axpyin)(int r, int a, int x)
+ int (* axpy)(int r, int a, int b, int c)
+@@ -60,7 +57,12 @@ cdef extern from "givaro/givgfq.h":
+ void delete "delete "(void *o)
+ int gfq_element_factory "Givaro::GFqDom<int>::Element"()
+
+-cdef class FiniteField_givaroElement(FinitePolyExtElement) #forward declaration
++
++cdef class FiniteField_givaroElement(FinitePolyExtElement):
++ cdef int element
++ cdef Cache_givaro _cache
++ cdef object _multiplicative_order
++ cdef FiniteField_givaroElement _new_c(self, int value)
+
+ cdef class Cache_givaro(SageObject):
+ cdef GivaroGfq *objectptr # C++ object
+@@ -85,11 +87,4 @@ cdef class FiniteField_givaro_iterator:
+ cdef int iterator
+ cdef Cache_givaro _cache
+
+-cdef class FiniteField_givaroElement(FinitePolyExtElement):
+- cdef int element
+- cdef Cache_givaro _cache
+- cdef object _multiplicative_order
+- cdef FiniteField_givaroElement _new_c(self, int value)
+-
+-
+ cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x)
+diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx
+index d32b5cf..f2afa44 100644
+--- a/src/sage/rings/finite_rings/element_givaro.pyx
++++ b/src/sage/rings/finite_rings/element_givaro.pyx
+@@ -58,8 +58,9 @@ from sage.misc.randstate cimport randstate, current_randstate
+ from sage.rings.finite_rings.finite_field_base cimport FiniteField
+ from sage.rings.ring cimport Ring
+ from element_ext_pari import FiniteField_ext_pariElement
+-from element_pari_ffelt import FiniteFieldElement_pari_ffelt
++from element_pari_ffelt cimport FiniteFieldElement_pari_ffelt
+ from sage.structure.sage_object cimport SageObject
++from sage.structure.element cimport Element, ModuleElement, RingElement
+ import operator
+ import sage.arith.all
+ import finite_field_constructor as finite_field
+@@ -373,18 +374,16 @@ cdef class Cache_givaro(SageObject):
+ elif isinstance(e, int) or \
+ isinstance(e, Integer) or \
+ isinstance(e, long) or is_IntegerMod(e):
+- try:
+- e_int = e
+- except OverflowError:
+- e_int = e % self.characteristic()
++ e_int = e % self.characteristic()
+ res = self.objectptr.initi(res, e_int)
+
+ elif e is None:
+ e_int = 0
+- res = self.objectptr.initi(res,e_int)
++ res = self.objectptr.initi(res, e_int)
+
+ elif isinstance(e, float):
+- res = self.objectptr.initd(res,e)
++ e_int = int(e) % self.characteristic()
++ res = self.objectptr.initd(res, e_int)
+
+ elif isinstance(e, str):
+ return self.parent(eval(e.replace("^","**"),self.parent.gens_dict()))
+@@ -394,8 +393,8 @@ cdef class Cache_givaro(SageObject):
+ raise TypeError, "e.parent must match self.vector_space"
+ ret = self._zero_element
+ for i in range(len(e)):
+- e_entry = e[i] % self.characteristic()
+- res = self.objectptr.initi(res, int(e_entry))
++ e_int = e[i] % self.characteristic()
++ res = self.objectptr.initi(res, e_int)
+ to_add = make_FiniteField_givaroElement(self, res)
+ ret = ret + to_add*self.parent.gen()**i
+ return ret
+@@ -434,8 +433,8 @@ cdef class Cache_givaro(SageObject):
+ raise ValueError, "list is too long"
+ ret = self._zero_element
+ for i in range(len(e)):
+- e_entry = e[i] % self.characteristic()
+- res = self.objectptr.initi(res, int(e_entry))
++ e_int = e[i] % self.characteristic()
++ res = self.objectptr.initi(res, e_int)
+ to_add = make_FiniteField_givaroElement(self, res)
+ ret = ret + to_add*self.parent.gen()**i
+ return ret
+@@ -572,19 +571,17 @@ cdef class Cache_givaro(SageObject):
+ cdef int ret = k.zero
+ cdef int a = k.indeterminate()
+ cdef int at = k.one
+- cdef unsigned int ch = k.characteristic()
+- cdef int _n, t, i
++ cdef int ch = k.characteristic()
++ cdef int t, i
+
+ if n<0 or n>k.cardinality():
+ raise TypeError, "n must be between 0 and self.order()"
+
+- _n = n
+-
+ for i from 0 <= i < k.exponent():
+- t = k.initi(t, _n%ch)
++ t = k.initi(t, n % ch)
+ ret = k.axpy(ret, t, at, ret)
+ at = k.mul(at,at,a)
+- _n = _n/ch
++ n //= ch
+ return make_FiniteField_givaroElement(self, ret)
+
+ def _element_repr(self, FiniteField_givaroElement e):
+diff --git a/src/sage/rings/finite_rings/finite_field_givaro.py b/src/sage/rings/finite_rings/finite_field_givaro.py
+index adbaab3..c431f6d 100644
+--- a/src/sage/rings/finite_rings/finite_field_givaro.py
++++ b/src/sage/rings/finite_rings/finite_field_givaro.py
+@@ -269,7 +269,8 @@ class FiniteField_givaro(FiniteField):
+ sage: k(2) # indirect doctest
+ 0
+
+- Floats coerce in:
++ Floats are converted like integers::
++
+ sage: k(float(2.0))
+ 0
+
+@@ -343,7 +344,7 @@ class FiniteField_givaro(FiniteField):
+ sage: k(pari('Mod(1,2)'))
+ 1
+ sage: k(pari('Mod(2,3)'))
+- 0
++ a
+ sage: k(pari('Mod(1,3)*a^20'))
+ a^7 + a^5 + a^4 + a^2
+
diff --git a/libre/sagemath/paths.patch b/libre/sagemath/paths.patch
index 12922dcc3..c8afe39bb 100644
--- a/libre/sagemath/paths.patch
+++ b/libre/sagemath/paths.patch
@@ -12,7 +12,7 @@
+_add_variable_or_fallback('SAGE_ROOT', '/usr')
+_add_variable_or_fallback('SAGE_LOCAL', '/usr')
+_add_variable_or_fallback('SAGE_ETC', '/etc/sage')
-+_add_variable_or_fallback('SAGE_INC', opj('$SAGE_LOCAL', 'include', 'sage'))
++_add_variable_or_fallback('SAGE_INC', opj('$SAGE_LOCAL', 'include'))
+_add_variable_or_fallback('SAGE_SHARE', opj('$SAGE_LOCAL', 'share', 'sage'))
_add_variable_or_fallback('SAGE_SRC', opj('$SAGE_ROOT', 'src'))