[sagemath] 01/01: Use dh_sphinxdoc (must patch it locally) to symlink some embedded JS; and:

Ximin Luo infinity0 at debian.org
Tue Oct 18 00:19:31 UTC 2016


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

infinity0 pushed a commit to branch master
in repository sagemath.

commit 73fd2f0c2f31676be81eeec77e7a545a868f8069
Author: Ximin Luo <infinity0 at debian.org>
Date:   Tue Oct 18 02:18:47 2016 +0200

    Use dh_sphinxdoc (must patch it locally) to symlink some embedded JS; and:
    
    - Don't install doctrees / inventory, they're only needed at build-time
    - Also refresh patches and add some more descriptions, etc
---
 debian/README.Debian                               |  2 ++
 debian/changelog                                   |  2 +-
 debian/control.in                                  |  2 ++
 debian/lang.py                                     |  5 +++++
 debian/not-installed                               |  2 ++
 debian/patches/debian-install-paths.patch          | 22 ++++++++++++++++++----
 .../fixsage-allow-override-sage-local.patch        | 15 +++++++++++++--
 debian/patches/fixsage-proper-scipy-rtol.patch     |  6 +++---
 debian/patches/version-cddlib-094h.patch           |  4 ++--
 debian/patches/version-glpk-4.60.patch             | 14 ++++----------
 debian/rules                                       | 12 +++++++++---
 debian/sagemath-doc-LANG.control.in                | 18 ++++++++++++++++--
 debian/sagemath-doc-LANG.install.in                |  2 --
 13 files changed, 77 insertions(+), 29 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 5259701..6823ce7 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -145,6 +145,8 @@ And various other "time out" / "segfault" that appear and vanish...
 
 ## Manual testing
 
+First, edit /usr/bin/dh_sphinxdoc as described in bug #841141. Then:
+
 If you override the failed tests with DEB_BUILD_OPTIONS=nocheck you can build
 some .debs, install them, and test the CLI or the notebooks manually. At the
 moment, quite a lot of stuff is not working:
diff --git a/debian/changelog b/debian/changelog
index a5d781c..99973a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,5 @@
 sagemath (7.3-1) UNRELEASED; urgency=low
 
-  * Initial package.
+  * Initial package. (Closes: #841136)
 
  -- Tobias Hansen <thansen at debian.org>  Tue, 09 Aug 2016 12:47:33 +0000
diff --git a/debian/control.in b/debian/control.in
index c920e01..cbd4a1e 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -13,6 +13,7 @@ X-Python-Version: 2.7
 Build-Depends:
  autoconf,
  ccache <pkg.sagemath.ccache>,
+ iso-codes,
  cysignals-tools <!nodoc>,
  cython (>= 0.24.1),
  debhelper (>= 9),
@@ -194,6 +195,7 @@ Description: Sage: Open Source Mathematical Software
  This package contains the main Sage installation.
 Depends: ${misc:Depends}, ${shlibs:Depends}, sagemath-common, sagemath-deps
 # TODO: missing a *lot* of python and other dependencies here
+Suggests: sagemath-doc-en
 
 Package: sagemath-common
 Architecture: all
diff --git a/debian/lang.py b/debian/lang.py
new file mode 100755
index 0000000..292a857
--- /dev/null
+++ b/debian/lang.py
@@ -0,0 +1,5 @@
+#!/usr/bin/python
+import json
+import sys
+x = json.load(open("/usr/share/iso-codes/json/iso_639-2.json"))
+print([l for l in x["639-2"] if "alpha_2" in l and l["alpha_2"] == sys.argv[1]][0]["name"])
diff --git a/debian/not-installed b/debian/not-installed
new file mode 100644
index 0000000..a657d1f
--- /dev/null
+++ b/debian/not-installed
@@ -0,0 +1,2 @@
+usr/share/doc/sage/doctrees
+usr/share/doc/sage/inventory
diff --git a/debian/patches/debian-install-paths.patch b/debian/patches/debian-install-paths.patch
index f9bc60b..346c3a2 100644
--- a/debian/patches/debian-install-paths.patch
+++ b/debian/patches/debian-install-paths.patch
@@ -2,6 +2,9 @@ Description: Install to Debian paths
  TODO: upstream hard-codes "site-packages" in a bunch of places; these should
  be fixed to use SAGE_LIB instead and forwarded upstream. Then this patch could
  be a lot smaller.
+ .
+ The multidocs.py patch looks like a Sage upstream bug, that probably needs to
+ be forwarded.
 Author: Tobias Hansen <thansen at debian.org>
 Author: Ximin Luo <infinity0 at debian.org>
 Forwarded: not-needed
@@ -20,7 +23,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  	@echo "Deleting Sage library build artifacts..."
 --- a/sage/src/bin/sage-env
 +++ b/sage/src/bin/sage-env
-@@ -118,6 +117,9 @@ elif [ -f sage -a -d build ]; then
+@@ -118,6 +118,9 @@
      NEW_SAGE_ROOT="."
  elif [ -f ../../sage -a -d ../../build ]; then
      NEW_SAGE_ROOT="../.."
@@ -30,7 +33,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  else
      # No idea what SAGE_ROOT should be...
      echo >&2 "Error: You must set the SAGE_ROOT environment variable or run this"
-@@ -128,17 +132,6 @@
+@@ -128,17 +131,6 @@
  # Make NEW_SAGE_ROOT absolute
  NEW_SAGE_ROOT=`cd "$NEW_SAGE_ROOT" && pwd -P`
  
@@ -48,7 +51,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  # Warn if NEW_SAGE_ROOT does not equal the old SAGE_ROOT
  if [ "$SAGE_ROOT" != "$NEW_SAGE_ROOT" -a -n "$SAGE_ROOT" ]; then
      echo >&2 "Warning: overwriting SAGE_ROOT environment variable:"
-@@ -364,7 +357,7 @@
+@@ -364,7 +356,7 @@
      export SAGE_STARTUP_FILE
  fi
  
@@ -92,7 +95,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
      m.include_dirs = m.include_dirs + libgap_include_dirs + include_dirs
  
  
-@@ -624,7 +631,7 @@
+@@ -631,7 +631,7 @@
  print('Cleaning up stale installed files....')
  t = time.time()
  from sage_setup.clean import clean_install_dir
@@ -244,3 +247,14 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
              file = '<a href="/src/%s" target="_new">src/sage/%s</a>'%(fname,fname)
          else:
              file = filename
+--- a/sage/src/sage_setup/docbuild/ext/multidocs.py
++++ b/sage/src/sage_setup/docbuild/ext/multidocs.py
+@@ -277,7 +277,7 @@ def init_subdoc(app):
+             """
+             app.builder.info(bold('linking _static directory.'))
+             static_dir = os.path.join(app.builder.outdir, '_static')
+-            master_static_dir = os.path.join('..', '_static')
++            master_static_dir = os.path.join('..', '..', '_static')
+             if os.path.lexists(static_dir):
+                 if os.path.isdir(static_dir) and not os.path.islink(static_dir):
+                     shutil.rmtree(static_dir)
diff --git a/debian/patches/fixsage-allow-override-sage-local.patch b/debian/patches/fixsage-allow-override-sage-local.patch
index cb8acf4..da4ab76 100644
--- a/debian/patches/fixsage-allow-override-sage-local.patch
+++ b/debian/patches/fixsage-allow-override-sage-local.patch
@@ -6,8 +6,8 @@ Author: Ximin Luo <infinity0 at debian.org>
 Forwarded: TODO
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/sage
-+++ b/sage
+--- a/sage/sage
++++ b/sage/sage
 @@ -134,6 +134,8 @@
      exec "$SAGE_ROOT/src/bin/sage" "$@"
  elif [ -x "$SAGE_ROOT/local/bin/sage" ]; then # if in a stripped binary
@@ -115,3 +115,14 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  
  print('python_packages = {0}'.format(python_packages))
  print('python_modules = {0}'.format(python_modules))
+--- a/sage/src/sage/repl/ipython_kernel/install.py
++++ b/sage/src/sage/repl/ipython_kernel/install.py
+@@ -94,7 +94,7 @@
+         except OSError as err:
+             if err.errno == errno.EEXIST:
+                 return
+-        os.symlink(src, dst)
++        os.symlink(os.path.relpath(src, os.path.dirname(dst)), dst)
+ 
+     def use_local_mathjax(self):
+         """
diff --git a/debian/patches/fixsage-proper-scipy-rtol.patch b/debian/patches/fixsage-proper-scipy-rtol.patch
index 750b74c..a5fa74c 100644
--- a/debian/patches/fixsage-proper-scipy-rtol.patch
+++ b/debian/patches/fixsage-proper-scipy-rtol.patch
@@ -23,7 +23,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
      (or `[b,a]`) if possible, where ``f`` is a function in the one variable.
 --- a/sage/src/sage/symbolic/expression.pyx
 +++ b/sage/src/sage/symbolic/expression.pyx
-@@ -10884,7 +10886,7 @@
+@@ -10884,7 +10884,7 @@
              ret = ret[0]
          return ret
  
@@ -32,7 +32,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
          """
          Numerically find a root of self on the closed interval [a,b] (or
          [b,a]) if possible, where self is a function in the one variable.
-@@ -11000,7 +11002,7 @@
+@@ -11000,7 +11000,7 @@
          """
          if is_a_relational(self._gobj) and self.operator() is not operator.eq:
              raise ValueError("Symbolic equation must be an equality.")
@@ -41,7 +41,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
          if self.number_of_arguments() == 0:
              if bool(self == 0):
                  return a
-@@ -11009,7 +11011,7 @@
+@@ -11009,7 +11009,7 @@
          elif self.number_of_arguments() == 1:
              f = self._fast_float_(self.default_variable())
              return find_root(f, a=a, b=b, xtol=xtol,
diff --git a/debian/patches/version-cddlib-094h.patch b/debian/patches/version-cddlib-094h.patch
index cf92b47..ceae184 100644
--- a/debian/patches/version-cddlib-094h.patch
+++ b/debian/patches/version-cddlib-094h.patch
@@ -5,7 +5,7 @@ Forwarded: TODO
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/sage/src/sage/geometry/polyhedron/backend_cdd.py
 +++ b/sage/src/sage/geometry/polyhedron/backend_cdd.py
-@@ -288,7 +290,9 @@
+@@ -288,7 +288,9 @@
              else:
                  n_cdd=n;
              self._V_adjacency_matrix = matrix(ZZ, n, n, 0)
@@ -16,7 +16,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
              l = cddout.pop(0).split()
              assert int(l[0]) == n_cdd, "Not enough V-adjacencies in cdd output?"
              for i in range(n_cdd):
-@@ -311,7 +315,9 @@
+@@ -311,7 +313,9 @@
          if find_in_cddout('Facet graph'):
              n = len(self._Hrepresentation);
              self._H_adjacency_matrix = matrix(ZZ, n, n, 0)
diff --git a/debian/patches/version-glpk-4.60.patch b/debian/patches/version-glpk-4.60.patch
index 6e14ac9..25b079d 100644
--- a/debian/patches/version-glpk-4.60.patch
+++ b/debian/patches/version-glpk-4.60.patch
@@ -5,11 +5,9 @@ Bug: https://trac.sagemath.org/ticket/20710
 Forwarded: not-needed
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-diff --git a/src/sage/numerical/backends/glpk_backend.pyx b/src/sage/numerical/backends/glpk_backend.pyx
-index 7a7ae0a..b0f9f2a 100644
 --- a/sage/src/sage/numerical/backends/glpk_backend.pyx
 +++ b/sage/src/sage/numerical/backends/glpk_backend.pyx
-@@ -1004,8 +1006,8 @@ cdef class GLPKBackend(GenericBackend):
+@@ -1004,8 +1004,8 @@
          Same, now with a time limit::
  
              sage: p.solver_parameter("mip_gap_tolerance",1)
@@ -20,11 +18,9 @@ index 7a7ae0a..b0f9f2a 100644
              1
          """
  
-diff --git a/src/sage/numerical/backends/glpk_graph_backend.pyx b/src/sage/numerical/backends/glpk_graph_backend.pyx
-index a099788..498e8e1 100644
 --- a/sage/src/sage/numerical/backends/glpk_graph_backend.pyx
 +++ b/sage/src/sage/numerical/backends/glpk_graph_backend.pyx
-@@ -162,12 +162,12 @@ cdef class GLPKGraphBackend(object):
+@@ -162,12 +162,12 @@
          sage: a = gbe.add_edge('0', '1')
          sage: gbe.write_graph(SAGE_TMP+"/graph.txt")
          Writing graph to ...
@@ -40,7 +36,7 @@ index a099788..498e8e1 100644
  
      The following example imports a Sage ``Graph`` and then uses it to solve a
      maxflow problem::
-@@ -1060,7 +1060,7 @@ cdef class GLPKGraphBackend(object):
+@@ -1060,7 +1060,7 @@
              sage: a = gbe.add_edge("0", "1")
              sage: gbe.write_graph(SAGE_TMP+"/graph.txt")
              Writing graph to ...
@@ -49,11 +45,9 @@ index a099788..498e8e1 100644
              0
          """
  
-diff --git a/src/sage/numerical/mip.pyx b/src/sage/numerical/mip.pyx
-index 8c17d87..b45c82f 100644
 --- a/sage/src/sage/numerical/mip.pyx
 +++ b/sage/src/sage/numerical/mip.pyx
-@@ -2519,10 +2519,10 @@ cdef class MixedIntegerLinearProgram(SageObject):
+@@ -2519,10 +2519,10 @@
              sage: b.solver_parameter("simplex_or_intopt", "simplex_only")
              sage: b.solver_parameter("verbosity_simplex", "GLP_MSG_ALL")
              sage: p.solve()  # rel tol 1e-5
diff --git a/debian/rules b/debian/rules
index 5db3898..44428b5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -32,7 +32,7 @@ DOCS_INSTALL = $(LANGS:%=debian/sagemath-doc-%.install)
 DOCS_CONTROL = $(LANGS:%=debian/sagemath-doc-%.control)
 
 %:
-	dh $@ --parallel
+	dh $@ --parallel --with=sphinxdoc
 
 build: gencontrol
 
@@ -42,10 +42,10 @@ debian/control: debian/control.in $(DOCS_CONTROL)
 	cat $^ > "$@"
 
 debian/sagemath-doc-%.control: debian/sagemath-doc-LANG.control.in debian/rules
-	sed -e 's/LANG/$*/g' < "$<" > "$@"
+	sed -e "s/LANGUAGE/$$(debian/lang.py $*)/g" -e 's/LANG/$*/g' < "$<" > "$@"
 
 debian/sagemath-doc-%.install: debian/sagemath-doc-LANG.install.in debian/rules
-	sed -e 's/LANG/$*/g' < "$<" > "$@"
+	sed -e "s/LANGUAGE/$$(debian/lang.py $*)/g" -e 's/LANG/$*/g' < "$<" > "$@"
 
 override_dh_auto_build: prune
 	$(MAKE) --directory=sage $(DEB_BUILD_TARGET)
@@ -81,6 +81,12 @@ override_dh_compress:
 # them from compression anyway for now, so the build goes quicker.
 	dh_compress -X.pdf -X.pickle -X.doctree
 
+override_dh_sphinxdoc:
+# TODO: fix MathJax.js, Sage needs special treatment
+# `man dh_sphinxdoc` says symlinking translations.js is not yet supported
+# likewise, it seems not to recognise searchtools.js yet
+	dh_sphinxdoc -XMathJax.js -Xtranslations.js -Xsearchtools.js
+
 # If we see "nodoc", don't clean the docs. This allows us to rebuild just the
 # non-docs without wiping away the docs we previously built, to save time.
 override_dh_clean:
diff --git a/debian/sagemath-doc-LANG.control.in b/debian/sagemath-doc-LANG.control.in
index 5091fde..d1fdada 100644
--- a/debian/sagemath-doc-LANG.control.in
+++ b/debian/sagemath-doc-LANG.control.in
@@ -1,5 +1,19 @@
 
 Package: sagemath-doc-LANG
 Architecture: all
-Description: Documentation for SageMath (LANG)
-Depends: ${misc:Depends}
+Description: Sage: Open Source Mathematical Software - documentation (LANGUAGE)
+ SageMath is a free open-source mathematics software system licensed under the
+ GPL. It builds on top of many existing open-source packages: NumPy, SciPy,
+ matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. Access their combined
+ power through a common, Python-based language or directly via interfaces or
+ wrappers.
+ .
+ Mission: Creating a viable free open source alternative to Magma, Maple,
+ Mathematica and Matlab.
+ .
+ This package contains documentation in LANGUAGE.
+ .
+ Note that the package for English documentation (sagemath-doc-en) contains far
+ more documentation that any of the other languages, so if you're finding this
+ package lacking in content, then you could try that one as well.
+Depends: ${misc:Depends}, ${sphinxdoc:Depends}
diff --git a/debian/sagemath-doc-LANG.install.in b/debian/sagemath-doc-LANG.install.in
index 4503be9..83c5887 100644
--- a/debian/sagemath-doc-LANG.install.in
+++ b/debian/sagemath-doc-LANG.install.in
@@ -1,3 +1 @@
-usr/share/doc/sage/doctrees/LANG
 usr/share/doc/sage/html/LANG
-usr/share/doc/sage/inventory/LANG

-- 
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