[arch-commits] Commit in sagemath-doc/repos (4 files)

Antonio Rojas arojas at archlinux.org
Wed Jan 1 23:10:57 UTC 2020


    Date: Wednesday, January 1, 2020 @ 23:10:56
  Author: arojas
Revision: 545970

archrelease: copy trunk to community-testing-any

Added:
  sagemath-doc/repos/community-testing-any/
  sagemath-doc/repos/community-testing-any/PKGBUILD
    (from rev 545969, sagemath-doc/trunk/PKGBUILD)
  sagemath-doc/repos/community-testing-any/docbuild_main.patch
    (from rev 545969, sagemath-doc/trunk/docbuild_main.patch)
  sagemath-doc/repos/community-testing-any/sagemath-ecl-sigfpe.patch
    (from rev 545969, sagemath-doc/trunk/sagemath-ecl-sigfpe.patch)

---------------------------+
 PKGBUILD                  |   60 +++++++++++++++++
 docbuild_main.patch       |    6 +
 sagemath-ecl-sigfpe.patch |  147 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 213 insertions(+)

Copied: sagemath-doc/repos/community-testing-any/PKGBUILD (from rev 545969, sagemath-doc/trunk/PKGBUILD)
===================================================================
--- community-testing-any/PKGBUILD	                        (rev 0)
+++ community-testing-any/PKGBUILD	2020-01-01 23:10:56 UTC (rev 545970)
@@ -0,0 +1,60 @@
+# Maintainer: Antonio Rojas <arojas at archlinux.org>
+
+pkgname=sagemath-doc
+pkgver=9.0
+pkgrel=1
+pkgdesc="HTML documentation for SageMath"
+arch=(any)
+url="http://www.sagemath.org"
+license=(GPL)
+depends=(gap-doc pplpy-doc)
+makedepends=(sagemath python-pyzmq python-docutils python-jupyter_client python-pkgconfig cython python-ipywidgets python-sphinx-1 thebe)
+source=(sagemath-$pkgver.tar.gz::"https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
+        docbuild_main.patch
+        sagemath-ecl-sigfpe.patch)
+sha256sums=('6f5d42b306a2c03073dd95086f80602bd1a0b929b8ad19c6d219c8ca8e96da26'
+            'ea5e17bb7a7cb36a22e5e3872fcc2585852bc971c4b139b0b2cd69a36c1b009b'
+            'e44bbde87f3312548faad75b7383ef21fade55be251ab5804de41cd3842ca8a0')
+
+prepare() {
+  cd sage-$pkgver
+
+# fix relative imports
+  patch -p0 -i ../docbuild_main.patch
+# use sage_setup imports from sagemath source, but use system sage ones (which include compiled modules)
+  mkdir -p local-python
+  ln -sr src/sage_setup local-python
+# Fix SIGFPE crashes with ecl 16.1.3 https://trac.sagemath.org/ticket/22191
+  patch -p1 -i ../sagemath-ecl-sigfpe.patch
+}
+
+build() {
+  cd sage-$pkgver/src
+
+  export SAGE_LOCAL="/usr" \
+         SAGE_ROOT="/usr" \
+         SAGE_SRC="$PWD" \
+         SAGE_DOC_SRC="$PWD"/doc \
+         SAGE_DOC="$PWD"/doc \
+         MATHJAX_DIR="/usr/share/mathjax2" \
+         PYTHONPATH="$srcdir"/sage-$pkgver/local-python \
+         SAGE_NUM_THREADS=10
+  python sage_setup/docbuild --no-pdf-links --mathjax all html -k
+}
+
+package() {
+  cd sage-$pkgver/src/doc
+ 
+  mkdir -p "$pkgdir"/usr/share/doc/sage
+  cp -r common "$pkgdir"/usr/share/doc/sage
+  cp -r html "$pkgdir"/usr/share/doc/sage
+
+# Replace duplicated files by symlinks (Gentoo)
+  cd "$pkgdir"/usr/share/doc/sage
+  mv html/en/_static{,.tmp}
+  for _dir in `find -name _static` ; do
+    rm -r $_dir
+    ln -s /usr/share/doc/sage/html/en/_static $_dir
+  done
+  mv html/en/_static{.tmp,}
+}

Copied: sagemath-doc/repos/community-testing-any/docbuild_main.patch (from rev 545969, sagemath-doc/trunk/docbuild_main.patch)
===================================================================
--- community-testing-any/docbuild_main.patch	                        (rev 0)
+++ community-testing-any/docbuild_main.patch	2020-01-01 23:10:56 UTC (rev 545970)
@@ -0,0 +1,6 @@
+--- src/sage_setup/docbuild/__main__.py.orig
++++ src/sage_setup/docbuild/__main__.py
+@@ -1,2 +1,2 @@
+-from . import main
++from sage_setup.docbuild import main
+ main()

Copied: sagemath-doc/repos/community-testing-any/sagemath-ecl-sigfpe.patch (from rev 545969, sagemath-doc/trunk/sagemath-ecl-sigfpe.patch)
===================================================================
--- community-testing-any/sagemath-ecl-sigfpe.patch	                        (rev 0)
+++ community-testing-any/sagemath-ecl-sigfpe.patch	2020-01-01 23:10:56 UTC (rev 545970)
@@ -0,0 +1,147 @@
+diff --git a/src/sage/libs/ecl.pyx b/src/sage/libs/ecl.pyx
+index e408866..fa24ac0 100644
+--- a/src/sage/libs/ecl.pyx
++++ b/src/sage/libs/ecl.pyx
+@@ -15,7 +15,7 @@ from __future__ import print_function, absolute_import
+ #adapted to work with pure Python types.
+ 
+ from libc.stdlib cimport abort
+-from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD
++from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD, SIGFPE
+ from libc.signal cimport raise_ as signal_raise
+ from posix.signal cimport sigaction, sigaction_t
+ cimport cysignals.signals
+@@ -47,9 +47,14 @@ cdef extern from "eclsig.h":
+     void ecl_sig_off()
+     cdef sigaction_t ecl_sigint_handler
+     cdef sigaction_t ecl_sigbus_handler
++    cdef sigaction_t ecl_sigfpe_handler
+     cdef sigaction_t ecl_sigsegv_handler
+     cdef mpz_t ecl_mpz_from_bignum(cl_object obj)
+     cdef cl_object ecl_bignum_from_mpz(mpz_t num)
++    cdef int fegetexcept()
++    cdef int feenableexcept(int)
++    cdef int fedisableexcept(int)
++    cdef int ecl_feflags
+ 
+ cdef cl_object string_to_object(char * s):
+     return ecl_read_from_cstring(s)
+@@ -238,6 +243,7 @@ def init_ecl():
+     global ecl_has_booted
+     cdef char *argv[1]
+     cdef sigaction_t sage_action[32]
++    cdef int sage_fpes
+     cdef int i
+ 
+     if ecl_has_booted:
+@@ -257,6 +263,8 @@ def init_ecl():
+     for i in range(1,32):
+         sigaction(i, NULL, &sage_action[i])
+ 
++    sage_fpes = fegetexcept()
++
+     #initialize ECL
+     ecl_set_option(ECL_OPT_SIGNAL_HANDLING_THREAD, 0)
+     cl_boot(1, argv)
+@@ -264,8 +272,12 @@ def init_ecl():
+     #save signal handler from ECL
+     sigaction(SIGINT, NULL, &ecl_sigint_handler)
+     sigaction(SIGBUS, NULL, &ecl_sigbus_handler)
++    sigaction(SIGFPE, NULL, &ecl_sigfpe_handler)
+     sigaction(SIGSEGV, NULL, &ecl_sigsegv_handler)
+ 
++    #save ECL's floating point exception flags
++    ecl_feflags = fegetexcept()
++
+     #verify that no SIGCHLD handler was installed
+     cdef sigaction_t sig_test
+     sigaction(SIGCHLD, NULL, &sig_test)
+@@ -276,6 +288,9 @@ def init_ecl():
+     for i in range(1,32):
+         sigaction(i, &sage_action[i], NULL)
+ 
++    fedisableexcept(ecl_feflags)
++    feenableexcept(sage_fpes)
++
+     #initialise list of objects and bind to global variable
+     # *SAGE-LIST-OF-OBJECTS* to make it rooted in the reachable tree for the GC
+     list_of_objects=cl_cons(Cnil,cl_cons(Cnil,Cnil))
+@@ -319,7 +334,6 @@ def init_ecl():
+                     (values nil (princ-to-string cnd)))))
+         """))
+     safe_funcall_clobj=cl_eval(string_to_object(b"(symbol-function 'sage-safe-funcall)"))
+-
+     ecl_has_booted = 1
+ 
+ cdef cl_object ecl_safe_eval(cl_object form) except NULL:
+diff --git a/src/sage/libs/eclsig.h b/src/sage/libs/eclsig.h
+index f9f2690..a7e1f40 100644
+--- a/src/sage/libs/eclsig.h
++++ b/src/sage/libs/eclsig.h
+@@ -9,24 +9,66 @@
+ 
+ 
+ #include <signal.h>
++
++/* Rummage around to determine how ECL was configured */
++#define ECL_AVOID_FPE_H  /* Prevent some local includes */
++#include <ecl/config-internal.h>
++
++#ifdef HAVE_FENV_H
++#include <fenv.h>
++#ifndef FE_ALL_EXCEPT
++#define FE_ALL_EXCEPT FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INVALID
++#endif
++#else
++#ifndef FE_ALL_EXCEPT
++#define FE_ALL_EXCEPT 0
++#endif
++#define feclearexcept(flags) do {} while (0)
++#endif
++
++#ifndef HAVE_FEENABLEEXCEPT
++/* These are GNU extensions */
++#define fegetexcept() 0
++#define feenablexcept(flags) do {} while (0)
++#define fdisableexcept(flags) do {} while (0)
++#endif
++
+ static struct sigaction ecl_sigint_handler;
+ static struct sigaction ecl_sigbus_handler;
++static struct sigaction ecl_sigfpe_handler;
+ static struct sigaction ecl_sigsegv_handler;
+ static struct sigaction sage_sigint_handler;
+ static struct sigaction sage_sigbus_handler;
++static struct sigaction sage_sigfpe_handler;
+ static struct sigaction sage_sigsegv_handler;
++static int ecl_feflags;
++static int sage_feflags;
+ 
+ static inline void set_ecl_signal_handler(void)
+ {
+     sigaction(SIGINT, &ecl_sigint_handler, &sage_sigint_handler);
+     sigaction(SIGBUS, &ecl_sigbus_handler, &sage_sigbus_handler);
++    sigaction(SIGFPE, &ecl_sigfpe_handler, &sage_sigfpe_handler);
+     sigaction(SIGSEGV, &ecl_sigsegv_handler, &sage_sigsegv_handler);
++
++    /* first clear pending floating point exceptions, if any */
++    feclearexcept(FE_ALL_EXCEPT);
++
++    /* sage_feflags should be 0; we don't set them otherwise */
++    sage_feflags = fedisableexcept(FE_ALL_EXCEPT);
++    feenableexcept(ecl_feflags);
+ }
+ 
+ static inline void unset_ecl_signal_handler(void)
+ {
++    /* clear pending exceptions and restore previous exception mask */
++    feclearexcept(FE_ALL_EXCEPT);
++    ecl_feflags = fedisableexcept(FE_ALL_EXCEPT);
++    feenableexcept(sage_feflags);
++
+     sigaction(SIGINT, &sage_sigint_handler, NULL);
+     sigaction(SIGBUS, &sage_sigbus_handler, NULL);
++    sigaction(SIGFPE, &sage_sigfpe_handler, NULL);
+     sigaction(SIGSEGV, &sage_sigsegv_handler, NULL);
+ }
+ 



More information about the arch-commits mailing list