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

Antonio Rojas arojas at archlinux.org
Thu Jan 12 06:54:02 UTC 2017


    Date: Thursday, January 12, 2017 @ 06:54:01
  Author: arojas
Revision: 206903

archrelease: copy trunk to community-staging-i686, community-staging-x86_64

Added:
  sagemath/repos/community-staging-i686/
  sagemath/repos/community-staging-i686/PKGBUILD
    (from rev 206902, sagemath/trunk/PKGBUILD)
  sagemath/repos/community-staging-i686/cython-sys-path.patch
    (from rev 206902, sagemath/trunk/cython-sys-path.patch)
  sagemath/repos/community-staging-i686/disable-fes.patch
    (from rev 206902, sagemath/trunk/disable-fes.patch)
  sagemath/repos/community-staging-i686/ecm-7.patch
    (from rev 206902, sagemath/trunk/ecm-7.patch)
  sagemath/repos/community-staging-i686/env.patch
    (from rev 206902, sagemath/trunk/env.patch)
  sagemath/repos/community-staging-i686/increase-rtol.patch
    (from rev 206902, sagemath/trunk/increase-rtol.patch)
  sagemath/repos/community-staging-i686/is-package-installed.patch
    (from rev 206902, sagemath/trunk/is-package-installed.patch)
  sagemath/repos/community-staging-i686/jupyter-path.patch
    (from rev 206902, sagemath/trunk/jupyter-path.patch)
  sagemath/repos/community-staging-i686/package.patch
    (from rev 206902, sagemath/trunk/package.patch)
  sagemath/repos/community-staging-i686/skip-check.patch
    (from rev 206902, sagemath/trunk/skip-check.patch)
  sagemath/repos/community-staging-i686/test-optional.patch
    (from rev 206902, sagemath/trunk/test-optional.patch)
  sagemath/repos/community-staging-x86_64/
  sagemath/repos/community-staging-x86_64/PKGBUILD
    (from rev 206902, sagemath/trunk/PKGBUILD)
  sagemath/repos/community-staging-x86_64/cython-sys-path.patch
    (from rev 206902, sagemath/trunk/cython-sys-path.patch)
  sagemath/repos/community-staging-x86_64/disable-fes.patch
    (from rev 206902, sagemath/trunk/disable-fes.patch)
  sagemath/repos/community-staging-x86_64/ecm-7.patch
    (from rev 206902, sagemath/trunk/ecm-7.patch)
  sagemath/repos/community-staging-x86_64/env.patch
    (from rev 206902, sagemath/trunk/env.patch)
  sagemath/repos/community-staging-x86_64/increase-rtol.patch
    (from rev 206902, sagemath/trunk/increase-rtol.patch)
  sagemath/repos/community-staging-x86_64/is-package-installed.patch
    (from rev 206902, sagemath/trunk/is-package-installed.patch)
  sagemath/repos/community-staging-x86_64/jupyter-path.patch
    (from rev 206902, sagemath/trunk/jupyter-path.patch)
  sagemath/repos/community-staging-x86_64/package.patch
    (from rev 206902, sagemath/trunk/package.patch)
  sagemath/repos/community-staging-x86_64/skip-check.patch
    (from rev 206902, sagemath/trunk/skip-check.patch)
  sagemath/repos/community-staging-x86_64/test-optional.patch
    (from rev 206902, sagemath/trunk/test-optional.patch)

-----------------------------------------------------+
 community-staging-i686/PKGBUILD                     |  148 ++++++++
 community-staging-i686/cython-sys-path.patch        |   10 
 community-staging-i686/disable-fes.patch            |   19 +
 community-staging-i686/ecm-7.patch                  |   79 ++++
 community-staging-i686/env.patch                    |   93 +++++
 community-staging-i686/increase-rtol.patch          |   37 ++
 community-staging-i686/is-package-installed.patch   |  328 ++++++++++++++++++
 community-staging-i686/jupyter-path.patch           |   22 +
 community-staging-i686/package.patch                |   38 ++
 community-staging-i686/skip-check.patch             |   22 +
 community-staging-i686/test-optional.patch          |   25 +
 community-staging-x86_64/PKGBUILD                   |  148 ++++++++
 community-staging-x86_64/cython-sys-path.patch      |   10 
 community-staging-x86_64/disable-fes.patch          |   19 +
 community-staging-x86_64/ecm-7.patch                |   79 ++++
 community-staging-x86_64/env.patch                  |   93 +++++
 community-staging-x86_64/increase-rtol.patch        |   37 ++
 community-staging-x86_64/is-package-installed.patch |  328 ++++++++++++++++++
 community-staging-x86_64/jupyter-path.patch         |   22 +
 community-staging-x86_64/package.patch              |   38 ++
 community-staging-x86_64/skip-check.patch           |   22 +
 community-staging-x86_64/test-optional.patch        |   25 +
 22 files changed, 1642 insertions(+)

Copied: sagemath/repos/community-staging-i686/PKGBUILD (from rev 206902, sagemath/trunk/PKGBUILD)
===================================================================
--- community-staging-i686/PKGBUILD	                        (rev 0)
+++ community-staging-i686/PKGBUILD	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,148 @@
+# $Id$
+# Maintainer: Evgeniy Alekseev <arcanis.arch at gmail dot com>
+# Maintainer: Antonio Rojas <arojas at archlinux.org>
+# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
+# Contributor: Thomas Dziedzic <gostrc at gmail dot com>
+# Contributor: Osman Ugus <ugus11 at yahoo dot com>
+# Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
+# Special thanks to Nareto for moving the compile from the .install to the PKGBUILD
+
+pkgbase=sagemath
+pkgname=(sagemath sagemath-jupyter)
+pkgver=7.5
+pkgrel=1
+pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
+arch=(i686 x86_64)
+url="http://www.sagemath.org"
+license=(GPL)
+depends=(ipython2 ppl palp brial cliquer maxima-ecl gfan sympow tachyon nauty python2-rpy2 python2-fpylll python2-psutil
+  python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow python2-future libgap flintqs lcalc lrcalc arb
+  eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox 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' 'python2-pkgconfig: to compile cython code'
+  'jmol: 3D plots' 'sage-notebook: Browser-based (flask) notebook interface'
+  'sagemath-doc: Documentation and inline help' 'python2-igraph: igraph backend for graph theory'
+  'coin-or-cbc: COIN backend for numerical computations' 'coin-or-csdp: for computing Lovász theta-function of graphs'
+  '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' 'cryptominisat2: SAT solver' 'gap-data: for computing Galois groups'
+  'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes'
+  'libhomfly: for computing the homfly polynomial of links' 'libbraiding: for computing in braid groups'
+  'python2-pynormaliz: Normaliz backend for polyhedral computations')
+makedepends=(cython2 boost ratpoints symmetrica fflas-ffpack python2-jinja coin-or-cbc libhomfly libbraiding
+  mcqd coxeter3 cryptominisat2 modular_decomposition bliss-graphs tdlib python2-pkgconfig meataxe) # libfes
+source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
+        env.patch skip-check.patch cython-sys-path.patch is-package-installed.patch package.patch disable-fes.patch
+        jupyter-path.patch test-optional.patch ecm-7.patch increase-rtol.patch)
+md5sums=('bff1fb8793ebc2934d14cf1efdcfbea3'
+         '784ba3fca83f24ed0bbf62e01fa4e967'
+         '6cafcb381437d4751fd55b25d5090987'
+         '0de8f29a99a48e2ca2a13045f122c386'
+         '409b0a2c520eb33281b5f262afcb6c76'
+         'ccfd5b1bc4796f414f1531be52504dd7'
+         '06a67e611d10aa2381efe1f08ea4ffd9'
+         '0d88207416dfb98a17bf8886257d9a02'
+         '921017fd2d9dadbb6b602ac0476bfd58'
+         '0c9a57d35de80c2cd418ebec912efbbb'
+         '39d3fded716d2a7ae0ab03e0896b7497')
+
+prepare(){
+  cd sage-$pkgver
+
+# Arch-specific patches
+# assume all optional packages are installed
+  patch -p0 -i ../package.patch
+# set env variables
+  patch -p0 -i ../env.patch
+# skip checking build status
+  patch -p0 -i ../skip-check.patch
+# don't list optional packages when running tests
+  patch -p0 -i ../test-optional.patch
+# set jupyter path
+  patch -p0 -i ../jupyter-path.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
+# increase numerical tolerance, needed by scipy 0.18
+  patch -p1 -i ../increase-rtol.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
+# 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/*
+  sed -e 's|cython {OPT}|cython2 {OPT}|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py
+  sed -e 's|exec ipython|exec ipython2|' -e 's|cygdb|cygdb2|g' -i src/bin/sage
+  sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
+  sed -e 's|bin/python|bin/python2|g' -i src/bin/sage-env
+}
+
+
+build() {
+  cd sage-$pkgver/src
+
+  export SAGE_LOCAL="/usr"
+  export SAGE_ROOT="$PWD"
+  export SAGE_SRC="$PWD"
+  export CC=gcc
+
+  python2 setup.py build
+}
+
+package_sagemath() {
+  optdepends+=('sagemath-jupyter: Jupyter kernel')
+  conflicts=(sage-mathematics)
+  replaces=(sage-mathematics) 
+  provides=(sage-mathematics)
+
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="$PWD"
+  export SAGE_LOCAL="/usr"
+  export JUPYTER_PATH="$pkgdir"/usr/share/jupyter
+
+  python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
+
+  mkdir -p "$pkgdir"/usr/bin
+  cp bin/sage "$pkgdir"/usr/bin
+  for _i in arch-env banner cachegrind callgrind cleaner coverage coverageall cython env eval grep grepdoc inline-fortran ipython \
+    massif maxima.lisp native-execute notebook num-threads.py omega open preparse python rst2sws rst2txt run run-cython runtests startuptime.py \
+    sws2rst valgrind version.sh
+  do
+    cp bin/sage-$_i "$pkgdir"/usr/bin
+  done
+  cp bin/math-readline "$pkgdir"/usr/bin
+  
+  mkdir -p "$pkgdir"/usr/share/sage
+  cp -r ext "$pkgdir"/usr/share/sage
+  
+# Create SAGE_SRC, needed for the notebook and help
+  mkdir "$pkgdir"/usr/share/sage/source
+  ln -s /usr/share/doc/sage "$pkgdir"/usr/share/sage/source/doc
+
+# Remove sage_setup
+  rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup
+
+# Split jupyter kernel
+  rm -r "$pkgdir"/usr/share/jupyter
+}
+
+package_sagemath-jupyter() {
+  pkgdesc='Jupyter kernel for SageMath'
+  depends=(sagemath python2-jupyter_client python2-ipywidgets jupyter-notebook mathjax)
+  optdepends=('sage-notebook-exporter: convert flask notebooks to Jupyter')
+
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="$PWD"
+  export SAGE_LOCAL="/usr"
+  export JUPYTER_PATH="$pkgdir"/usr/share/jupyter
+
+  python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update()"
+}

Copied: sagemath/repos/community-staging-i686/cython-sys-path.patch (from rev 206902, sagemath/trunk/cython-sys-path.patch)
===================================================================
--- community-staging-i686/cython-sys-path.patch	                        (rev 0)
+++ community-staging-i686/cython-sys-path.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,10 @@
+--- sage-7.1/src/setup.py.orig	2016-04-08 16:59:24.691349473 +0000
++++ sage-7.1/src/setup.py	2016-04-08 17:03:03.847153796 +0000
+@@ -414,6 +414,7 @@
+             build_dir=SAGE_CYTHONIZED,
+             force=force,
+             aliases=aliases,
++            include_path=sys.path,
+             compiler_directives={
+                 'autotestdict': False,
+                 'cdivision': True,

Copied: sagemath/repos/community-staging-i686/disable-fes.patch (from rev 206902, sagemath/trunk/disable-fes.patch)
===================================================================
--- community-staging-i686/disable-fes.patch	                        (rev 0)
+++ community-staging-i686/disable-fes.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,19 @@
+--- src/module_list.py.orig	2015-06-07 11:29:30.710612146 +0200
++++ src/module_list.py	2015-06-07 11:30:21.877506106 +0200
+@@ -564,11 +564,11 @@
+               sources = ["sage/libs/ecl.pyx"],
+               libraries = ["ecl"]),
+ 
+-    OptionalExtension("sage.libs.fes",
+-             ["sage/libs/fes.pyx"],
+-             language = "c",
+-             libraries = ['fes'],
+-             package = 'fes'),
++#    OptionalExtension("sage.libs.fes",
++#             ["sage/libs/fes.pyx"],
++#             language = "c",
++#             libraries = ['fes'],
++#             package = 'fes'),
+ 
+     Extension('sage.libs.flint.flint',
+               sources = ["sage/libs/flint/flint.pyx"],

Copied: sagemath/repos/community-staging-i686/ecm-7.patch (from rev 206902, sagemath/trunk/ecm-7.patch)
===================================================================
--- community-staging-i686/ecm-7.patch	                        (rev 0)
+++ community-staging-i686/ecm-7.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -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
+ """
+

Copied: sagemath/repos/community-staging-i686/env.patch (from rev 206902, sagemath/trunk/env.patch)
===================================================================
--- community-staging-i686/env.patch	                        (rev 0)
+++ community-staging-i686/env.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,93 @@
+--- src/bin/sage-env.orig	2015-01-06 10:46:04.469687605 +0100
++++ src/bin/sage-env	2015-01-06 10:49:59.547762019 +0100
+@@ -110,41 +110,7 @@
+ }
+ 
+ 
+-# New value for SAGE_ROOT: either SAGE_ROOT (if given)
+-# or a guessed value based on pwd.
+-if [ -n "$SAGE_ROOT" ]; then
+-    NEW_SAGE_ROOT="$SAGE_ROOT"
+-elif [ -f sage -a -d build ]; then
+-    NEW_SAGE_ROOT="."
+-elif [ -f ../../sage -a -d ../../build ]; then
+-    NEW_SAGE_ROOT="../.."
+-else
+-    # No idea what SAGE_ROOT should be...
+-    echo >&2 "Error: You must set the SAGE_ROOT environment variable or run this"
+-    echo >&2 "script from the SAGE_ROOT or SAGE_ROOT/local/bin/ directory."
+-    return 1
+-fi
+-
+-# Make NEW_SAGE_ROOT absolute
+-NEW_SAGE_ROOT=`cd "$NEW_SAGE_ROOT" && pwd -P`
+-
+-# Sanity check NEW_SAGE_ROOT
+-if [ -f "$NEW_SAGE_ROOT/sage" -a -d "$NEW_SAGE_ROOT/build" ]; then
+-    :
+-else
+-    echo >&2 "Error: SAGE_ROOT is set to a bad value:"
+-    echo >&2 "SAGE_ROOT=$SAGE_ROOT"
+-    echo >&2 "You must correct it or erase it and run this script from the SAGE_ROOT"
+-    echo >&2 "or SAGE_ROOT/local/bin/ directory."
+-    return 1
+-fi
+-
+-# 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:"
+-    echo >&2 "Old SAGE_ROOT=$SAGE_ROOT"
+-    echo >&2 "New SAGE_ROOT=$NEW_SAGE_ROOT"
+-fi
++NEW_SAGE_ROOT="/usr"
+ 
+ # Display the Sage startup banner, used in src/bin/sage
+ sage_banner() {
+@@ -187,7 +187,7 @@
+ 
+ # SAGE_LOCAL is the installation prefix and can be customized
+ if [ -z "$SAGE_LOCAL" ]; then
+-    export SAGE_LOCAL="$SAGE_ROOT/local"
++    export SAGE_LOCAL="/usr"
+ fi
+ 
+ # sage-env must know where the Sage's script files are
+@@ -233,8 +233,8 @@
+ export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
+ export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
+ export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
+-export SAGE_SRC="$SAGE_ROOT/src"
+-export SAGE_DOC_SRC="$SAGE_SRC/doc"
++export SAGE_SRC="$SAGE_SHARE/sage/source"
++export SAGE_DOC_SRC="$SAGE_SHARE/doc/sage"
+ export SAGE_DOC="$SAGE_SHARE/doc/sage"
+ 
+ if [ -z "${SAGE_ORIG_PATH_SET}" ]; then
+@@ -374,6 +337,9 @@
+     export SAGE_STARTUP_FILE
+ fi
+ 
++export LIBMTX="$DOT_SAGE/meataxe"
++[[ -d $LIBMTX ]] || mkdir $LIBMTX # Create meataxe data dir
++
+ if [ -z "$IPYTHONDIR" ]; then
+     # We hardcode a version number in the directory name. The idea is
+     # that we keep using the same version number as long as that is
+@@ -468,7 +400,6 @@
+         fi
+     fi
+ fi
+-export MAXIMA_PREFIX="$SAGE_LOCAL"
+ 
+ PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
+ 
+@@ -629,9 +608,6 @@
+     LD_LIBRARY_PATH="$SAGE_LOCAL/bin:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
+ fi
+ 
+-# See trac 7186 -- this is needed if ecl is moved
+-ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
+-
+ # Handle parallel building/testing/...
+ # See Trac Ticket #12016
+ # First, figure out the right values for SAGE_NUM_THREADS (default

Copied: sagemath/repos/community-staging-i686/increase-rtol.patch (from rev 206902, sagemath/trunk/increase-rtol.patch)
===================================================================
--- community-staging-i686/increase-rtol.patch	                        (rev 0)
+++ community-staging-i686/increase-rtol.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,37 @@
+diff -ru sage-7.3.orig/src/sage/coding/code_bounds.py sage-7.3/src/sage/coding/code_bounds.py
+--- sage-7.3.orig/src/sage/coding/code_bounds.py        2016-08-05 20:26:10.033204091 +0200
++++ sage-7.3/src/sage/coding/code_bounds.py     2016-08-05 20:32:27.276579565 +0200
+@@ -554,7 +554,7 @@
+     if q < 2:   # Here we check that q is actually at least 2
+         raise ValueError("The value q must be an integer greater than 1")
+ 
+-    eps  = 4.5e-16 # find_root has about this as the default xtol
++    eps  = 4.5e-15 # find_root has about this as the default xtol
+     ymax = 1 - 1/q
+     if x <= eps:
+         return 0
+diff -ru sage-7.3.orig/src/sage/numerical/optimize.py sage-7.3/src/sage/numerical/optimize.py
+--- sage-7.3.orig/src/sage/numerical/optimize.py        2016-08-05 20:26:10.816536625 +0200
++++ sage-7.3/src/sage/numerical/optimize.py     2016-08-05 20:32:21.449907130 +0200
+@@ -15,7 +15,7 @@
+ from sage.rings.real_double import RDF
+ 
+ 
+-def find_root(f, a, b, xtol=10e-13, rtol=4.5e-16, maxiter=100, full_output=False):
++def find_root(f, a, b, xtol=10e-13, rtol=4.5e-15, maxiter=100, full_output=False):
+     """
+     Numerically find a root of ``f`` on the closed interval `[a,b]`
+     (or `[b,a]`) if possible, where ``f`` is a function in the one variable.
+diff -ru sage-7.3.orig/src/sage/symbolic/expression.pyx sage-7.3/src/sage/symbolic/expression.pyx
+--- sage-7.3.orig/src/sage/symbolic/expression.pyx      2016-08-05 20:26:11.333202767 +0200
++++ sage-7.3/src/sage/symbolic/expression.pyx   2016-08-05 20:32:14.236566826 +0200
+@@ -10884,7 +10884,7 @@
+             ret = ret[0]
+         return ret
+ 
+-    def find_root(self, a, b, var=None, xtol=10e-13, rtol=4.5e-16, maxiter=100, full_output=False):
++    def find_root(self, a, b, var=None, xtol=10e-13, rtol=4.5e-15, maxiter=100, full_output=False):
+         """
+         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.
+

Copied: sagemath/repos/community-staging-i686/is-package-installed.patch (from rev 206902, sagemath/trunk/is-package-installed.patch)
===================================================================
--- community-staging-i686/is-package-installed.patch	                        (rev 0)
+++ community-staging-i686/is-package-installed.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,328 @@
+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
+@@ -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
+ 
+@@ -824,7 +823,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:
+@@ -1673,7 +1672,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
+@@ -614,8 +614,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
+@@ -1317,13 +1318,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
+@@ -21,7 +21,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
+@@ -3691,7 +3690,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
+@@ -7858,7 +7858,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 " +
+@@ -7876,10 +7875,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)
+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
+@@ -1195,8 +1195,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
+@@ -1280,8 +1281,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
+@@ -1433,8 +1435,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
+@@ -1632,8 +1635,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
+@@ -1786,8 +1790,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
+@@ -1400,15 +1400,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, "lib", "gap", "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
+@@ -145,7 +145,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
+@@ -190,8 +189,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)):
+@@ -1682,9 +1679,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):
+         """
+@@ -1735,9 +1730,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):
+         """
+@@ -4113,8 +4106,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
+@@ -53,10 +53,6 @@ from fpickle import pickle_function, unpickle_function
+ 
+ from .dist import install_scripts
+ 
+-from .package import (installed_packages, is_package_installed,
+-        standard_packages, optional_packages, experimental_packages,
+-        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
+@@ -163,7 +163,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
+ 
+@@ -1433,10 +1432,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":

Copied: sagemath/repos/community-staging-i686/jupyter-path.patch (from rev 206902, sagemath/trunk/jupyter-path.patch)
===================================================================
--- community-staging-i686/jupyter-path.patch	                        (rev 0)
+++ community-staging-i686/jupyter-path.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,22 @@
+--- src/sage/repl/ipython_kernel/install.py.orig	2015-10-23 19:23:39.728456590 +0000
++++ src/sage/repl/ipython_kernel/install.py	2015-10-23 19:24:00.965018978 +0000
+@@ -13,8 +13,7 @@
+     SAGE_ROOT, SAGE_DOC, SAGE_LOCAL, SAGE_EXTCODE,
+     SAGE_VERSION
+ )
+-from jupyter_core.paths import ENV_JUPYTER_PATH
+-JUPYTER_PATH = ENV_JUPYTER_PATH[0]
++JUPYTER_PATH = os.environ.get('JUPYTER_PATH') 
+ 
+ class SageKernelSpec(object):
+
+@@ -208,7 +208,7 @@
+             sage: spec._symlink_resources()    # not tested
+         """
+         path = os.path.join(SAGE_EXTCODE, 'notebook-ipython')
+-        for filename in os.listdir(path):
++        for filename in os.listdir('ext/notebook-ipython'):
+             self.symlink(
+                 os.path.join(path, filename),
+                 os.path.join(self.kernel_dir, filename)
+

Copied: sagemath/repos/community-staging-i686/package.patch (from rev 206902, sagemath/trunk/package.patch)
===================================================================
--- community-staging-i686/package.patch	                        (rev 0)
+++ community-staging-i686/package.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,38 @@
+--- src/sage/misc/package.py.orig	2014-11-23 15:58:13.000000000 +0100
++++ src/sage/misc/package.py	2015-01-22 20:32:25.651383902 +0100
+@@ -343,7 +343,7 @@
+         sage: for pkg in list_packages('pip', local=True):
+         ....:     assert not is_package_installed(pkg)
+     """
+-    return any(p.split('-')[0] == package for p in installed_packages(exclude_pip))
++    return True
+ 
+ def package_versions(package_type, local=False):
+     r"""
+--- src/sage_setup/optional_extension.py.orig  2016-10-19 18:35:10.092577510 +0000
++++ src/sage_setup/optional_extension.py       2016-10-19 18:38:13.514765366 +0000
+@@ -21,8 +21,6 @@
+ from distutils.extension import Extension
+ from sage.misc.package import is_package_installed, list_packages
+ 
+-all_packages = list_packages(local=True)
+-
+ 
+ class CythonizeExtension(Extension):
+     """
+@@ -76,14 +74,7 @@
+         condition = kwds.pop("condition")
+     except KeyError:
+         pkg = kwds.pop("package")
+-        try:
+-            pkginfo = all_packages[pkg]
+-        except KeyError:
+-            # Might be an installed old-style package
+-            condition = is_package_installed(pkg)
+-        else:
+-            condition = (pkginfo["installed_version"] == pkginfo["remote_version"])
+-
++        condition = True
+     if condition:
+         return Extension(*args, **kwds)
+     else:

Copied: sagemath/repos/community-staging-i686/skip-check.patch (from rev 206902, sagemath/trunk/skip-check.patch)
===================================================================
--- community-staging-i686/skip-check.patch	                        (rev 0)
+++ community-staging-i686/skip-check.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,22 @@
+--- src/bin/sage.orig	2014-12-18 09:47:27.354829070 +0100
++++ src/bin/sage	2014-12-18 09:48:00.041563401 +0100
+@@ -352,18 +352,6 @@
+ 
+ # Prepare for running Sage, either interactively or non-interactively.
+ sage_setup() {
+-    # Check that we're not in a source tarball which hasn't been built yet (#13561).
+-    if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
+-        echo >&2 '************************************************************************'
+-        echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
+-        echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
+-        echo >&2 'finished). You should run `make` in the Sage root directory first.'
+-        echo >&2 'If you did not intend to build Sage from source, you should download'
+-        echo >&2 'a binary tarball instead. Read README.txt for more information.'
+-        echo >&2 '************************************************************************'
+-        exit 1
+-    fi
+-
+     # Display the startup banner (unless SAGE_BANNER is explictly "no")
+     if [ "$SAGE_BANNER" != "no" ]; then
+         # can be 'bare', or 'yes', or unspecified
+

Copied: sagemath/repos/community-staging-i686/test-optional.patch (from rev 206902, sagemath/trunk/test-optional.patch)
===================================================================
--- community-staging-i686/test-optional.patch	                        (rev 0)
+++ community-staging-i686/test-optional.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,25 @@
+--- src/sage/doctest/control.py.orig       2016-10-20 19:39:53.714618246 +0200
++++ src/sage/doctest/control.py    2016-10-20 19:40:15.158049920 +0200
+@@ -307,22 +307,6 @@
+             if "all" in options.optional:
+                 # Special case to run all optional tests
+                 options.optional = True
+-            else:
+-                # We replace the 'optional' tag by all optional
+-                # packages for which the installed version matches the
+-                # latest available version (this implies in particular
+-                # that the package is actually installed).
+-                if 'optional' in options.optional:
+-                    options.optional.discard('optional')
+-                    from sage.misc.package import list_packages
+-                    for pkg in list_packages('optional', local=True).values():
+-                        if pkg['installed_version'] == pkg['remote_version']:
+-                            options.optional.add(pkg['name'])
+-
+-                # Check that all tags are valid
+-                for o in options.optional:
+-                    if not optionaltag_regex.search(o):
+-                        raise ValueError('invalid optional tag {!r}'.format(o))
+ 
+         self.options = options
+         self.files = args

Copied: sagemath/repos/community-staging-x86_64/PKGBUILD (from rev 206902, sagemath/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,148 @@
+# $Id$
+# Maintainer: Evgeniy Alekseev <arcanis.arch at gmail dot com>
+# Maintainer: Antonio Rojas <arojas at archlinux.org>
+# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
+# Contributor: Thomas Dziedzic <gostrc at gmail dot com>
+# Contributor: Osman Ugus <ugus11 at yahoo dot com>
+# Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
+# Special thanks to Nareto for moving the compile from the .install to the PKGBUILD
+
+pkgbase=sagemath
+pkgname=(sagemath sagemath-jupyter)
+pkgver=7.5
+pkgrel=1
+pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
+arch=(i686 x86_64)
+url="http://www.sagemath.org"
+license=(GPL)
+depends=(ipython2 ppl palp brial cliquer maxima-ecl gfan sympow tachyon nauty python2-rpy2 python2-fpylll python2-psutil
+  python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow python2-future libgap flintqs lcalc lrcalc arb
+  eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox 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' 'python2-pkgconfig: to compile cython code'
+  'jmol: 3D plots' 'sage-notebook: Browser-based (flask) notebook interface'
+  'sagemath-doc: Documentation and inline help' 'python2-igraph: igraph backend for graph theory'
+  'coin-or-cbc: COIN backend for numerical computations' 'coin-or-csdp: for computing Lovász theta-function of graphs'
+  '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' 'cryptominisat2: SAT solver' 'gap-data: for computing Galois groups'
+  'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes'
+  'libhomfly: for computing the homfly polynomial of links' 'libbraiding: for computing in braid groups'
+  'python2-pynormaliz: Normaliz backend for polyhedral computations')
+makedepends=(cython2 boost ratpoints symmetrica fflas-ffpack python2-jinja coin-or-cbc libhomfly libbraiding
+  mcqd coxeter3 cryptominisat2 modular_decomposition bliss-graphs tdlib python2-pkgconfig meataxe) # libfes
+source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
+        env.patch skip-check.patch cython-sys-path.patch is-package-installed.patch package.patch disable-fes.patch
+        jupyter-path.patch test-optional.patch ecm-7.patch increase-rtol.patch)
+md5sums=('bff1fb8793ebc2934d14cf1efdcfbea3'
+         '784ba3fca83f24ed0bbf62e01fa4e967'
+         '6cafcb381437d4751fd55b25d5090987'
+         '0de8f29a99a48e2ca2a13045f122c386'
+         '409b0a2c520eb33281b5f262afcb6c76'
+         'ccfd5b1bc4796f414f1531be52504dd7'
+         '06a67e611d10aa2381efe1f08ea4ffd9'
+         '0d88207416dfb98a17bf8886257d9a02'
+         '921017fd2d9dadbb6b602ac0476bfd58'
+         '0c9a57d35de80c2cd418ebec912efbbb'
+         '39d3fded716d2a7ae0ab03e0896b7497')
+
+prepare(){
+  cd sage-$pkgver
+
+# Arch-specific patches
+# assume all optional packages are installed
+  patch -p0 -i ../package.patch
+# set env variables
+  patch -p0 -i ../env.patch
+# skip checking build status
+  patch -p0 -i ../skip-check.patch
+# don't list optional packages when running tests
+  patch -p0 -i ../test-optional.patch
+# set jupyter path
+  patch -p0 -i ../jupyter-path.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
+# increase numerical tolerance, needed by scipy 0.18
+  patch -p1 -i ../increase-rtol.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
+# 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/*
+  sed -e 's|cython {OPT}|cython2 {OPT}|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py
+  sed -e 's|exec ipython|exec ipython2|' -e 's|cygdb|cygdb2|g' -i src/bin/sage
+  sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
+  sed -e 's|bin/python|bin/python2|g' -i src/bin/sage-env
+}
+
+
+build() {
+  cd sage-$pkgver/src
+
+  export SAGE_LOCAL="/usr"
+  export SAGE_ROOT="$PWD"
+  export SAGE_SRC="$PWD"
+  export CC=gcc
+
+  python2 setup.py build
+}
+
+package_sagemath() {
+  optdepends+=('sagemath-jupyter: Jupyter kernel')
+  conflicts=(sage-mathematics)
+  replaces=(sage-mathematics) 
+  provides=(sage-mathematics)
+
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="$PWD"
+  export SAGE_LOCAL="/usr"
+  export JUPYTER_PATH="$pkgdir"/usr/share/jupyter
+
+  python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
+
+  mkdir -p "$pkgdir"/usr/bin
+  cp bin/sage "$pkgdir"/usr/bin
+  for _i in arch-env banner cachegrind callgrind cleaner coverage coverageall cython env eval grep grepdoc inline-fortran ipython \
+    massif maxima.lisp native-execute notebook num-threads.py omega open preparse python rst2sws rst2txt run run-cython runtests startuptime.py \
+    sws2rst valgrind version.sh
+  do
+    cp bin/sage-$_i "$pkgdir"/usr/bin
+  done
+  cp bin/math-readline "$pkgdir"/usr/bin
+  
+  mkdir -p "$pkgdir"/usr/share/sage
+  cp -r ext "$pkgdir"/usr/share/sage
+  
+# Create SAGE_SRC, needed for the notebook and help
+  mkdir "$pkgdir"/usr/share/sage/source
+  ln -s /usr/share/doc/sage "$pkgdir"/usr/share/sage/source/doc
+
+# Remove sage_setup
+  rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup
+
+# Split jupyter kernel
+  rm -r "$pkgdir"/usr/share/jupyter
+}
+
+package_sagemath-jupyter() {
+  pkgdesc='Jupyter kernel for SageMath'
+  depends=(sagemath python2-jupyter_client python2-ipywidgets jupyter-notebook mathjax)
+  optdepends=('sage-notebook-exporter: convert flask notebooks to Jupyter')
+
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="$PWD"
+  export SAGE_LOCAL="/usr"
+  export JUPYTER_PATH="$pkgdir"/usr/share/jupyter
+
+  python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update()"
+}

Copied: sagemath/repos/community-staging-x86_64/cython-sys-path.patch (from rev 206902, sagemath/trunk/cython-sys-path.patch)
===================================================================
--- community-staging-x86_64/cython-sys-path.patch	                        (rev 0)
+++ community-staging-x86_64/cython-sys-path.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,10 @@
+--- sage-7.1/src/setup.py.orig	2016-04-08 16:59:24.691349473 +0000
++++ sage-7.1/src/setup.py	2016-04-08 17:03:03.847153796 +0000
+@@ -414,6 +414,7 @@
+             build_dir=SAGE_CYTHONIZED,
+             force=force,
+             aliases=aliases,
++            include_path=sys.path,
+             compiler_directives={
+                 'autotestdict': False,
+                 'cdivision': True,

Copied: sagemath/repos/community-staging-x86_64/disable-fes.patch (from rev 206902, sagemath/trunk/disable-fes.patch)
===================================================================
--- community-staging-x86_64/disable-fes.patch	                        (rev 0)
+++ community-staging-x86_64/disable-fes.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,19 @@
+--- src/module_list.py.orig	2015-06-07 11:29:30.710612146 +0200
++++ src/module_list.py	2015-06-07 11:30:21.877506106 +0200
+@@ -564,11 +564,11 @@
+               sources = ["sage/libs/ecl.pyx"],
+               libraries = ["ecl"]),
+ 
+-    OptionalExtension("sage.libs.fes",
+-             ["sage/libs/fes.pyx"],
+-             language = "c",
+-             libraries = ['fes'],
+-             package = 'fes'),
++#    OptionalExtension("sage.libs.fes",
++#             ["sage/libs/fes.pyx"],
++#             language = "c",
++#             libraries = ['fes'],
++#             package = 'fes'),
+ 
+     Extension('sage.libs.flint.flint',
+               sources = ["sage/libs/flint/flint.pyx"],

Copied: sagemath/repos/community-staging-x86_64/ecm-7.patch (from rev 206902, sagemath/trunk/ecm-7.patch)
===================================================================
--- community-staging-x86_64/ecm-7.patch	                        (rev 0)
+++ community-staging-x86_64/ecm-7.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -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
+ """
+

Copied: sagemath/repos/community-staging-x86_64/env.patch (from rev 206902, sagemath/trunk/env.patch)
===================================================================
--- community-staging-x86_64/env.patch	                        (rev 0)
+++ community-staging-x86_64/env.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,93 @@
+--- src/bin/sage-env.orig	2015-01-06 10:46:04.469687605 +0100
++++ src/bin/sage-env	2015-01-06 10:49:59.547762019 +0100
+@@ -110,41 +110,7 @@
+ }
+ 
+ 
+-# New value for SAGE_ROOT: either SAGE_ROOT (if given)
+-# or a guessed value based on pwd.
+-if [ -n "$SAGE_ROOT" ]; then
+-    NEW_SAGE_ROOT="$SAGE_ROOT"
+-elif [ -f sage -a -d build ]; then
+-    NEW_SAGE_ROOT="."
+-elif [ -f ../../sage -a -d ../../build ]; then
+-    NEW_SAGE_ROOT="../.."
+-else
+-    # No idea what SAGE_ROOT should be...
+-    echo >&2 "Error: You must set the SAGE_ROOT environment variable or run this"
+-    echo >&2 "script from the SAGE_ROOT or SAGE_ROOT/local/bin/ directory."
+-    return 1
+-fi
+-
+-# Make NEW_SAGE_ROOT absolute
+-NEW_SAGE_ROOT=`cd "$NEW_SAGE_ROOT" && pwd -P`
+-
+-# Sanity check NEW_SAGE_ROOT
+-if [ -f "$NEW_SAGE_ROOT/sage" -a -d "$NEW_SAGE_ROOT/build" ]; then
+-    :
+-else
+-    echo >&2 "Error: SAGE_ROOT is set to a bad value:"
+-    echo >&2 "SAGE_ROOT=$SAGE_ROOT"
+-    echo >&2 "You must correct it or erase it and run this script from the SAGE_ROOT"
+-    echo >&2 "or SAGE_ROOT/local/bin/ directory."
+-    return 1
+-fi
+-
+-# 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:"
+-    echo >&2 "Old SAGE_ROOT=$SAGE_ROOT"
+-    echo >&2 "New SAGE_ROOT=$NEW_SAGE_ROOT"
+-fi
++NEW_SAGE_ROOT="/usr"
+ 
+ # Display the Sage startup banner, used in src/bin/sage
+ sage_banner() {
+@@ -187,7 +187,7 @@
+ 
+ # SAGE_LOCAL is the installation prefix and can be customized
+ if [ -z "$SAGE_LOCAL" ]; then
+-    export SAGE_LOCAL="$SAGE_ROOT/local"
++    export SAGE_LOCAL="/usr"
+ fi
+ 
+ # sage-env must know where the Sage's script files are
+@@ -233,8 +233,8 @@
+ export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
+ export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
+ export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
+-export SAGE_SRC="$SAGE_ROOT/src"
+-export SAGE_DOC_SRC="$SAGE_SRC/doc"
++export SAGE_SRC="$SAGE_SHARE/sage/source"
++export SAGE_DOC_SRC="$SAGE_SHARE/doc/sage"
+ export SAGE_DOC="$SAGE_SHARE/doc/sage"
+ 
+ if [ -z "${SAGE_ORIG_PATH_SET}" ]; then
+@@ -374,6 +337,9 @@
+     export SAGE_STARTUP_FILE
+ fi
+ 
++export LIBMTX="$DOT_SAGE/meataxe"
++[[ -d $LIBMTX ]] || mkdir $LIBMTX # Create meataxe data dir
++
+ if [ -z "$IPYTHONDIR" ]; then
+     # We hardcode a version number in the directory name. The idea is
+     # that we keep using the same version number as long as that is
+@@ -468,7 +400,6 @@
+         fi
+     fi
+ fi
+-export MAXIMA_PREFIX="$SAGE_LOCAL"
+ 
+ PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
+ 
+@@ -629,9 +608,6 @@
+     LD_LIBRARY_PATH="$SAGE_LOCAL/bin:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
+ fi
+ 
+-# See trac 7186 -- this is needed if ecl is moved
+-ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
+-
+ # Handle parallel building/testing/...
+ # See Trac Ticket #12016
+ # First, figure out the right values for SAGE_NUM_THREADS (default

Copied: sagemath/repos/community-staging-x86_64/increase-rtol.patch (from rev 206902, sagemath/trunk/increase-rtol.patch)
===================================================================
--- community-staging-x86_64/increase-rtol.patch	                        (rev 0)
+++ community-staging-x86_64/increase-rtol.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,37 @@
+diff -ru sage-7.3.orig/src/sage/coding/code_bounds.py sage-7.3/src/sage/coding/code_bounds.py
+--- sage-7.3.orig/src/sage/coding/code_bounds.py        2016-08-05 20:26:10.033204091 +0200
++++ sage-7.3/src/sage/coding/code_bounds.py     2016-08-05 20:32:27.276579565 +0200
+@@ -554,7 +554,7 @@
+     if q < 2:   # Here we check that q is actually at least 2
+         raise ValueError("The value q must be an integer greater than 1")
+ 
+-    eps  = 4.5e-16 # find_root has about this as the default xtol
++    eps  = 4.5e-15 # find_root has about this as the default xtol
+     ymax = 1 - 1/q
+     if x <= eps:
+         return 0
+diff -ru sage-7.3.orig/src/sage/numerical/optimize.py sage-7.3/src/sage/numerical/optimize.py
+--- sage-7.3.orig/src/sage/numerical/optimize.py        2016-08-05 20:26:10.816536625 +0200
++++ sage-7.3/src/sage/numerical/optimize.py     2016-08-05 20:32:21.449907130 +0200
+@@ -15,7 +15,7 @@
+ from sage.rings.real_double import RDF
+ 
+ 
+-def find_root(f, a, b, xtol=10e-13, rtol=4.5e-16, maxiter=100, full_output=False):
++def find_root(f, a, b, xtol=10e-13, rtol=4.5e-15, maxiter=100, full_output=False):
+     """
+     Numerically find a root of ``f`` on the closed interval `[a,b]`
+     (or `[b,a]`) if possible, where ``f`` is a function in the one variable.
+diff -ru sage-7.3.orig/src/sage/symbolic/expression.pyx sage-7.3/src/sage/symbolic/expression.pyx
+--- sage-7.3.orig/src/sage/symbolic/expression.pyx      2016-08-05 20:26:11.333202767 +0200
++++ sage-7.3/src/sage/symbolic/expression.pyx   2016-08-05 20:32:14.236566826 +0200
+@@ -10884,7 +10884,7 @@
+             ret = ret[0]
+         return ret
+ 
+-    def find_root(self, a, b, var=None, xtol=10e-13, rtol=4.5e-16, maxiter=100, full_output=False):
++    def find_root(self, a, b, var=None, xtol=10e-13, rtol=4.5e-15, maxiter=100, full_output=False):
+         """
+         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.
+

Copied: sagemath/repos/community-staging-x86_64/is-package-installed.patch (from rev 206902, sagemath/trunk/is-package-installed.patch)
===================================================================
--- community-staging-x86_64/is-package-installed.patch	                        (rev 0)
+++ community-staging-x86_64/is-package-installed.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,328 @@
+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
+@@ -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
+ 
+@@ -824,7 +823,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:
+@@ -1673,7 +1672,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
+@@ -614,8 +614,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
+@@ -1317,13 +1318,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
+@@ -21,7 +21,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
+@@ -3691,7 +3690,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
+@@ -7858,7 +7858,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 " +
+@@ -7876,10 +7875,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)
+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
+@@ -1195,8 +1195,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
+@@ -1280,8 +1281,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
+@@ -1433,8 +1435,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
+@@ -1632,8 +1635,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
+@@ -1786,8 +1790,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
+@@ -1400,15 +1400,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, "lib", "gap", "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
+@@ -145,7 +145,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
+@@ -190,8 +189,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)):
+@@ -1682,9 +1679,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):
+         """
+@@ -1735,9 +1730,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):
+         """
+@@ -4113,8 +4106,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
+@@ -53,10 +53,6 @@ from fpickle import pickle_function, unpickle_function
+ 
+ from .dist import install_scripts
+ 
+-from .package import (installed_packages, is_package_installed,
+-        standard_packages, optional_packages, experimental_packages,
+-        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
+@@ -163,7 +163,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
+ 
+@@ -1433,10 +1432,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":

Copied: sagemath/repos/community-staging-x86_64/jupyter-path.patch (from rev 206902, sagemath/trunk/jupyter-path.patch)
===================================================================
--- community-staging-x86_64/jupyter-path.patch	                        (rev 0)
+++ community-staging-x86_64/jupyter-path.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,22 @@
+--- src/sage/repl/ipython_kernel/install.py.orig	2015-10-23 19:23:39.728456590 +0000
++++ src/sage/repl/ipython_kernel/install.py	2015-10-23 19:24:00.965018978 +0000
+@@ -13,8 +13,7 @@
+     SAGE_ROOT, SAGE_DOC, SAGE_LOCAL, SAGE_EXTCODE,
+     SAGE_VERSION
+ )
+-from jupyter_core.paths import ENV_JUPYTER_PATH
+-JUPYTER_PATH = ENV_JUPYTER_PATH[0]
++JUPYTER_PATH = os.environ.get('JUPYTER_PATH') 
+ 
+ class SageKernelSpec(object):
+
+@@ -208,7 +208,7 @@
+             sage: spec._symlink_resources()    # not tested
+         """
+         path = os.path.join(SAGE_EXTCODE, 'notebook-ipython')
+-        for filename in os.listdir(path):
++        for filename in os.listdir('ext/notebook-ipython'):
+             self.symlink(
+                 os.path.join(path, filename),
+                 os.path.join(self.kernel_dir, filename)
+

Copied: sagemath/repos/community-staging-x86_64/package.patch (from rev 206902, sagemath/trunk/package.patch)
===================================================================
--- community-staging-x86_64/package.patch	                        (rev 0)
+++ community-staging-x86_64/package.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,38 @@
+--- src/sage/misc/package.py.orig	2014-11-23 15:58:13.000000000 +0100
++++ src/sage/misc/package.py	2015-01-22 20:32:25.651383902 +0100
+@@ -343,7 +343,7 @@
+         sage: for pkg in list_packages('pip', local=True):
+         ....:     assert not is_package_installed(pkg)
+     """
+-    return any(p.split('-')[0] == package for p in installed_packages(exclude_pip))
++    return True
+ 
+ def package_versions(package_type, local=False):
+     r"""
+--- src/sage_setup/optional_extension.py.orig  2016-10-19 18:35:10.092577510 +0000
++++ src/sage_setup/optional_extension.py       2016-10-19 18:38:13.514765366 +0000
+@@ -21,8 +21,6 @@
+ from distutils.extension import Extension
+ from sage.misc.package import is_package_installed, list_packages
+ 
+-all_packages = list_packages(local=True)
+-
+ 
+ class CythonizeExtension(Extension):
+     """
+@@ -76,14 +74,7 @@
+         condition = kwds.pop("condition")
+     except KeyError:
+         pkg = kwds.pop("package")
+-        try:
+-            pkginfo = all_packages[pkg]
+-        except KeyError:
+-            # Might be an installed old-style package
+-            condition = is_package_installed(pkg)
+-        else:
+-            condition = (pkginfo["installed_version"] == pkginfo["remote_version"])
+-
++        condition = True
+     if condition:
+         return Extension(*args, **kwds)
+     else:

Copied: sagemath/repos/community-staging-x86_64/skip-check.patch (from rev 206902, sagemath/trunk/skip-check.patch)
===================================================================
--- community-staging-x86_64/skip-check.patch	                        (rev 0)
+++ community-staging-x86_64/skip-check.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,22 @@
+--- src/bin/sage.orig	2014-12-18 09:47:27.354829070 +0100
++++ src/bin/sage	2014-12-18 09:48:00.041563401 +0100
+@@ -352,18 +352,6 @@
+ 
+ # Prepare for running Sage, either interactively or non-interactively.
+ sage_setup() {
+-    # Check that we're not in a source tarball which hasn't been built yet (#13561).
+-    if [ ! -d "$SAGE_LOCAL/lib/python/site-packages/sage" ]; then
+-        echo >&2 '************************************************************************'
+-        echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
+-        echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
+-        echo >&2 'finished). You should run `make` in the Sage root directory first.'
+-        echo >&2 'If you did not intend to build Sage from source, you should download'
+-        echo >&2 'a binary tarball instead. Read README.txt for more information.'
+-        echo >&2 '************************************************************************'
+-        exit 1
+-    fi
+-
+     # Display the startup banner (unless SAGE_BANNER is explictly "no")
+     if [ "$SAGE_BANNER" != "no" ]; then
+         # can be 'bare', or 'yes', or unspecified
+

Copied: sagemath/repos/community-staging-x86_64/test-optional.patch (from rev 206902, sagemath/trunk/test-optional.patch)
===================================================================
--- community-staging-x86_64/test-optional.patch	                        (rev 0)
+++ community-staging-x86_64/test-optional.patch	2017-01-12 06:54:01 UTC (rev 206903)
@@ -0,0 +1,25 @@
+--- src/sage/doctest/control.py.orig       2016-10-20 19:39:53.714618246 +0200
++++ src/sage/doctest/control.py    2016-10-20 19:40:15.158049920 +0200
+@@ -307,22 +307,6 @@
+             if "all" in options.optional:
+                 # Special case to run all optional tests
+                 options.optional = True
+-            else:
+-                # We replace the 'optional' tag by all optional
+-                # packages for which the installed version matches the
+-                # latest available version (this implies in particular
+-                # that the package is actually installed).
+-                if 'optional' in options.optional:
+-                    options.optional.discard('optional')
+-                    from sage.misc.package import list_packages
+-                    for pkg in list_packages('optional', local=True).values():
+-                        if pkg['installed_version'] == pkg['remote_version']:
+-                            options.optional.add(pkg['name'])
+-
+-                # Check that all tags are valid
+-                for o in options.optional:
+-                    if not optionaltag_regex.search(o):
+-                        raise ValueError('invalid optional tag {!r}'.format(o))
+ 
+         self.options = options
+         self.files = args



More information about the arch-commits mailing list