summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PKGBUILD5
-rw-r--r--sagemath-cremona.patch123
2 files changed, 127 insertions, 1 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 29a57bbb7140..5c117c7cb7e3 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -36,7 +36,7 @@ makedepends=(cython2 boost ratpoints symmetrica python2-jinja coin-or-cbc libhom
mcqd coxeter bliss-graphs tdlib python2-pkgconfig shared_meataxe libfes primecount git)
source=(git://git.sagemath.org/sage.git#branch=develop
sagemath-env.patch package.patch latte-count.patch sagemath-python3-notebook.patch test-optional.patch
- r-no-readline.patch fes02.patch sagemath-threejs.patch sagemath-ignore-warnings.patch
+ r-no-readline.patch fes02.patch sagemath-threejs.patch sagemath-ignore-warnings.patch sagemath-cremona.patch
sagemath-networkx2.patch sagemath-scipy-1.0.patch sagemath-singular-4.1.1.patch sagemath-lcalc-c++11.patch
pari-ratpoints.patch::"https://github.com/sagemath/sage/commit/83458400.patch")
sha256sums=('SKIP'
@@ -49,6 +49,7 @@ sha256sums=('SKIP'
'7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94'
'2d13b15ad2d1511bb3d752a261497060a8901882b1c2fa9813219781b7a71d83'
'a4a6c87b46ff23b89608aca66d00427334502e8bfb5dfe68b94497d19be1c7ae'
+ '71cc42d168545d460bc7f67a30486ff1534093e2b4deeb83deda8ff5bd081e7b'
'8253730940687992dd29d90d95bea7e2685bb4854db004090c8196ce92859b64'
'17397b8e1843b013ef5d2e083369109f0719651edd8ef0c8493cb49e2bc4324a'
'369f1483e0364031d73d43d9e63b7bf2b0929c8a1d470c1596f98f9f1aa80750'
@@ -94,6 +95,8 @@ prepare(){
# Upstream patches
# fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209
patch -p1 -i ../fes02.patch
+# use Features to detect Cremona databases https://trac.sagemath.org/ticket/24718
+ patch -p1 -i ../sagemath-cremona.patch
# use python2
sed -e 's|#!/usr/bin/env sage-python23|#!/usr/bin/env python2|' -e 's|#!/usr/bin/env python\b|#!/usr/bin/env python2|' -i src/bin/*
diff --git a/sagemath-cremona.patch b/sagemath-cremona.patch
new file mode 100644
index 000000000000..d21e3e5faa11
--- /dev/null
+++ b/sagemath-cremona.patch
@@ -0,0 +1,123 @@
+diff --git a/src/sage/databases/cremona.py b/src/sage/databases/cremona.py
+index 6e99f6c..b501a55 100644
+--- a/src/sage/databases/cremona.py
++++ b/src/sage/databases/cremona.py
+@@ -53,7 +53,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
+
+@@ -606,24 +605,25 @@ class MiniCremonaDatabase(SQLDatabase):
+ sage: c.name
+ 'cremona mini'
+ """
++ if name is None:
++ raise ValueError("name must not be None.")
++ if build and read_only:
++ raise ValueError("only one of build and read_only can be set at once.")
++
+ self.name = name
+- name = name.replace(' ','_')
+- db_path = os.path.join(SAGE_SHARE, 'cremona', name+'.db')
++
+ if build:
+- if name is None:
+- raise RuntimeError('The database must have a name.')
+- if read_only:
+- raise RuntimeError('The database must not be read_only.')
++ db_path = os.path.join(SAGE_SHARE, 'cremona', name.replace(' ','_')+'.db')
+ SQLDatabase.__init__(self, db_path, read_only=read_only, \
+ skeleton=_miniCremonaSkeleton)
+- return
+- if not os.path.isfile(db_path):
+- raise ValueError("Desired database (='%s') does not "%self.name \
+- + "exist")
+- SQLDatabase.__init__(self, db_path, read_only=read_only)
+- if self.get_skeleton() != _miniCremonaSkeleton:
+- raise RuntimeError('Database at %s does '%(self.__dblocation__) \
+- + 'not appear to be a valid SQL Cremona database.')
++ else:
++ from sage.misc.feature_test import DatabaseCremona
++ database = DatabaseCremona(name)
++ database.require()
++ SQLDatabase.__init__(self, database.absolute_path(), read_only=read_only)
++ if self.get_skeleton() != _miniCremonaSkeleton:
++ raise RuntimeError('Database at %s does '%(self.__dblocation__) \
++ + 'not appear to be a valid SQL Cremona database.')
+
+ def __iter__(self):
+ """
+@@ -824,14 +824,15 @@ 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'):
++ from sage.misc.feature_test import DatabaseCremona
++ cremona_database_presence = DatabaseCremona().is_present()
++ if cremona_database_presence:
+ message = "There is no elliptic curve with label " + label \
+ + " in the currently available databases"
+ else:
+ message = "There is no elliptic curve with label " \
+- + label + " in the default database; try installing " \
+- + "the optional package database_cremona_ellcurve which " \
+- + "contains the complete Cremona database"
++ + label + " in the default database. " \
++ + cremona_database_presence.resolution
+ raise ValueError(message)
+ ainvs = eval(c[0])
+ data = {'cremona_label': label,
+@@ -1417,24 +1418,25 @@ class LargeCremonaDatabase(MiniCremonaDatabase):
+ sage: c.name # optional - database_cremona_ellcurve
+ 'cremona'
+ """
++ if name is None:
++ raise ValueError("name must not be None.")
++ if build and read_only:
++ raise ValueError("only one of build and read_only can be set at once.")
++
+ self.name = name
+- name = name.replace(' ','_')
+- db_path = os.path.join(SAGE_SHARE, 'cremona', name+'.db')
++
+ if build:
+- if name is None:
+- raise RuntimeError('The database must have a name.')
+- if read_only:
+- raise RuntimeError('The database must not be read_only.')
++ db_path = os.path.join(SAGE_SHARE, 'cremona', name.replace(' ','_')+'.db')
+ SQLDatabase.__init__(self, db_path, read_only=read_only, \
+- skeleton=_cremonaSkeleton)
+- return
+- if not os.path.isfile(db_path):
+- raise ValueError("Desired database (='%s') does not "%self.name \
+- + "exist")
+- SQLDatabase.__init__(self, db_path, read_only=read_only)
+- if self.get_skeleton() != _cremonaSkeleton:
+- raise RuntimeError('Database at %s does '%(self.__dblocation__) \
+- + 'not appear to be a valid SQL Cremona database.')
++ skeleton=_miniCremonaSkeleton)
++ else:
++ from sage.misc.feature_test import DatabaseCremona
++ database = DatabaseCremona(name)
++ database.require()
++ SQLDatabase.__init__(self, database.absolute_path(), read_only=read_only)
++ if self.get_skeleton() != _cremonaSkeleton:
++ raise RuntimeError('Database at %s does '%(self.__dblocation__) \
++ + 'not appear to be a valid SQL Cremona database.')
+
+ def allbsd(self, N):
+ r"""
+@@ -1672,7 +1674,8 @@ 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'):
++ from sage.misc.feature_test import DatabaseCremona
++ if DatabaseCremona().is_present():
+ name = 'cremona'
+ else:
+ name = 'cremona mini'