[sagemath] 01/02: Re-add d0-paths-sharedata.patch as discussed

Ximin Luo infinity0 at debian.org
Tue Dec 20 17:51:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch _wip_sagemath_paths
in repository sagemath.

commit 133ea3053cce945b9315e5b17d87473a5faca1e3
Author: Ximin Luo <infinity0 at debian.org>
Date:   Tue Dec 20 17:59:40 2016 +0100

    Re-add d0-paths-sharedata.patch as discussed
---
 debian/patches/d0-paths-sharedata.patch | 171 ++++++++++++++++++++++++++++++++
 debian/patches/series                   |   1 +
 2 files changed, 172 insertions(+)

diff --git a/debian/patches/d0-paths-sharedata.patch b/debian/patches/d0-paths-sharedata.patch
new file mode 100644
index 0000000..8fd4dc2
--- /dev/null
+++ b/debian/patches/d0-paths-sharedata.patch
@@ -0,0 +1,171 @@
+Description: Hard-code paths to system shared data
+ This could be made generic and forwarded upstream. For example, add another
+ SAGE_SHARE_DATA directory, which for upstream would be the same as SAGE_SHARE
+ and for us would be /usr/share/sagemeth. However, this may not be worth the
+ effort:
+ - upstream already tried it before (as SAGE_DATA) and decide to ditch that
+ - for upstream to accept it again, we'd also have to patch lots of things that
+   are pointless for Debian, such as the scripts in build/pkgs
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: TODO
+--- a/sage/src/sage/combinat/designs/latin_squares.py
++++ b/sage/src/sage/combinat/designs/latin_squares.py
+@@ -544,8 +544,7 @@
+         return
+ 
+     if compare:
+-        from sage.env import SAGE_SHARE
+-        handbook_file = open(SAGE_SHARE+"/combinatorial_designs/MOLS_table.txt",'r')
++        handbook_file = open("/usr/share/sagemath/combinatorial_designs/MOLS_table.txt",'r')
+         hb = [int(_) for _ in handbook_file.readlines()[9].split(',')]
+         handbook_file.close()
+ 
+--- a/sage/src/sage/databases/conway.py
++++ b/sage/src/sage/databases/conway.py
+@@ -22,9 +22,8 @@
+ from six import itervalues
+ 
+ import collections, os
+-from sage.env import SAGE_SHARE
+ 
+-_CONWAYDATA = os.path.join(SAGE_SHARE, 'conway_polynomials',
++_CONWAYDATA = os.path.join('/usr/share/sagemath/conway_polynomials',
+         'conway_polynomials.sobj')
+ _conwaydict = None
+ 
+--- a/sage/src/sage/databases/cremona.py
++++ b/sage/src/sage/databases/cremona.py
+@@ -54,12 +54,13 @@
+ 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
+ 
+ import re
+ import string
+ 
++SAGE_SHARE = '/usr/share/sagemath/'
++
+ _cremonaSkeleton = {
+     't_class': {
+         'conductor': {'sql':'INTEGER', 'index':True},
+@@ -1663,8 +1664,7 @@
+         Traceback (most recent call last):
+         ...
+         ValueError: Desired database (='should not exist') does not exist
+-        sage: from sage.env import SAGE_SHARE
+-        sage: os.path.isfile(os.path.join(SAGE_SHARE,'cremona','should_not_exist.db'))
++        sage: os.path.isfile(os.path.join('/usr/share/sagemath/cremona','should_not_exist.db'))
+         False
+     """
+     global _db
+--- a/sage/src/sage/schemes/elliptic_curves/ec_database.py
++++ b/sage/src/sage/schemes/elliptic_curves/ec_database.py
+@@ -117,8 +117,7 @@
+             ((1, -1, 0, -106384, 13075804), 249649566346838)
+ 
+         """
+-        from sage.env import SAGE_SHARE
+-        db = os.path.join(SAGE_SHARE,'ellcurves')
++        db = '/usr/share/sagemath/ellcurves'
+         data = os.path.join(db,'rank%s'%rank)
+         if not os.path.exists(data):
+             return []
+--- a/sage/src/sage/graphs/isgci.py
++++ b/sage/src/sage/graphs/isgci.py
+@@ -376,7 +376,8 @@
+ from sage.structure.sage_object import SageObject
+ from sage.structure.unique_representation import CachedRepresentation, UniqueRepresentation
+ from sage.misc.unknown import Unknown
+-from sage.env import SAGE_SHARE
++
++SAGE_SHARE = '/usr/share/sagemath/'
+ 
+ #*****************************************************************************
+ #      Copyright (C) 2011 Nathann Cohen <nathann.cohen at gmail.com>
+@@ -835,8 +836,7 @@
+ 
+         EXAMPLE::
+ 
+-            sage: from sage.env import SAGE_SHARE
+-            sage: graph_classes._parse_db(os.path.join(SAGE_SHARE,'graphs'))
++            sage: graph_classes._parse_db('/usr/share/sagemath/graphs')
+         """
+         import xml.etree.cElementTree as ET
+         import os.path
+--- a/sage/src/sage/graphs/strongly_regular_db.pyx
++++ b/sage/src/sage/graphs/strongly_regular_db.pyx
+@@ -3120,8 +3120,7 @@
+         return
+     import json
+ 
+-    from sage.env import SAGE_SHARE
+-    with open(SAGE_SHARE+"/graphs/brouwer_srg_database.json",'r') as datafile:
++    with open("/usr/share/sagemath/graphs/brouwer_srg_database.json",'r') as datafile:
+         _brouwer_database = {(v,k,l,mu):{'status':status,'comments':comments}
+                              for (v,k,l,mu,status,comments) in json.load(datafile)}
+ 
+--- a/sage/src/sage/geometry/lattice_polytope.py
++++ b/sage/src/sage/geometry/lattice_polytope.py
+@@ -112,7 +112,6 @@
+ from sage.matrix.constructor import matrix
+ from sage.matrix.matrix import is_Matrix
+ from sage.misc.all import cached_method, tmp_filename
+-from sage.env import SAGE_SHARE
+ from sage.modules.all import vector, span
+ from sage.misc.superseded import deprecated_function_alias, deprecation
+ from sage.plot.plot3d.index_face_set import IndexFaceSet
+@@ -136,7 +135,7 @@
+ from functools import reduce
+ 
+ 
+-data_location = os.path.join(SAGE_SHARE,'reflexive_polytopes')
++data_location = '/usr/share/sagemath/reflexive_polytopes'
+ 
+ 
+ class SetOfAllLatticePolytopesClass(Set_generic):
+--- a/sage/src/sage/geometry/polyhedron/palp_database.py
++++ b/sage/src/sage/geometry/polyhedron/palp_database.py
+@@ -107,8 +107,7 @@
+             self._data_basename = data_basename
+         else:
+             import os
+-            from sage.env import SAGE_SHARE
+-            self._data_basename = os.path.join(SAGE_SHARE, 'reflexive_polytopes',
++            self._data_basename = os.path.join('/usr/share/sagemath/reflexive_polytopes',
+                                                'Full'+str(dim)+'d', 'zzdb')
+             info = self._data_basename + '.info'
+             if not os.path.exists(info):
+--- a/sage/src/sage/databases/sql_db.py
++++ b/sage/src/sage/databases/sql_db.py
+@@ -242,7 +242,6 @@
+     skeleton = {}
+     cur = database.__connection__.cursor()
+     exe = cur.execute("SELECT name FROM sqlite_master WHERE TYPE='table'")
+-    from sage.env import SAGE_SHARE
+     for table in exe.fetchall():
+         skeleton[table[0]] = {}
+         exe1 = cur.execute("PRAGMA table_info(%s)"%table[0])
+@@ -257,7 +256,7 @@
+         for col in exe2.fetchall():
+             if col[1].find('sqlite') == -1:
+                 if database.__dblocation__ == \
+-                        os.path.join(SAGE_SHARE,'graphs','graphs.db'):
++                        os.path.join('/usr/share/sagemath/graphs','graphs.db'):
+                     name = col[1]
+                 else:
+                     name = col[1][len(table[0])+3:]
+--- a/sage/src/sage/graphs/graph_database.py
++++ b/sage/src/sage/graphs/graph_database.py
+@@ -54,9 +54,8 @@
+ from sage.rings.integer import Integer
+ from sqlite3 import dbapi2 as sqlite # if anyone would like to explain why dbapi2...
+ from sage.databases.sql_db import SQLDatabase, SQLQuery
+-from sage.env import SAGE_SHARE
+ from sage.graphs.graph import Graph
+-dblocation = os.path.join(SAGE_SHARE,'graphs','graphs.db')
++dblocation = os.path.join('/usr/share/sagemath/graphs','graphs.db')
+ 
+ def degseq_to_data(degree_sequence):
+     """
diff --git a/debian/patches/series b/debian/patches/series
index 0393206..e7d93bc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -42,6 +42,7 @@ d0-pari-stackwarn.patch
 d0-rubiks.patch
 d0-singular.patch
 d0-disable-jsmol.patch
+d0-paths-sharedata.patch
 d0-paths.patch
 
 # Patch Sage to behave as a Debian package

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagemath.git



More information about the debian-science-commits mailing list