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

Antonio Rojas arojas at archlinux.org
Sun Sep 4 13:25:54 UTC 2016


    Date: Sunday, September 4, 2016 @ 13:25:54
  Author: arojas
Revision: 188530

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 188529, sagemath/trunk/PKGBUILD)
  sagemath/repos/community-staging-i686/anal.h
    (from rev 188529, sagemath/trunk/anal.h)
  sagemath/repos/community-staging-i686/clean.patch
    (from rev 188529, sagemath/trunk/clean.patch)
  sagemath/repos/community-staging-i686/cython-sys-path.patch
    (from rev 188529, sagemath/trunk/cython-sys-path.patch)
  sagemath/repos/community-staging-i686/disable-fes.patch
    (from rev 188529, sagemath/trunk/disable-fes.patch)
  sagemath/repos/community-staging-i686/ecm-7.patch
    (from rev 188529, sagemath/trunk/ecm-7.patch)
  sagemath/repos/community-staging-i686/env.patch
    (from rev 188529, sagemath/trunk/env.patch)
  sagemath/repos/community-staging-i686/increase-rtol.patch
    (from rev 188529, sagemath/trunk/increase-rtol.patch)
  sagemath/repos/community-staging-i686/is-package-installed.patch
    (from rev 188529, sagemath/trunk/is-package-installed.patch)
  sagemath/repos/community-staging-i686/jupyter-path.patch
    (from rev 188529, sagemath/trunk/jupyter-path.patch)
  sagemath/repos/community-staging-i686/linbox-1.4.patch
    (from rev 188529, sagemath/trunk/linbox-1.4.patch)
  sagemath/repos/community-staging-i686/package.patch
    (from rev 188529, sagemath/trunk/package.patch)
  sagemath/repos/community-staging-i686/paths.patch
    (from rev 188529, sagemath/trunk/paths.patch)
  sagemath/repos/community-staging-i686/python-2.7.11.patch
    (from rev 188529, sagemath/trunk/python-2.7.11.patch)
  sagemath/repos/community-staging-i686/sagemath-ipython5.patch
    (from rev 188529, sagemath/trunk/sagemath-ipython5.patch)
  sagemath/repos/community-staging-i686/skip-check.patch
    (from rev 188529, sagemath/trunk/skip-check.patch)
  sagemath/repos/community-staging-i686/test-optional.patch
    (from rev 188529, sagemath/trunk/test-optional.patch)
  sagemath/repos/community-staging-x86_64/
  sagemath/repos/community-staging-x86_64/PKGBUILD
    (from rev 188529, sagemath/trunk/PKGBUILD)
  sagemath/repos/community-staging-x86_64/anal.h
    (from rev 188529, sagemath/trunk/anal.h)
  sagemath/repos/community-staging-x86_64/clean.patch
    (from rev 188529, sagemath/trunk/clean.patch)
  sagemath/repos/community-staging-x86_64/cython-sys-path.patch
    (from rev 188529, sagemath/trunk/cython-sys-path.patch)
  sagemath/repos/community-staging-x86_64/disable-fes.patch
    (from rev 188529, sagemath/trunk/disable-fes.patch)
  sagemath/repos/community-staging-x86_64/ecm-7.patch
    (from rev 188529, sagemath/trunk/ecm-7.patch)
  sagemath/repos/community-staging-x86_64/env.patch
    (from rev 188529, sagemath/trunk/env.patch)
  sagemath/repos/community-staging-x86_64/increase-rtol.patch
    (from rev 188529, sagemath/trunk/increase-rtol.patch)
  sagemath/repos/community-staging-x86_64/is-package-installed.patch
    (from rev 188529, sagemath/trunk/is-package-installed.patch)
  sagemath/repos/community-staging-x86_64/jupyter-path.patch
    (from rev 188529, sagemath/trunk/jupyter-path.patch)
  sagemath/repos/community-staging-x86_64/linbox-1.4.patch
    (from rev 188529, sagemath/trunk/linbox-1.4.patch)
  sagemath/repos/community-staging-x86_64/package.patch
    (from rev 188529, sagemath/trunk/package.patch)
  sagemath/repos/community-staging-x86_64/paths.patch
    (from rev 188529, sagemath/trunk/paths.patch)
  sagemath/repos/community-staging-x86_64/python-2.7.11.patch
    (from rev 188529, sagemath/trunk/python-2.7.11.patch)
  sagemath/repos/community-staging-x86_64/sagemath-ipython5.patch
    (from rev 188529, sagemath/trunk/sagemath-ipython5.patch)
  sagemath/repos/community-staging-x86_64/skip-check.patch
    (from rev 188529, sagemath/trunk/skip-check.patch)
  sagemath/repos/community-staging-x86_64/test-optional.patch
    (from rev 188529, sagemath/trunk/test-optional.patch)

-----------------------------------------------------+
 community-staging-i686/PKGBUILD                     |  161 +++++
 community-staging-i686/anal.h                       |   65 ++
 community-staging-i686/clean.patch                  |   24 
 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                    |  118 +++
 community-staging-i686/increase-rtol.patch          |   37 +
 community-staging-i686/is-package-installed.patch   |  387 ++++++++++++
 community-staging-i686/jupyter-path.patch           |   31 +
 community-staging-i686/linbox-1.4.patch             |  470 +++++++++++++++
 community-staging-i686/package.patch                |   11 
 community-staging-i686/paths.patch                  |   13 
 community-staging-i686/python-2.7.11.patch          |   11 
 community-staging-i686/sagemath-ipython5.patch      |  548 ++++++++++++++++++
 community-staging-i686/skip-check.patch             |   22 
 community-staging-i686/test-optional.patch          |   11 
 community-staging-x86_64/PKGBUILD                   |  161 +++++
 community-staging-x86_64/anal.h                     |   65 ++
 community-staging-x86_64/clean.patch                |   24 
 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                  |  118 +++
 community-staging-x86_64/increase-rtol.patch        |   37 +
 community-staging-x86_64/is-package-installed.patch |  387 ++++++++++++
 community-staging-x86_64/jupyter-path.patch         |   31 +
 community-staging-x86_64/linbox-1.4.patch           |  470 +++++++++++++++
 community-staging-x86_64/package.patch              |   11 
 community-staging-x86_64/paths.patch                |   13 
 community-staging-x86_64/python-2.7.11.patch        |   11 
 community-staging-x86_64/sagemath-ipython5.patch    |  548 ++++++++++++++++++
 community-staging-x86_64/skip-check.patch           |   22 
 community-staging-x86_64/test-optional.patch        |   11 
 34 files changed, 4034 insertions(+)

Copied: sagemath/repos/community-staging-i686/PKGBUILD (from rev 188529, sagemath/trunk/PKGBUILD)
===================================================================
--- community-staging-i686/PKGBUILD	                        (rev 0)
+++ community-staging-i686/PKGBUILD	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,161 @@
+# $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
+
+pkgname=sagemath
+pkgver=7.3
+pkgrel=4
+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 cysignals ppl palp brial singular cliquer maxima-ecl gfan sympow tachyon python2-rpy2 nauty
+  python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow 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' 'ipython2-notebook: Jupyter notebook interface' 'mathjax: Jupyter notebook interface'
+  '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' 'cryptominisat: 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-igraph: igraph backend for graph theory' 'sage-notebook-exporter: convert flask notebooks to jupyter'
+  'jupyter-notebook: Jupyter notebook interface')
+makedepends=(cython2 boost ratpoints symmetrica fflas-ffpack python2-jinja coin-or-cbc libhomfly libbraiding
+  mcqd coxeter3 cryptominisat modular_decomposition bliss-graphs tdlib python2-pkgconfig meataxe) # libfes
+conflicts=(sage-mathematics)
+replaces=(sage-mathematics)
+provides=(sage-mathematics)
+source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
+        anal.h env.patch paths.patch clean.patch skip-check.patch cython-sys-path.patch is-package-installed.patch package.patch
+        disable-fes.patch jupyter-path.patch test-optional.patch python-2.7.11.patch linbox-1.4.patch ecm-7.patch
+        sagemath-ipython5.patch increase-rtol.patch)
+md5sums=('cb2aed3d24de7b2228a9b34e81a27870'
+         'a906a180d198186a39820b0a2f9a9c63'
+         'd4d3c235c99b2bc92dde9f6e53935a8d'
+         '45b84ae5579273196df44f7464a01a30'
+         '6d9ae0978ce6a05a0da2cafdfb178a09'
+         '6cafcb381437d4751fd55b25d5090987'
+         'a1bcdd3fe620dbae60ed8b0e98b2ece7'
+         'b3ecf7c93a90e0afccbc686af9fdc85f'
+         '9ba81f717ffd4e20b8b2f2a318307488'
+         '06a67e611d10aa2381efe1f08ea4ffd9'
+         '16b529194c6105c3364127bd8f1efa83'
+         'cdcabd475b80afe0534a5621e972736e'
+         'ef927896f2071b442b1d07d7e69f5f3a'
+         'a276f0fbbff6eade409d0569ebd728d4'
+         '0c9a57d35de80c2cd418ebec912efbbb'
+         '2bcaca7284dda963ebdc17daf78cf6c9'
+         '39d3fded716d2a7ae0ab03e0896b7497')
+
+prepare(){
+  cd sage-$pkgver
+
+# Arch-specific patches
+# assume all optional packages are installed
+  patch -p0 -i ../package.patch
+# find L.h header
+  sed -e 's|libLfunction|Lfunction|' -i src/sage/libs/lcalc/lcalc_sage.h
+# don't try to link against libpng 1.2
+  sed -e 's|png12|png|' -i src/module_list.py
+# set env variables
+  patch -p0 -i ../env.patch
+# fix paths in python imports
+  patch -p0 -i ../paths.patch
+# don't try to remove installed files
+  patch -p0 -i ../clean.patch
+# skip checking build status
+  patch -p0 -i ../skip-check.patch
+# supress warning about GAP install dir
+  sed -e "s|gapdir = os.path.join(SAGE_LOCAL, 'gap', 'latest')|gapdir = '/usr/lib/gap'|" -i src/sage/libs/gap/util.pyx 
+# find bliss headers
+  sed -e 's|graph.hh|bliss/graph.hh|' -i src/sage/graphs/bliss.pyx
+# don't list optional packages when running tests
+  patch -p0 -i ../test-optional.patch
+# set jupyter path
+  patch -p0 -i ../jupyter-path.patch
+# fix timeit with Python 2.7.11
+  patch -p0 -i ../python-2.7.11.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
+# port to new givaro/fflas-ffpack/linbox http://trac.sagemath.org/ticket/17635
+  patch -p1 -i ../linbox-1.4.patch
+# port to ipython 5.0 https://trac.sagemath.org/ticket/21006
+  patch -p1 -i ../sagemath-ipython5.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|' -i src/bin/sage
+  sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
+  sed -e 's|python -c|python2 -c|' -i src/Makefile
+
+# copy required private PARI header
+  mkdir -p src/pari
+  cp "$srcdir"/anal.h src/pari/anal.h
+}
+
+
+build() {
+  cd sage-$pkgver/src
+
+  export SAGE_LOCAL="/usr"
+  export SAGE_SRC="$PWD"
+  export CC=gcc
+
+  make sage/libs/pari/auto_gen.pxi
+  make sage/ext/interpreters/__init__.py
+
+  python2 setup.py build
+}
+
+package() {
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="/usr"
+  export SAGE_LOCAL="$SAGE_ROOT"
+  export SAGE_SRC="$PWD"
+  export CC=gcc
+  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
+  mkdir "$pkgdir"/usr/share/sage/source
+
+# Remove sage_setup
+  rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup
+}

Copied: sagemath/repos/community-staging-i686/anal.h (from rev 188529, sagemath/trunk/anal.h)
===================================================================
--- community-staging-i686/anal.h	                        (rev 0)
+++ community-staging-i686/anal.h	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,65 @@
+/* Copyright (C) 2000  The PARI group.
+
+This file is part of the PARI/GP package.
+
+PARI/GP is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation. It is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY WHATSOEVER.
+
+Check the License for details. You should have received a copy of it, along
+with the package; see the file 'COPYING'. If not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+/*************************************************************************/
+/*                                                                       */
+/*                 Declarations specific to the analyzer                 */
+/*                                                                       */
+/*************************************************************************/
+BEGINEXTERN
+/* GP control structures */
+#define EXPR_WRAP(code, call) \
+{ GEN z; GEN __E = code; \
+  push_lex(gen_0, __E); z = call; pop_lex(1); return z; }
+#define EXPR_ARG __E, &gp_eval
+#define EXPR_ARGUPTO __E, &gp_evalupto
+#define EXPR_ARGBOOL __E, &gp_evalbool
+
+/* functions */
+void   changevalue(entree *ep, GEN val);
+void    freeep(entree *ep);
+void   pari_fill_hashtable(entree **table, entree *ep);
+
+void compile_err(const char *msg, const char *str);
+void compile_varerr(const char *str);
+
+#ifdef STACK_CHECK
+extern THREAD void *PARI_stack_limit;
+#endif
+
+extern entree  **varentries;
+
+struct node_loc
+{
+  const char *start,*end;
+};
+
+union token_value { long val; };
+
+int pari_lex(union token_value *yylval, struct node_loc *yylloc, char **lex);
+int pari_parse(char **lex);
+entree* fetch_entry(const char *s, long len);
+entree* fetch_member(const char *s, long len);
+void pari_close_parser(void);
+void pari_close_compiler(void);
+void pari_close_evaluator(void);
+void pari_init_parser(void);
+void pari_init_compiler(void);
+void pari_init_evaluator(void);
+void optimizenode(long n);
+void push_frame(GEN C, long lpc, long flag);
+const char * closure_func_err(void);
+GEN  gp_closure(long n);
+long eval_mnemonic(GEN str, const char *tmplate);
+
+ENDEXTERN

Copied: sagemath/repos/community-staging-i686/clean.patch (from rev 188529, sagemath/trunk/clean.patch)
===================================================================
--- community-staging-i686/clean.patch	                        (rev 0)
+++ community-staging-i686/clean.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,24 @@
+--- src/setup.py.orig	2014-11-16 10:34:05.521441703 +0100
++++ src/setup.py	2014-11-16 10:34:16.054812569 +0100
+@@ -620,21 +620,6 @@
+ 
+ 
+ #########################################################
+-### Clean
+-#########################################################
+-
+-print('Cleaning up stale installed files....')
+-t = time.time()
+-from sage_setup.clean import clean_install_dir
+-output_dirs = SITE_PACKAGES + glob.glob(os.path.join(SAGE_SRC, 'build', 'lib*'))
+-for output_dir in output_dirs:
+-    print('- cleaning {0}'.format(output_dir))
+-    clean_install_dir(output_dir, python_packages, python_modules,
+-            ext_modules, python_data_files)
+-print('Finished cleaning, time: %.2f seconds.' % (time.time() - t))
+-
+-
+-#########################################################
+ ### Install also Jupyter kernel spec
+ #########################################################
+ 

Copied: sagemath/repos/community-staging-i686/cython-sys-path.patch (from rev 188529, sagemath/trunk/cython-sys-path.patch)
===================================================================
--- community-staging-i686/cython-sys-path.patch	                        (rev 0)
+++ community-staging-i686/cython-sys-path.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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
+@@ -591,6 +591,7 @@
+         build_dir=SAGE_CYTHONIZED,
+         force=force,
+         aliases=aliases,
++        include_path=sys.path,
+         compiler_directives={
+             'embedsignature': True,
+             'profile': profile,

Copied: sagemath/repos/community-staging-i686/disable-fes.patch (from rev 188529, sagemath/trunk/disable-fes.patch)
===================================================================
--- community-staging-i686/disable-fes.patch	                        (rev 0)
+++ community-staging-i686/disable-fes.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/ecm-7.patch)
===================================================================
--- community-staging-i686/ecm-7.patch	                        (rev 0)
+++ community-staging-i686/ecm-7.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/env.patch)
===================================================================
--- community-staging-i686/env.patch	                        (rev 0)
+++ community-staging-i686/env.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,118 @@
+--- 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"
+ 
+ # Don't execute the commands more than once for the same version of
+ # sage-env.  Check this after checking the validity of SAGE_ROOT, but
+@@ -245,21 +211,13 @@
+ fi
+ 
+ # Setting Sage-related location environment variables.
+-export SAGE_LOCAL="$SAGE_ROOT/local"
+-export SAGE_ETC="$SAGE_LOCAL/etc"
+-export SAGE_SHARE="$SAGE_LOCAL/share"
+-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_DOC="$SAGE_SHARE/doc/sage"
+-
+-if [ -z "${SAGE_ORIG_PATH_SET}" ]; then 
+-    SAGE_ORIG_PATH=$PATH && export SAGE_ORIG_PATH 
+-    SAGE_ORIG_PATH_SET=True && export SAGE_ORIG_PATH_SET 
+-fi 
+-export PATH="$SAGE_ROOT/build/bin:$SAGE_SRC/bin:$SAGE_LOCAL/bin:$PATH"
++export SAGE_LOCAL="$SAGE_ROOT"
++export SAGE_ETC="/etc/sage"
++export SAGE_SHARE="$SAGE_LOCAL/share/sage"
++export SAGE_EXTCODE="$SAGE_SHARE/ext"
++export SAGE_SRC="$SAGE_SHARE/source"
++export SAGE_DOC_SRC="/usr/share/doc/sage"
++export SAGE_DOC="/usr/share/doc/sage"
+ 
+ if [ "$SAGE_BANNER" = "bare" ]; then
+     export SAGE_BANNER_TEXT=$(cat "$SAGE_ROOT/VERSION.txt")
+@@ -319,9 +277,6 @@
+ GPHELP="$SAGE_LOCAL/bin/gphelp" && export GPHELP
+ GPDOCDIR="$SAGE_LOCAL/share/pari/doc" && export GPDOCDIR
+ 
+-SINGULARPATH="$SAGE_LOCAL/share/singular" && export SINGULARPATH
+-SINGULAR_EXECUTABLE="$SAGE_LOCAL/bin/Singular" && export SINGULAR_EXECUTABLE
+-
+ if [ -z "$SAGE_REPO_ANONYMOUS" ]; then
+     SAGE_REPO_ANONYMOUS="git://trac.sagemath.org/sage.git"
+     export SAGE_REPO_ANONYMOUS
+@@ -364,10 +319,10 @@
+     export SAGE_STARTUP_FILE
+ fi
+ 
++export LIBMTX="$DOT_SAGE/meataxe"
++[[ -d $LIBMTX ]] || mkdir $LIBMTX # Create meataxe data dir
++
+-IPYTHONDIR=`find "$SAGE_SPKG_INST" -name "ipython*"`
+-if [ -n "$IPYTHONDIR" ]; then
+-    export IPYTHONDIR="$DOT_SAGE/${IPYTHONDIR##*/}"
+-fi
++export IPYTHONDIR="$DOT_SAGE/ipython"
+ 
+ if [ "$PYTHON_EGG_CACHE" = "" ]; then
+     PYTHON_EGG_CACHE="$DOT_SAGE/.python-eggs"
+@@ -453,8 +400,6 @@
+         fi
+     fi
+ fi
+-MAXIMA_PREFIX="$SAGE_ROOT/local" && export MAXIMA_PREFIX
+-
+ PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
+ 
+ ############ architecture flags
+@@ -622,9 +567,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 188529, sagemath/trunk/increase-rtol.patch)
===================================================================
--- community-staging-i686/increase-rtol.patch	                        (rev 0)
+++ community-staging-i686/increase-rtol.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/is-package-installed.patch)
===================================================================
--- community-staging-i686/is-package-installed.patch	                        (rev 0)
+++ community-staging-i686/is-package-installed.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,387 @@
+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
+ 
+@@ -828,7 +827,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:
+@@ -1677,7 +1676,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
+@@ -7856,7 +7856,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 " +
+@@ -7874,10 +7873,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)
+@@ -20251,17 +20252,22 @@ class GenericGraph(GenericGraph_pyx):
+             Subgroup of (Permutation Group with generators [(0,7)(1,4)(2,3)(6,8)]) generated by [(0,7)(1,4)(2,3)(6,8)]]
+ 
+         """
+-        from sage.misc.package import is_package_installed
++        has_bliss=True
++        try:
++            from sage.graphs.bliss import automorphism_group
++        except ImportError:
++            has_bliss=False
++
+         if (algorithm == 'bliss'           or   # explicit choice from the user; or
+             (algorithm is None             and  # by default
+              not edge_labels               and
+-             is_package_installed('bliss'))):
++             has_bliss)):
++
++            if (not has_bliss):
++                raise NotImplementedError("you need to install bliss or set algorithm=sage to use this command")
++
+             if edge_labels:
+                 raise ValueError("bliss cannot be used when edge_labels is True")
+-            try:
+-                from sage.graphs.bliss import automorphism_group
+-            except ImportError:
+-                raise ImportError("You must install the 'bliss' package to run this command.")
+ 
+             A = automorphism_group(self, partition)
+ 
+@@ -20903,17 +20909,22 @@ class GenericGraph(GenericGraph_pyx):
+             True
+ 
+         """
+-        from sage.misc.package import is_package_installed
++        has_bliss=True
++        try:
++            from sage.graphs.bliss import canonical_form
++        except ImportError:
++            has_bliss=False
++
+         if (algorithm == 'bliss'           or  # explicit request; or
+             (algorithm is None             and # default choice
+-             is_package_installed('bliss') and
++	     has_bliss                     and
+              not edge_labels)):
++
++            if (not has_bliss):
++                raise NotImplementedError("you need to install bliss or set algorithm=sage to use this command")
++
+             if edge_labels:
+                 raise ValueError("bliss cannot be used when edge_labels is True")
+-            try:
+-                from sage.graphs.bliss import canonical_form
+-            except ImportError:
+-                raise ImportError("You must install the 'bliss' package to run this command.")
+             return canonical_form(self, partition, return_graph, certify)
+ 
+         if (algorithm is not None and
+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
+@@ -1396,15 +1396,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, "gap", "latest", "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)):
+@@ -1683,9 +1680,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):
+         """
+@@ -1736,9 +1731,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):
+         """
+@@ -4114,8 +4107,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,11 +53,6 @@ from fpickle import pickle_function, unpickle_function
+ 
+ from .dist import install_scripts
+ 
+-from .package import (install_package,
+-        installed_packages, is_package_installed,
+-        standard_packages, optional_packages, experimental_packages,
+-        upgrade, 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
+@@ -159,7 +159,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
+ 
+@@ -1429,10 +1428,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 188529, sagemath/trunk/jupyter-path.patch)
===================================================================
--- community-staging-i686/jupyter-path.patch	                        (rev 0)
+++ community-staging-i686/jupyter-path.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,31 @@
+--- 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):
+
+@@ -151,7 +151,7 @@
+              '{connection_file}']
+         """
+         return [
+-            os.path.join(SAGE_ROOT, 'sage'),
++            os.path.join(SAGE_ROOT, 'bin', 'sage'),
+             '--python',
+             '-m', 'sage.repl.ipython_kernel',
+             '-f', '{connection_file}',
+@@ -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/linbox-1.4.patch (from rev 188529, sagemath/trunk/linbox-1.4.patch)
===================================================================
--- community-staging-i686/linbox-1.4.patch	                        (rev 0)
+++ community-staging-i686/linbox-1.4.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,470 @@
+diff --git a/src/module_list.py b/src/module_list.py
+index a49ed36..7798cb8 100644
+--- a/src/module_list.py
++++ b/src/module_list.py
+@@ -27,6 +27,18 @@ lapack_libs = list(lapack_pc['libraries'])
+ lapack_library_dirs = list(lapack_pc['library_dirs'])
+ lapack_include_dirs = list(lapack_pc['include_dirs'])
+ 
++# FFLAS-FFPACK
++fflas_ffpack_pc = pkgconfig.parse('fflas-ffpack')
++fflas_ffpack_libs = list(fflas_ffpack_pc['libraries'])
++fflas_ffpack_library_dirs = list(fflas_ffpack_pc['library_dirs'])
++fflas_ffpack_cflags = pkgconfig.cflags('fflas-ffpack').split()
++
++# Givaro
++givaro_pc = pkgconfig.parse('givaro')
++givaro_libs = list(givaro_pc['libraries'])
++givaro_library_dirs = list(givaro_pc['library_dirs'])
++givaro_cflags = pkgconfig.cflags('givaro').split()
++
+ # GNU Scientific Library
+ # Note we replace the built-in gslcblas with the above cblas
+ gsl_pc = pkgconfig.parse('gsl')
+@@ -40,6 +52,12 @@ gd_libs = list(gd_pc['libraries'])
+ gd_library_dirs = list(gd_pc['library_dirs'])
+ gd_include_dirs = list(gd_pc['include_dirs'])
+ 
++# LinBox
++linbox_pc = pkgconfig.parse('linbox')
++linbox_libs = list(linbox_pc['libraries'])
++linbox_library_dirs = list(linbox_pc['library_dirs'])
++linbox_cflags = pkgconfig.cflags('linbox').split()
++
+ # PNG image library
+ png_pc = pkgconfig.parse('libpng')
+ png_libs = list(png_pc['libraries'])
+@@ -58,9 +76,18 @@ zlib_include_dirs = list(zlib_pc['include_dirs'])
+ #########################################################
+ 
+ aliases = dict(
++    FFLASFFPACK_CFLAGS=fflas_ffpack_cflags,
++    FFLASFFPACK_LIBRARIES=fflas_ffpack_libs,
++    FFLASFFPACK_LIBDIR=fflas_ffpack_library_dirs,
++    GIVARO_CFLAGS=givaro_cflags,
++    GIVARO_LIBRARIES=givaro_libs,
++    GIVARO_LIBDIR=givaro_library_dirs,
+     GSL_LIBRARIES=gsl_libs,
+     GSL_LIBDIR=gsl_library_dirs,
+     GSL_INCDIR=gsl_include_dirs,
++    LINBOX_CFLAGS=linbox_cflags,
++    LINBOX_LIBRARIES=linbox_libs,
++    LINBOX_LIBDIR=linbox_library_dirs,
+ )
+ 
+ #########################################################
+@@ -91,12 +118,6 @@ except ValueError:
+ singular_libs = ['singular', 'flint', 'ntl', 'gmpxx', 'gmp', 'readline', 'm']
+ 
+ #########################################################
+-### Givaro flags
+-#########################################################
+-
+-givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS']
+-
+-#########################################################
+ ### Library order
+ #########################################################
+ 
+@@ -111,8 +132,7 @@ givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS']
+ # at the very end of the list.
+ library_order_list = [
+     "singular", "ec", "ecm",
+-    "linboxsage", "ntl", "iml", "linbox", "givaro",
+-] + gsl_libs + [
++] + linbox_libs  + gsl_libs + [
+     "pari", "flint", "ratpoints", "ecl", "glpk", "ppl",
+     "arb", "fplll", "mpfi", "mpfr", "mpc", "gmp", "gmpxx",
+     "brial",
+@@ -611,13 +631,10 @@ ext_modules = [
+ 
+     Extension('sage.libs.linbox.linbox',
+               sources = ['sage/libs/linbox/linbox.pyx'],
+-              libraries = ['linboxsage', 'ntl', 'iml', 'linbox',
+-                           'givaro', 'mpfr', 'gmp', 'gmpxx'] + cblas_libs,
++              libraries = linbox_libs,
+               language = 'c++',
+               library_dirs = cblas_library_dirs,
+-              include_dirs = cblas_include_dirs,
+-              extra_compile_args = givaro_extra_compile_args,
+-              depends = [os.path.join(SAGE_INC, 'givaro', 'givconfig.h')]),
++              include_dirs = cblas_include_dirs),
+ 
+     Extension('sage.libs.lcalc.lcalc_Lfunction',
+               sources = ['sage/libs/lcalc/lcalc_Lfunction.pyx'],
+@@ -665,9 +682,8 @@ ext_modules = [
+ 
+     Extension('sage.libs.singular.singular',
+               sources = ['sage/libs/singular/singular.pyx'],
+-              libraries = ['givaro'] + singular_libs,
+-              language="c++",
+-              extra_compile_args = givaro_extra_compile_args),
++              libraries = singular_libs,
++              language="c++"),
+ 
+     Extension('sage.libs.singular.polynomial',
+               sources = ['sage/libs/singular/polynomial.pyx'],
+@@ -687,8 +703,7 @@ ext_modules = [
+     Extension('sage.libs.singular.function',
+               sources = ['sage/libs/singular/function.pyx'],
+               libraries = singular_libs,
+-              language="c++",
+-              extra_compile_args = givaro_extra_compile_args),
++              language="c++"),
+ 
+     Extension('sage.libs.singular.option',
+               sources = ['sage/libs/singular/option.pyx'],
+@@ -944,19 +959,17 @@ ext_modules = [
+     Extension('sage.matrix.matrix_modn_dense_float',
+               sources = ['sage/matrix/matrix_modn_dense_float.pyx'],
+               language="c++",
+-              libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs,
++              libraries = linbox_libs + cblas_libs,
+               library_dirs = cblas_library_dirs,
+-              include_dirs = cblas_include_dirs,
+-              extra_compile_args = nocxx11_args + ['-DDISABLE_COMMENTATOR'] + givaro_extra_compile_args),
++              include_dirs = cblas_include_dirs),
+ 
+     Extension('sage.matrix.matrix_modn_dense_double',
+               sources = ['sage/matrix/matrix_modn_dense_double.pyx'],
+               language="c++",
+-              libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs,
++              libraries = linbox_libs + cblas_libs,
+               library_dirs = cblas_library_dirs,
+               include_dirs = cblas_include_dirs,
+-              extra_compile_args = nocxx11_args + ["-D_XPG6", "-DDISABLE_COMMENTATOR"]
+-                    + m4ri_extra_compile_args + givaro_extra_compile_args),
++              extra_compile_args = ["-D_XPG6"]),
+ 
+     Extension('sage.matrix.matrix_modn_sparse',
+               sources = ['sage/matrix/matrix_modn_sparse.pyx']),
+@@ -1400,8 +1413,7 @@ ext_modules = [
+     Extension('sage.rings.finite_rings.element_givaro',
+               sources = ["sage/rings/finite_rings/element_givaro.pyx"],
+               libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'],
+-              language='c++',
+-              extra_compile_args = givaro_extra_compile_args),
++              language='c++'),
+ 
+     Extension('sage.rings.finite_rings.element_ntl_gf2e',
+               sources = ['sage/rings/finite_rings/element_ntl_gf2e.pyx'],
+@@ -1421,8 +1433,7 @@ ext_modules = [
+               sources = ["sage/rings/finite_rings/hom_finite_field_givaro.pyx"],
+               # this order is needed to compile under windows.
+               libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'],
+-              language='c++',
+-              extra_compile_args = givaro_extra_compile_args),
++              language='c++'),
+ 
+     ################################
+     ##
+@@ -1574,8 +1585,7 @@ ext_modules = [
+     Extension('sage.rings.polynomial.plural',
+               sources = ['sage/rings/polynomial/plural.pyx'],
+               libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'],
+-              language="c++",
+-              extra_compile_args = givaro_extra_compile_args),
++              language="c++"),
+ 
+     Extension('sage.rings.polynomial.multi_polynomial_libsingular',
+               sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'],
+diff --git a/src/sage/libs/linbox/echelonform.pxd b/src/sage/libs/linbox/echelonform.pxd
+index 3097c8b..cf4902d 100644
+--- a/src/sage/libs/linbox/echelonform.pxd
++++ b/src/sage/libs/linbox/echelonform.pxd
+@@ -1,23 +1,27 @@
++# distutils: extra_compile_args = LINBOX_CFLAGS
++# distutils: libraries = LINBOX_LIBRARIES
++# distutils: library_dirs = LINBOX_LIBDIR
++
+ from sage.libs.linbox.modular cimport ModDoubleField, ModDoubleFieldElement, ModFloatField, ModFloatFieldElement
+ from libc.stdint cimport uint64_t
+ 
+-cdef extern from "linbox/matrix/blas-matrix.h" namespace "LinBox":
+-    cdef cppclass BlasMatrixDouble "LinBox::BlasMatrix<LinBox::Modular<double> >":
++cdef extern from "linbox/matrix/dense-matrix.h" namespace "LinBox":
++    cdef cppclass BlasMatrixDouble "LinBox::DenseMatrix<Givaro::Modular<double> >":
+         BlasMatrixDouble(ModDoubleField F, uint64_t nrows, uint64_t ncols)
+         void setEntry(size_t i, size_t j, ModDoubleFieldElement t)
+         ModDoubleFieldElement &getEntry(size_t i, size_t j)
+ 
+-    cdef cppclass BlasMatrixFloat "LinBox::BlasMatrix<LinBox::Modular<float> >":
++    cdef cppclass BlasMatrixFloat "LinBox::DenseMatrix<Givaro::Modular<float> >":
+         BlasMatrixFloat(ModFloatField F, uint64_t nrows, uint64_t ncols)
+         void setEntry(size_t i, size_t j, ModFloatFieldElement t)
+         ModFloatFieldElement &getEntry(size_t i, size_t j)
+ 
+ cdef extern from "linbox/algorithms/echelon-form.h":
+-    cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<LinBox::Modular<double> >":
++    cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<Givaro::Modular<double> >":
+         EchelonFormDomainDouble(ModDoubleField)
+         int rowReducedEchelon(BlasMatrixDouble, BlasMatrixDouble)
+ 
+-    cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<LinBox::Modular<float> >":
++    cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<Givaro::Modular<float> >":
+         EchelonFormDomainFloat(ModFloatField)
+         int rowReducedEchelon(BlasMatrixFloat, BlasMatrixFloat)
+ 
+diff --git a/src/sage/libs/linbox/fflas.pxd b/src/sage/libs/linbox/fflas.pxd
+index e102004..01ab1b1 100644
+--- a/src/sage/libs/linbox/fflas.pxd
++++ b/src/sage/libs/linbox/fflas.pxd
+@@ -1,3 +1,7 @@
++# distutils: extra_compile_args = FFLASFFPACK_CFLAGS
++# distutils: libraries = FFLASFFPACK_LIBRARIES
++# distutils: library_dirs = FFLASFFPACK_LIBDIR
++
+ from .modular cimport ModDoubleField, ModFloatField, ModDoubleFieldElement, ModFloatFieldElement
+ 
+ cdef extern from "fflas-ffpack/fflas-ffpack.h" namespace "std":
+diff --git a/src/sage/libs/linbox/linbox.pyx b/src/sage/libs/linbox/linbox.pyx
+index e932347..a9bd6d1 100644
+--- a/src/sage/libs/linbox/linbox.pyx
++++ b/src/sage/libs/linbox/linbox.pyx
+@@ -1,3 +1,7 @@
++# distutils: extra_compile_args = LINBOX_CFLAGS
++# distutils: libraries = LINBOX_LIBRARIES
++# distutils: library_dirs = LINBOX_LIBDIR
++
+ r"""
+ Linbox interface
+ """
+diff --git a/src/sage/libs/linbox/modular.pxd b/src/sage/libs/linbox/modular.pxd
+index 7ef204c..ea5fb29 100644
+--- a/src/sage/libs/linbox/modular.pxd
++++ b/src/sage/libs/linbox/modular.pxd
+@@ -1,10 +1,10 @@
+-cdef extern from "linbox/field/modular.h":
++cdef extern from "givaro/modular.h":
+     # double
+ 
+-    cdef cppclass ModDoubleFieldElement "LinBox::Modular<double>::Element":
++    cdef cppclass ModDoubleFieldElement "Givaro::Modular<double>::Element":
+         pass
+ 
+-    cdef cppclass ModDoubleField "LinBox::Modular<double>":
++    cdef cppclass ModDoubleField "Givaro::Modular<double>":
+         ModDoubleField(int modulus)
+         ModDoubleFieldElement init(ModDoubleFieldElement res, int v)
+         ModDoubleFieldElement init(ModDoubleFieldElement res, double v)
+@@ -20,10 +20,10 @@ cdef extern from "linbox/field/modular.h":
+ 
+ 
+     # float
+-    cdef cppclass ModFloatFieldElement "LinBox::Modular<float>::Element":
++    cdef cppclass ModFloatFieldElement "Givaro::Modular<float>::Element":
+         pass
+ 
+-    cdef cppclass ModFloatField "LinBox::Modular<float>":
++    cdef cppclass ModFloatField "Givaro::Modular<float>":
+         ModFloatField(int modulus)
+         ModFloatFieldElement init(ModFloatFieldElement res, int v)
+         ModFloatFieldElement init(ModFloatFieldElement res, double v)
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index 33d7f7ec..77f6e0a 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -23,6 +23,7 @@ cdef extern from "limits.h":
+ 
+ import os
+ 
++from libc.stdint cimport int64_t
+ from sage.libs.singular.decl cimport intvec
+ from sage.libs.singular.decl cimport SR_HDL, SR_INT, SR_TO_INT
+ from sage.libs.singular.decl cimport singular_options, singular_verbose_options
+@@ -156,7 +157,7 @@ cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache):
+     order = cache.objectptr.cardinality() - 1
+ 
+     while z:
+-        c = cache.objectptr.initi(c, <long>napGetCoeff(z))
++        c = cache.objectptr.initi(c, <int64_t>napGetCoeff(z))
+         e = napGetExpFrom(z,1, _ring)
+         if e == 0:
+             ret = cache.objectptr.add(ret, c, ret)
+diff --git a/src/sage/rings/finite_rings/element_givaro.pxd b/src/sage/rings/finite_rings/element_givaro.pxd
+index 68def46..91c4ed7 100644
+--- a/src/sage/rings/finite_rings/element_givaro.pxd
++++ b/src/sage/rings/finite_rings/element_givaro.pxd
+@@ -1,9 +1,15 @@
+-from sage.structure.element cimport Element, RingElement, ModuleElement
+-from sage.rings.finite_rings.element_base cimport FinitePolyExtElement
++# distutils: extra_compile_args = GIVARO_CFLAGS
++
++from libcpp.vector cimport vector
++ctypedef vector[int] intvec
++
++from libc.stdint cimport int64_t
+ 
+-from sage.structure.parent  cimport Parent
++from sage.rings.finite_rings.element_base cimport FinitePolyExtElement
++from sage.structure.parent cimport Parent
+ from sage.structure.sage_object cimport SageObject
+ 
++
+ cdef extern from "givaro/givconfig.h":
+     pass
+ 
+@@ -13,16 +19,7 @@ cdef extern from "givaro/givrandom.h":
+ 
+     GivRandom GivRandomSeeded  "Givaro::GivRandom"(unsigned long seed)
+ 
+-cdef extern from "givaro/givgfq.h":
+-    ctypedef struct intvec "std::vector<unsigned int>":
+-        void (* push_back)(int elem)
+-
+-    ctypedef struct constintvec "const std::vector<unsigned int>"
+-
+-    intvec intvec_factory "std::vector<unsigned int>"(int len)
+-
+-cdef extern from "givaro/givgfq.h":
+-
++cdef extern from "givaro/gfq.h":
+     ctypedef struct GivaroGfq "Givaro::GFqDom<int>":
+         #attributes
+         unsigned int one
+@@ -40,10 +37,10 @@ cdef extern from "givaro/givgfq.h":
+         unsigned int (* cardinality)()
+         int (* exponent)()
+         int (* random)(GivRandom gen, int res)
+-        int (* initi "init")(int res, int e)
++        int (* initi "init")(int res, int64_t e)
+         int (* initd "init")(int res, double e)
+         int (* indeterminate)()
+-        int (* convert)(int r, int p)
++        int (* convert)(int64_t r, int p)
+         int (* read)(int r, int p)
+         int (* axpyin)(int r, int a, int x)
+         int (* axpy)(int r, int a, int b, int c)
+@@ -60,7 +57,12 @@ cdef extern from "givaro/givgfq.h":
+     void delete "delete "(void *o)
+     int gfq_element_factory "Givaro::GFqDom<int>::Element"()
+ 
+-cdef class FiniteField_givaroElement(FinitePolyExtElement) #forward declaration
++
++cdef class FiniteField_givaroElement(FinitePolyExtElement):
++    cdef int element
++    cdef Cache_givaro _cache
++    cdef object _multiplicative_order
++    cdef FiniteField_givaroElement _new_c(self, int value)
+ 
+ cdef class Cache_givaro(SageObject):
+     cdef GivaroGfq *objectptr # C++ object
+@@ -85,11 +87,4 @@ cdef class FiniteField_givaro_iterator:
+     cdef int iterator
+     cdef Cache_givaro _cache
+ 
+-cdef class FiniteField_givaroElement(FinitePolyExtElement):
+-    cdef int element
+-    cdef Cache_givaro _cache
+-    cdef object _multiplicative_order
+-    cdef FiniteField_givaroElement _new_c(self, int value)
+-
+-
+ cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x)
+diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx
+index d32b5cf..f2afa44 100644
+--- a/src/sage/rings/finite_rings/element_givaro.pyx
++++ b/src/sage/rings/finite_rings/element_givaro.pyx
+@@ -59,8 +59,9 @@ from sage.misc.randstate cimport randstate, current_randstate
+ from sage.rings.finite_rings.finite_field_base cimport FiniteField
+ from sage.rings.ring cimport Ring
+ from element_ext_pari import FiniteField_ext_pariElement
+-from element_pari_ffelt import FiniteFieldElement_pari_ffelt
++from element_pari_ffelt cimport FiniteFieldElement_pari_ffelt
+ from sage.structure.sage_object cimport SageObject
++from sage.structure.element cimport Element, ModuleElement, RingElement
+ import operator
+ import sage.arith.all
+ import finite_field_constructor as finite_field
+@@ -374,18 +375,16 @@ cdef class Cache_givaro(SageObject):
+         elif isinstance(e, int) or \
+              isinstance(e, Integer) or \
+              isinstance(e, long) or is_IntegerMod(e):
+-            try:
+-                e_int = e
+-            except OverflowError:
+-                e_int = e % self.characteristic()
++            e_int = e % self.characteristic()
+             res = self.objectptr.initi(res, e_int)
+ 
+         elif e is None:
+             e_int = 0
+-            res = self.objectptr.initi(res,e_int)
++            res = self.objectptr.initi(res, e_int)
+ 
+         elif isinstance(e, float):
+-            res = self.objectptr.initd(res,e)
++            e_int = int(e) % self.characteristic()
++            res = self.objectptr.initd(res, e_int)
+ 
+         elif isinstance(e, str):
+             return self.parent(eval(e.replace("^","**"),self.parent.gens_dict()))
+@@ -395,8 +394,8 @@ cdef class Cache_givaro(SageObject):
+                 raise TypeError("e.parent must match self.vector_space")
+             ret = self._zero_element
+             for i in range(len(e)):
+-                e_entry = e[i] % self.characteristic()
+-                res = self.objectptr.initi(res, int(e_entry))
++                e_int = e[i] % self.characteristic()
++                res = self.objectptr.initi(res, e_int)
+                 to_add = make_FiniteField_givaroElement(self, res)
+                 ret = ret + to_add*self.parent.gen()**i
+             return ret
+@@ -435,8 +434,8 @@ cdef class Cache_givaro(SageObject):
+                 raise ValueError("list is too long")
+             ret = self._zero_element
+             for i in range(len(e)):
+-                e_entry = e[i] % self.characteristic()
+-                res = self.objectptr.initi(res, int(e_entry))
++                e_int = e[i] % self.characteristic()
++                res = self.objectptr.initi(res, e_int)
+                 to_add = make_FiniteField_givaroElement(self, res)
+                 ret = ret + to_add*self.parent.gen()**i
+             return ret
+@@ -573,19 +572,17 @@ cdef class Cache_givaro(SageObject):
+         cdef int ret = k.zero
+         cdef int a = k.indeterminate()
+         cdef int at = k.one
+-        cdef unsigned int ch = k.characteristic()
+-        cdef int _n, t, i
++        cdef int ch = k.characteristic()
++        cdef int t, i
+ 
+         if n<0 or n>k.cardinality():
+             raise TypeError("n must be between 0 and self.order()")
+ 
+-        _n = n
+-
+         for i from 0 <= i < k.exponent():
+-            t = k.initi(t, _n%ch)
++            t = k.initi(t, n % ch)
+             ret = k.axpy(ret, t, at, ret)
+             at = k.mul(at,at,a)
+-            _n = _n/ch
++            n //= ch
+         return make_FiniteField_givaroElement(self, ret)
+ 
+     def _element_repr(self, FiniteField_givaroElement e):
+diff --git a/src/sage/rings/finite_rings/finite_field_givaro.py b/src/sage/rings/finite_rings/finite_field_givaro.py
+index adbaab3..c431f6d 100644
+--- a/src/sage/rings/finite_rings/finite_field_givaro.py
++++ b/src/sage/rings/finite_rings/finite_field_givaro.py
+@@ -270,7 +270,8 @@ class FiniteField_givaro(FiniteField):
+             sage: k(2) # indirect doctest
+             0
+ 
+-            Floats coerce in:
++        Floats are converted like integers::
++
+             sage: k(float(2.0))
+             0
+ 
+@@ -344,7 +345,7 @@ class FiniteField_givaro(FiniteField):
+             sage: k(pari('Mod(1,2)'))
+             1
+             sage: k(pari('Mod(2,3)'))
+-            0
++            a
+             sage: k(pari('Mod(1,3)*a^20'))
+             a^7 + a^5 + a^4 + a^2
+ 

Copied: sagemath/repos/community-staging-i686/package.patch (from rev 188529, sagemath/trunk/package.patch)
===================================================================
--- community-staging-i686/package.patch	                        (rev 0)
+++ community-staging-i686/package.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,11 @@
+--- 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
+@@ -204,7 +204,7 @@
+     Otherwise, installing "pillow" will cause this function to think
+     that "pil" is installed, for example.
+     """
+-    return any(p.split('-')[0] == package for p in installed_packages())
++    return True
+ 
+ def package_versions(package_type, local=False):
+     r"""

Copied: sagemath/repos/community-staging-i686/paths.patch (from rev 188529, sagemath/trunk/paths.patch)
===================================================================
--- community-staging-i686/paths.patch	                        (rev 0)
+++ community-staging-i686/paths.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,13 @@
+--- src/sage/env.py.orig	2014-06-25 10:47:25.827203554 +1200
++++ src/sage/env.py	2014-06-25 10:49:07.667402821 +1200
+@@ -90,8 +90,8 @@
+ 
+ # bunch of sage directories and files
+ _add_variable_or_fallback('SAGE_ROOT',       None)
+-_add_variable_or_fallback('SAGE_LOCAL',      opj('$SAGE_ROOT', 'local'))
+-_add_variable_or_fallback('SAGE_ETC',        opj('$SAGE_LOCAL', 'etc'))
++_add_variable_or_fallback('SAGE_LOCAL',      '/usr')
++_add_variable_or_fallback('SAGE_ETC',        '/etc/sage')
+ _add_variable_or_fallback('SAGE_INC',        opj('$SAGE_LOCAL', 'include'))
+ _add_variable_or_fallback('SAGE_SHARE',      opj('$SAGE_LOCAL', 'share'))
+ 

Copied: sagemath/repos/community-staging-i686/python-2.7.11.patch (from rev 188529, sagemath/trunk/python-2.7.11.patch)
===================================================================
--- community-staging-i686/python-2.7.11.patch	                        (rev 0)
+++ community-staging-i686/python-2.7.11.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,11 @@
+--- src/sage/misc/sage_timeit.py.orig	2015-12-19 11:09:42.836938821 +0100
++++ src/sage/misc/sage_timeit.py	2015-12-19 11:10:27.090217304 +0100
+@@ -217,7 +217,7 @@
+     # but is there a better way to achieve that the code stmt has access
+     # to the shell namespace?
+ 
+-    src = timeit_.template % {'stmt': timeit_.reindent(stmt, 8),
++    src = timeit_.template % {'init': "", 'stmt': timeit_.reindent(stmt, 8),
+                              'setup': "pass"}
+     code = compile(src, "<magic-timeit>", "exec")
+     ns = {}

Copied: sagemath/repos/community-staging-i686/sagemath-ipython5.patch (from rev 188529, sagemath/trunk/sagemath-ipython5.patch)
===================================================================
--- community-staging-i686/sagemath-ipython5.patch	                        (rev 0)
+++ community-staging-i686/sagemath-ipython5.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,548 @@
+diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
+index 2654016..d3daed6 100644
+--- a/src/sage/doctest/forker.py
++++ b/src/sage/doctest/forker.py
+@@ -116,10 +116,6 @@ def init_sage():
+     from sage.structure.debug_options import debug
+     debug.refine_category_hash_check = True
+ 
+-    # Disable IPython colors during doctests
+-    from sage.repl.interpreter import DEFAULT_SAGE_CONFIG
+-    DEFAULT_SAGE_CONFIG.TerminalInteractiveShell.colors = 'NoColor'
+-
+     # We import readline before forking, otherwise Pdb doesn't work
+     # os OS X: http://trac.sagemath.org/14289
+     import readline
+@@ -1088,15 +1084,13 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             sage: _ = sage0.eval("import doctest, sys, os, multiprocessing, subprocess")
+             sage: _ = sage0.eval("from sage.doctest.parsing import SageOutputChecker")
+             sage: _ = sage0.eval("import sage.doctest.forker as sdf")
+-            sage: _ = sage0.eval("sdf.init_sage()")
+             sage: _ = sage0.eval("from sage.doctest.control import DocTestDefaults")
+             sage: _ = sage0.eval("DD = DocTestDefaults(debug=True)")
+             sage: _ = sage0.eval("ex1 = doctest.Example('a = 17', '')")
+             sage: _ = sage0.eval("ex2 = doctest.Example('2*a', '1')")
+             sage: _ = sage0.eval("DT = doctest.DocTest([ex1,ex2], globals(), 'doubling', None, 0, None)")
+             sage: _ = sage0.eval("DTR = sdf.SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)")
+-            sage: sage0._prompt = r"debug: "
+-            sage: print(sage0.eval("DTR.run(DT, clear_globs=False)")) # indirect doctest
++            sage: print(sage0.eval("sdf.init_sage(); DTR.run(DT, clear_globs=False)")) # indirect doctest
+             **********************************************************************
+             Line 1, in doubling
+             Failed example:
+@@ -1110,7 +1104,6 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             ...
+             sage: sage0.eval("a")
+             '...17'
+-            sage: sage0._prompt = "sage: "
+             sage: sage0.eval("quit")
+             'Returning to doctests...TestResults(failed=1, attempted=2)'
+         """
+@@ -1144,13 +1137,14 @@ class SageDocTestRunner(doctest.DocTestRunner):
+                         print(src)
+                         if ex.want:
+                             print(doctest._indent(ex.want[:-1]))
+-                    from sage.repl.interpreter import DEFAULT_SAGE_CONFIG
++                    from sage.repl.configuration import sage_ipython_config
++                    from sage.repl.prompts import DebugPrompts
+                     from IPython.terminal.embed import InteractiveShellEmbed
+-                    import copy
+-                    cfg = copy.deepcopy(DEFAULT_SAGE_CONFIG)
+-                    prompt_config = cfg.PromptManager
+-                    prompt_config.in_template = 'debug: '
+-                    prompt_config.in2_template = '.....: '
++                    cfg = sage_ipython_config.default()
++                    # Currently this doesn't work: prompts only work in pty
++                    # We keep simple_prompt=True, prompts will be "In [0]:"
++                    # cfg.InteractiveShell.prompts_class = DebugPrompts
++                    # cfg.InteractiveShell.simple_prompt = False
+                     shell = InteractiveShellEmbed(config=cfg, banner1='', user_ns=dict(globs))
+                     shell(header='', stack_depth=2)
+                 except KeyboardInterrupt:
+@@ -1248,6 +1242,7 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             sage: _ = sage0.eval("ex = doctest.Example('E = EllipticCurve([0,0]); E', 'A singular Elliptic Curve')")
+             sage: _ = sage0.eval("DT = doctest.DocTest([ex], globals(), 'singular_curve', None, 0, None)")
+             sage: _ = sage0.eval("DTR = sdf.SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)")
++            sage: old_prompt = sage0._prompt
+             sage: sage0._prompt = r"\(Pdb\) "
+             sage: sage0.eval("DTR.run(DT, clear_globs=False)") # indirect doctest
+             '... ArithmeticError("invariants " + str(ainvs) + " define a singular curve")'
+@@ -1257,7 +1252,7 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             '...EllipticCurve_field.__init__(self, K, ainvs)'
+             sage: sage0.eval("p ainvs")
+             '(0, 0, 0, 0, 0)'
+-            sage: sage0._prompt = "sage: "
++            sage: sage0._prompt = old_prompt
+             sage: sage0.eval("quit")
+             'TestResults(failed=1, attempted=1)'
+         """
+diff --git a/src/sage/doctest/test.py b/src/sage/doctest/test.py
+index d69136f..a6cc4d0 100644
+--- a/src/sage/doctest/test.py
++++ b/src/sage/doctest/test.py
+@@ -360,7 +360,7 @@ Test the ``--debug`` option::
+         s...: b = 5
+         s...: a + b
+         8
+-    debug:
++    In [1]:
+     <BLANKLINE>
+     Returning to doctests...
+     **********************************************************************
+diff --git a/src/sage/interfaces/sage0.py b/src/sage/interfaces/sage0.py
+index 87bfc0b..77cd151 100644
+--- a/src/sage/interfaces/sage0.py
++++ b/src/sage/interfaces/sage0.py
+@@ -18,6 +18,7 @@ from __future__ import absolute_import
+ 
+ import cPickle
+ import os
++import re
+ 
+ from .expect import Expect, ExpectElement, FunctionElement
+ import sage.repl.preparse
+@@ -146,10 +147,17 @@ class Sage(ExtraTabCompletion, Expect):
+             if init_code is None:
+                 init_code = ['from sage.all import *', 'import cPickle']
+         else:
+-            # Disable the IPython history (implemented as SQLite database)
+-            # to avoid problems with locking.
+-            command = "sage-ipython --HistoryManager.hist_file=:memory: --colors=NoColor"
+-            prompt = "sage: "
++            command = ' '.join([
++                'sage-ipython',
++                # Disable the IPython history (implemented as SQLite database)
++                # to avoid problems with locking.
++                '--HistoryManager.hist_file=:memory:',
++                # Disable everything that prints ANSI codes
++                '--colors=NoColor',
++                '--no-term-title',
++                '--simple-prompt',
++            ])
++            prompt = re.compile('In \[\d+\]: ')
+             if init_code is None:
+                 init_code = ['import cPickle']
+ 
+diff --git a/src/sage/misc/trace.py b/src/sage/misc/trace.py
+index 0da17e7..efcaa33 100644
+--- a/src/sage/misc/trace.py
++++ b/src/sage/misc/trace.py
+@@ -54,6 +54,7 @@ def trace(code, preparse=True):
+         sage: import pexpect
+         sage: s = pexpect.spawn('sage')
+         sage: _ = s.sendline("trace('print(factor(10))'); print(3+97)")
++        sage: _ = s.expect('ipdb>', timeout=90)
+         sage: _ = s.sendline("s"); _ = s.sendline("c");
+         sage: _ = s.expect('100', timeout=90)
+ 
+diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py
+new file mode 100644
+index 0000000..5034039
+--- /dev/null
++++ b/src/sage/repl/configuration.py
+@@ -0,0 +1,152 @@
++r"""
++Sage's IPython Configuration
++"""
++
++#*****************************************************************************
++#       Copyright (C) 2016 Volker Braun <vbraun.name at gmail.com>
++#
++#  Distributed under the terms of the GNU General Public License (GPL)
++#  as published by the Free Software Foundation; either version 2 of
++#  the License, or (at your option) any later version.
++#                  http://www.gnu.org/licenses/
++#*****************************************************************************
++
++from __future__ import absolute_import
++
++import sys
++import copy
++from traitlets.config.loader import Config
++
++from sage.repl.prompts import SagePrompts
++
++
++# Name of the Sage IPython extension
++SAGE_EXTENSION = 'sage'
++
++
++class SageIpythonConfiguration(object):
++
++    def _doctest_mode(self):
++        """
++        Whether we are in doctest mode
++
++        This returns ``True`` during doctests.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config._doctest_mode()
++            True
++        """
++        from sage.doctest import DOCTEST_MODE
++        return DOCTEST_MODE
++    
++    def _allow_ansi(self):
++        """
++        Whether to allow ANSI escape sequences
++
++        This returns ``False`` during doctests to avoid ANSI escape 
++        sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config._allow_ansi()
++            False
++        """
++        return (not self._doctest_mode()) and sys.stdout.isatty()
++
++    def colors(self):
++        """
++        Return the IPython color palette
++
++        This returns ``'NoColor'`` during doctests to avoid ANSI escape 
++        sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.simple_prompt()
++            True
++        """
++        return 'LightBG' if self._allow_ansi() else 'NoColor'
++
++    def simple_prompt(self):
++        """
++        Return whether to use the simple prompt
++
++        This returns ``True`` during doctests to avoid ANSI escape sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.simple_prompt()
++            True
++        """
++        return not self._allow_ansi()
++
++    def term_title(self):
++        """
++        Return whether to set the terminal title
++
++        This returns false during doctests to avoid ANSI escape sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.term_title()
++            False
++        """
++        return self._allow_ansi()
++
++    def default(self):
++        """
++        Return a new default configuration object
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.default()
++            {'InteractiveShell': {'colors': ...
++        """
++        from sage.repl.interpreter import SageTerminalInteractiveShell
++        cfg = Config(
++            TerminalIPythonApp=Config(
++                display_banner=False,
++                verbose_crash=True,
++                test_shell=False,
++                shell_class=SageTerminalInteractiveShell,
++            ),
++            InteractiveShell=Config(
++                prompts_class=SagePrompts,
++                ast_node_interactivity='all',
++                colors=self.colors(),
++                simple_prompt=self.simple_prompt(),
++                term_title=self.term_title(),
++                confirm_exit=False,
++                separate_in=''
++            ),
++            InteractiveShellApp=Config(extensions=[SAGE_EXTENSION]),
++        )
++        if self._doctest_mode():
++            # Using the file-backed history causes problems in parallel tests
++            cfg.HistoryManager = Config(hist_file=':memory:')
++        return cfg
++
++    def copy(self):
++        """
++        Return a copy of the current configuration
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.copy()
++            {'InteractiveShell': {'colors': ...
++        """
++        try:
++            return copy.deepcopy(get_ipython().config)
++        except NameError:
++            return self.default()
++
++
++sage_ipython_config = SageIpythonConfiguration()
+diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py
+index e0499c7..1f4eda7 100644
+--- a/src/sage/repl/interpreter.py
++++ b/src/sage/repl/interpreter.py
+@@ -102,18 +102,15 @@ Check that Cython source code appears in tracebacks::
+ #*****************************************************************************
+ 
+ 
+-import copy
+ import os
+ import re
+-import sys
+ from sage.repl.preparse import preparse
++from sage.repl.prompts import SagePrompts, InterfacePrompts
+ 
+-from traitlets.config.loader import Config
+ from traitlets import Bool, Type
+ 
+ from sage.env import SAGE_LOCAL
+-
+-SAGE_EXTENSION = 'sage'
++from sage.repl.configuration import sage_ipython_config, SAGE_EXTENSION
+ 
+ def embedded():
+     """
+@@ -370,31 +367,7 @@ class SageTestShell(SageShellOverride, TerminalInteractiveShell):
+         rc = super(SageTestShell, self).run_cell(*args, **kwds)
+ 
+ 
+-###################################################################
+-# Default configuration
+-###################################################################
+-
+-DEFAULT_SAGE_CONFIG = Config(
+-    PromptManager = Config(
+-        in_template = 'sage: ',
+-        in2_template = '....: ',
+-        justify = False,
+-        out_template = ''),
+-    TerminalIPythonApp = Config(
+-        display_banner = False,
+-        verbose_crash = True,
+-        test_shell = False,
+-        shell_class = SageTerminalInteractiveShell,
+-    ),
+-    InteractiveShell = Config(
+-        ast_node_interactivity = 'all',
+-        colors = 'LightBG' if sys.stdout.isatty() else 'NoColor',
+-        confirm_exit = False,
+-        separate_in = ''),
+-    InteractiveShellApp = Config(extensions=[SAGE_EXTENSION]),
+-)
+-
+-
++    
+ ###################################################################
+ # Transformers used in the SageInputSplitter
+ ###################################################################
+@@ -614,19 +587,17 @@ def interface_shell_embed(interface):
+         sage: shell = interface_shell_embed(gap)
+         sage: shell.run_cell('List( [1..10], IsPrime )')
+         [ false, true, true, false, true, false, true, false, false, false ]
+-        <IPython.core.interactiveshell.ExecutionResult object at 0x...>
+-    """
+-    try:
+-        cfg = copy.deepcopy(get_ipython().config)
+-    except NameError:
+-        cfg = copy.deepcopy(DEFAULT_SAGE_CONFIG)
+-    cfg.PromptManager['in_template'] = interface.name() + ': '
+-    cfg.PromptManager['in2_template'] = len(interface.name())*'.' + ': '
++        <repr(<IPython.core.interactiveshell.ExecutionResult at 0x...>) failed: 
++        AttributeError: type object 'ExecutionResult' has no attribute '__qualname__'>
+ 
++    Note that the repr error is https://github.com/ipython/ipython/issues/9756
++    """
++    cfg = sage_ipython_config.copy()
+     ipshell = InteractiveShellEmbed(config=cfg,
+                                     banner1='\n  --> Switching to %s <--\n\n'%interface,
+-                                    exit_msg = '\n  --> Exiting back to Sage <--\n')
++                                    exit_msg='\n  --> Exiting back to Sage <--\n')
+     ipshell.interface = interface
++    ipshell.prompts = InterfacePrompts(interface.name())
+ 
+     while ipshell.prefilter_manager.transformers:
+         ipshell.prefilter_manager.transformers.pop()
+@@ -669,7 +640,7 @@ def get_test_shell():
+         sage: out + err
+         ''
+     """
+-    config = copy.deepcopy(DEFAULT_SAGE_CONFIG)
++    config = sage_ipython_config.default()
+     config.TerminalIPythonApp.test_shell = True
+     config.TerminalIPythonApp.shell_class = SageTestShell
+     app = SageTerminalApp.instance(config=config)
+@@ -748,12 +719,9 @@ class SageTerminalApp(TerminalIPythonApp):
+             sage: os.environ['IPYTHONDIR'] = IPYTHONDIR
+         """
+         super(SageTerminalApp, self).load_config_file(*args, **kwds)
+-
+-        newconfig = copy.deepcopy(DEFAULT_SAGE_CONFIG)
+-
++        newconfig = sage_ipython_config.default()
+         # merge in the config loaded from file
+         newconfig.merge(self.config)
+-
+         self.config = newconfig
+ 
+     def init_shell(self):
+@@ -767,7 +735,7 @@ class SageTerminalApp(TerminalIPythonApp):
+ 
+         EXAMPLES::
+ 
+-            sage: from sage.repl.interpreter import SageTerminalApp, DEFAULT_SAGE_CONFIG
++            sage: from sage.repl.interpreter import SageTerminalApp
+             sage: app = SageTerminalApp.instance()
+             sage: app.shell
+             <sage.repl.interpreter.SageTestShell object at 0x...>
+@@ -776,7 +744,6 @@ class SageTerminalApp(TerminalIPythonApp):
+         self.shell = self.shell_class.instance(
+             parent=self,
+             config=self.config,
+-            display_banner=False,
+             profile_dir=self.profile_dir,
+             ipython_dir=self.ipython_dir)
+         self.shell.configurables.append(self)
+diff --git a/src/sage/repl/ipython_tests.py b/src/sage/repl/ipython_tests.py
+index 0fa568d..2bb34cd 100644
+--- a/src/sage/repl/ipython_tests.py
++++ b/src/sage/repl/ipython_tests.py
+@@ -100,6 +100,12 @@ Next, test the pinfo2 magic for Cython code::
+     ...
+     File:   .../sage/tests/stl_vector.pyx
+     Type:   type
++
++Test that there are no warnings being ignored internally::
++
++    sage: import warnings
++    sage: warnings.simplefilter('error');  get_test_shell()
++    <sage.repl.interpreter.SageTestShell object at 0x...>
+ '''
+ 
+ 
+diff --git a/src/sage/repl/prompts.py b/src/sage/repl/prompts.py
+new file mode 100644
+index 0000000..e885730
+--- /dev/null
++++ b/src/sage/repl/prompts.py
+@@ -0,0 +1,92 @@
++r"""
++Sage Commandline Prompts
++"""
++
++#*****************************************************************************
++#       Copyright (C) 2016 Volker Braun <vbraun.name at gmail.com>
++#
++# This program is free software: you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation, either version 2 of the License, or
++# (at your option) any later version.
++#                  http://www.gnu.org/licenses/
++#*****************************************************************************
++
++from pygments.token import Token
++from IPython.terminal.prompts import Prompts
++
++
++class SagePrompts(Prompts):
++
++    def in_prompt_tokens(self, cli=None):
++        return [
++            (Token.Prompt, 'sage: '),
++        ]
++
++    def continuation_prompt_tokens(self, cli=None, width=None):
++        return [
++            (Token.Prompt, '....: '),
++        ]
++
++    def rewrite_prompt_tokens(self):
++        return [
++            (Token.Prompt, '----> '),
++        ]
++
++    def out_prompt_tokens(self):
++        return [
++            (Token.OutPrompt, ''),
++        ]
++
++    
++class InterfacePrompts(Prompts):
++
++    def __init__(self, interface_name):
++        self.__name = interface_name
++        self.__width = len(interface_name)
++    
++    def in_prompt_tokens(self, cli=None):
++        return [
++            (Token.Prompt, self.__name + ': '),
++        ]
++
++    def continuation_prompt_tokens(self, cli=None, width=None):
++        return [
++            (Token.Prompt, '.' * self.__width + ': '),
++        ]
++
++    def rewrite_prompt_tokens(self):
++        return [
++            (Token.Prompt, '-' * self.__width + '> '),
++        ]
++
++    def out_prompt_tokens(self):
++        return [
++            (Token.OutPrompt, ''),
++        ]
++
++
++class DebugPrompts(Prompts):
++
++    def in_prompt_tokens(self, cli=None):
++        return [
++            (Token.Prompt, 'debug: '),
++        ]
++
++    def continuation_prompt_tokens(self, cli=None, width=None):
++        return [
++            (Token.Prompt, '.....: '),
++        ]
++
++    def rewrite_prompt_tokens(self):
++        return [
++            (Token.Prompt, '-----> '),
++        ]
++
++    def out_prompt_tokens(self):
++        return [
++            (Token.OutPrompt, ''),
++        ]
++
++    
++    
+diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py
+index 0d15d82..417ec5e 100644
+--- a/src/sage/tests/cmdline.py
++++ b/src/sage/tests/cmdline.py
+@@ -385,7 +385,7 @@ def test_executable(args, input="", timeout=100.0, **kwds):
+         **********************************************************************
+         Previously executed commands:
+             s...: assert True == False
+-        debug:
++        In [1]:
+         <BLANKLINE>
+         Returning to doctests...
+         **********************************************************************

Copied: sagemath/repos/community-staging-i686/skip-check.patch (from rev 188529, sagemath/trunk/skip-check.patch)
===================================================================
--- community-staging-i686/skip-check.patch	                        (rev 0)
+++ community-staging-i686/skip-check.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/test-optional.patch)
===================================================================
--- community-staging-i686/test-optional.patch	                        (rev 0)
+++ community-staging-i686/test-optional.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,11 @@
+--- src/sage/doctest/control.py.orig	2015-10-31 09:40:55.173671531 +0100
++++ src/sage/doctest/control.py	2015-10-31 09:40:05.370125436 +0100
+@@ -253,7 +253,7 @@
+                 if 'optional' in options.optional:
+                     options.optional.discard('optional')
+                     from sage.misc.package import package_versions
+-                    optional_pkgs = package_versions("optional", local=True)
++                    optional_pkgs = {}
+                     for pkg, versions in optional_pkgs.items():
+                         if versions[0] == versions[1]:
+                             options.optional.add(pkg)

Copied: sagemath/repos/community-staging-x86_64/PKGBUILD (from rev 188529, sagemath/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,161 @@
+# $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
+
+pkgname=sagemath
+pkgver=7.3
+pkgrel=4
+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 cysignals ppl palp brial singular cliquer maxima-ecl gfan sympow tachyon python2-rpy2 nauty
+  python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow 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' 'ipython2-notebook: Jupyter notebook interface' 'mathjax: Jupyter notebook interface'
+  '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' 'cryptominisat: 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-igraph: igraph backend for graph theory' 'sage-notebook-exporter: convert flask notebooks to jupyter'
+  'jupyter-notebook: Jupyter notebook interface')
+makedepends=(cython2 boost ratpoints symmetrica fflas-ffpack python2-jinja coin-or-cbc libhomfly libbraiding
+  mcqd coxeter3 cryptominisat modular_decomposition bliss-graphs tdlib python2-pkgconfig meataxe) # libfes
+conflicts=(sage-mathematics)
+replaces=(sage-mathematics)
+provides=(sage-mathematics)
+source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
+        anal.h env.patch paths.patch clean.patch skip-check.patch cython-sys-path.patch is-package-installed.patch package.patch
+        disable-fes.patch jupyter-path.patch test-optional.patch python-2.7.11.patch linbox-1.4.patch ecm-7.patch
+        sagemath-ipython5.patch increase-rtol.patch)
+md5sums=('cb2aed3d24de7b2228a9b34e81a27870'
+         'a906a180d198186a39820b0a2f9a9c63'
+         'd4d3c235c99b2bc92dde9f6e53935a8d'
+         '45b84ae5579273196df44f7464a01a30'
+         '6d9ae0978ce6a05a0da2cafdfb178a09'
+         '6cafcb381437d4751fd55b25d5090987'
+         'a1bcdd3fe620dbae60ed8b0e98b2ece7'
+         'b3ecf7c93a90e0afccbc686af9fdc85f'
+         '9ba81f717ffd4e20b8b2f2a318307488'
+         '06a67e611d10aa2381efe1f08ea4ffd9'
+         '16b529194c6105c3364127bd8f1efa83'
+         'cdcabd475b80afe0534a5621e972736e'
+         'ef927896f2071b442b1d07d7e69f5f3a'
+         'a276f0fbbff6eade409d0569ebd728d4'
+         '0c9a57d35de80c2cd418ebec912efbbb'
+         '2bcaca7284dda963ebdc17daf78cf6c9'
+         '39d3fded716d2a7ae0ab03e0896b7497')
+
+prepare(){
+  cd sage-$pkgver
+
+# Arch-specific patches
+# assume all optional packages are installed
+  patch -p0 -i ../package.patch
+# find L.h header
+  sed -e 's|libLfunction|Lfunction|' -i src/sage/libs/lcalc/lcalc_sage.h
+# don't try to link against libpng 1.2
+  sed -e 's|png12|png|' -i src/module_list.py
+# set env variables
+  patch -p0 -i ../env.patch
+# fix paths in python imports
+  patch -p0 -i ../paths.patch
+# don't try to remove installed files
+  patch -p0 -i ../clean.patch
+# skip checking build status
+  patch -p0 -i ../skip-check.patch
+# supress warning about GAP install dir
+  sed -e "s|gapdir = os.path.join(SAGE_LOCAL, 'gap', 'latest')|gapdir = '/usr/lib/gap'|" -i src/sage/libs/gap/util.pyx 
+# find bliss headers
+  sed -e 's|graph.hh|bliss/graph.hh|' -i src/sage/graphs/bliss.pyx
+# don't list optional packages when running tests
+  patch -p0 -i ../test-optional.patch
+# set jupyter path
+  patch -p0 -i ../jupyter-path.patch
+# fix timeit with Python 2.7.11
+  patch -p0 -i ../python-2.7.11.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
+# port to new givaro/fflas-ffpack/linbox http://trac.sagemath.org/ticket/17635
+  patch -p1 -i ../linbox-1.4.patch
+# port to ipython 5.0 https://trac.sagemath.org/ticket/21006
+  patch -p1 -i ../sagemath-ipython5.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|' -i src/bin/sage
+  sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
+  sed -e 's|python -c|python2 -c|' -i src/Makefile
+
+# copy required private PARI header
+  mkdir -p src/pari
+  cp "$srcdir"/anal.h src/pari/anal.h
+}
+
+
+build() {
+  cd sage-$pkgver/src
+
+  export SAGE_LOCAL="/usr"
+  export SAGE_SRC="$PWD"
+  export CC=gcc
+
+  make sage/libs/pari/auto_gen.pxi
+  make sage/ext/interpreters/__init__.py
+
+  python2 setup.py build
+}
+
+package() {
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="/usr"
+  export SAGE_LOCAL="$SAGE_ROOT"
+  export SAGE_SRC="$PWD"
+  export CC=gcc
+  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
+  mkdir "$pkgdir"/usr/share/sage/source
+
+# Remove sage_setup
+  rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup
+}

Copied: sagemath/repos/community-staging-x86_64/anal.h (from rev 188529, sagemath/trunk/anal.h)
===================================================================
--- community-staging-x86_64/anal.h	                        (rev 0)
+++ community-staging-x86_64/anal.h	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,65 @@
+/* Copyright (C) 2000  The PARI group.
+
+This file is part of the PARI/GP package.
+
+PARI/GP is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation. It is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY WHATSOEVER.
+
+Check the License for details. You should have received a copy of it, along
+with the package; see the file 'COPYING'. If not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+/*************************************************************************/
+/*                                                                       */
+/*                 Declarations specific to the analyzer                 */
+/*                                                                       */
+/*************************************************************************/
+BEGINEXTERN
+/* GP control structures */
+#define EXPR_WRAP(code, call) \
+{ GEN z; GEN __E = code; \
+  push_lex(gen_0, __E); z = call; pop_lex(1); return z; }
+#define EXPR_ARG __E, &gp_eval
+#define EXPR_ARGUPTO __E, &gp_evalupto
+#define EXPR_ARGBOOL __E, &gp_evalbool
+
+/* functions */
+void   changevalue(entree *ep, GEN val);
+void    freeep(entree *ep);
+void   pari_fill_hashtable(entree **table, entree *ep);
+
+void compile_err(const char *msg, const char *str);
+void compile_varerr(const char *str);
+
+#ifdef STACK_CHECK
+extern THREAD void *PARI_stack_limit;
+#endif
+
+extern entree  **varentries;
+
+struct node_loc
+{
+  const char *start,*end;
+};
+
+union token_value { long val; };
+
+int pari_lex(union token_value *yylval, struct node_loc *yylloc, char **lex);
+int pari_parse(char **lex);
+entree* fetch_entry(const char *s, long len);
+entree* fetch_member(const char *s, long len);
+void pari_close_parser(void);
+void pari_close_compiler(void);
+void pari_close_evaluator(void);
+void pari_init_parser(void);
+void pari_init_compiler(void);
+void pari_init_evaluator(void);
+void optimizenode(long n);
+void push_frame(GEN C, long lpc, long flag);
+const char * closure_func_err(void);
+GEN  gp_closure(long n);
+long eval_mnemonic(GEN str, const char *tmplate);
+
+ENDEXTERN

Copied: sagemath/repos/community-staging-x86_64/clean.patch (from rev 188529, sagemath/trunk/clean.patch)
===================================================================
--- community-staging-x86_64/clean.patch	                        (rev 0)
+++ community-staging-x86_64/clean.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,24 @@
+--- src/setup.py.orig	2014-11-16 10:34:05.521441703 +0100
++++ src/setup.py	2014-11-16 10:34:16.054812569 +0100
+@@ -620,21 +620,6 @@
+ 
+ 
+ #########################################################
+-### Clean
+-#########################################################
+-
+-print('Cleaning up stale installed files....')
+-t = time.time()
+-from sage_setup.clean import clean_install_dir
+-output_dirs = SITE_PACKAGES + glob.glob(os.path.join(SAGE_SRC, 'build', 'lib*'))
+-for output_dir in output_dirs:
+-    print('- cleaning {0}'.format(output_dir))
+-    clean_install_dir(output_dir, python_packages, python_modules,
+-            ext_modules, python_data_files)
+-print('Finished cleaning, time: %.2f seconds.' % (time.time() - t))
+-
+-
+-#########################################################
+ ### Install also Jupyter kernel spec
+ #########################################################
+ 

Copied: sagemath/repos/community-staging-x86_64/cython-sys-path.patch (from rev 188529, sagemath/trunk/cython-sys-path.patch)
===================================================================
--- community-staging-x86_64/cython-sys-path.patch	                        (rev 0)
+++ community-staging-x86_64/cython-sys-path.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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
+@@ -591,6 +591,7 @@
+         build_dir=SAGE_CYTHONIZED,
+         force=force,
+         aliases=aliases,
++        include_path=sys.path,
+         compiler_directives={
+             'embedsignature': True,
+             'profile': profile,

Copied: sagemath/repos/community-staging-x86_64/disable-fes.patch (from rev 188529, sagemath/trunk/disable-fes.patch)
===================================================================
--- community-staging-x86_64/disable-fes.patch	                        (rev 0)
+++ community-staging-x86_64/disable-fes.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/ecm-7.patch)
===================================================================
--- community-staging-x86_64/ecm-7.patch	                        (rev 0)
+++ community-staging-x86_64/ecm-7.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/env.patch)
===================================================================
--- community-staging-x86_64/env.patch	                        (rev 0)
+++ community-staging-x86_64/env.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,118 @@
+--- 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"
+ 
+ # Don't execute the commands more than once for the same version of
+ # sage-env.  Check this after checking the validity of SAGE_ROOT, but
+@@ -245,21 +211,13 @@
+ fi
+ 
+ # Setting Sage-related location environment variables.
+-export SAGE_LOCAL="$SAGE_ROOT/local"
+-export SAGE_ETC="$SAGE_LOCAL/etc"
+-export SAGE_SHARE="$SAGE_LOCAL/share"
+-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_DOC="$SAGE_SHARE/doc/sage"
+-
+-if [ -z "${SAGE_ORIG_PATH_SET}" ]; then 
+-    SAGE_ORIG_PATH=$PATH && export SAGE_ORIG_PATH 
+-    SAGE_ORIG_PATH_SET=True && export SAGE_ORIG_PATH_SET 
+-fi 
+-export PATH="$SAGE_ROOT/build/bin:$SAGE_SRC/bin:$SAGE_LOCAL/bin:$PATH"
++export SAGE_LOCAL="$SAGE_ROOT"
++export SAGE_ETC="/etc/sage"
++export SAGE_SHARE="$SAGE_LOCAL/share/sage"
++export SAGE_EXTCODE="$SAGE_SHARE/ext"
++export SAGE_SRC="$SAGE_SHARE/source"
++export SAGE_DOC_SRC="/usr/share/doc/sage"
++export SAGE_DOC="/usr/share/doc/sage"
+ 
+ if [ "$SAGE_BANNER" = "bare" ]; then
+     export SAGE_BANNER_TEXT=$(cat "$SAGE_ROOT/VERSION.txt")
+@@ -319,9 +277,6 @@
+ GPHELP="$SAGE_LOCAL/bin/gphelp" && export GPHELP
+ GPDOCDIR="$SAGE_LOCAL/share/pari/doc" && export GPDOCDIR
+ 
+-SINGULARPATH="$SAGE_LOCAL/share/singular" && export SINGULARPATH
+-SINGULAR_EXECUTABLE="$SAGE_LOCAL/bin/Singular" && export SINGULAR_EXECUTABLE
+-
+ if [ -z "$SAGE_REPO_ANONYMOUS" ]; then
+     SAGE_REPO_ANONYMOUS="git://trac.sagemath.org/sage.git"
+     export SAGE_REPO_ANONYMOUS
+@@ -364,10 +319,10 @@
+     export SAGE_STARTUP_FILE
+ fi
+ 
++export LIBMTX="$DOT_SAGE/meataxe"
++[[ -d $LIBMTX ]] || mkdir $LIBMTX # Create meataxe data dir
++
+-IPYTHONDIR=`find "$SAGE_SPKG_INST" -name "ipython*"`
+-if [ -n "$IPYTHONDIR" ]; then
+-    export IPYTHONDIR="$DOT_SAGE/${IPYTHONDIR##*/}"
+-fi
++export IPYTHONDIR="$DOT_SAGE/ipython"
+ 
+ if [ "$PYTHON_EGG_CACHE" = "" ]; then
+     PYTHON_EGG_CACHE="$DOT_SAGE/.python-eggs"
+@@ -453,8 +400,6 @@
+         fi
+     fi
+ fi
+-MAXIMA_PREFIX="$SAGE_ROOT/local" && export MAXIMA_PREFIX
+-
+ PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
+ 
+ ############ architecture flags
+@@ -622,9 +567,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 188529, sagemath/trunk/increase-rtol.patch)
===================================================================
--- community-staging-x86_64/increase-rtol.patch	                        (rev 0)
+++ community-staging-x86_64/increase-rtol.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/is-package-installed.patch)
===================================================================
--- community-staging-x86_64/is-package-installed.patch	                        (rev 0)
+++ community-staging-x86_64/is-package-installed.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,387 @@
+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
+ 
+@@ -828,7 +827,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:
+@@ -1677,7 +1676,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
+@@ -7856,7 +7856,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 " +
+@@ -7874,10 +7873,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)
+@@ -20251,17 +20252,22 @@ class GenericGraph(GenericGraph_pyx):
+             Subgroup of (Permutation Group with generators [(0,7)(1,4)(2,3)(6,8)]) generated by [(0,7)(1,4)(2,3)(6,8)]]
+ 
+         """
+-        from sage.misc.package import is_package_installed
++        has_bliss=True
++        try:
++            from sage.graphs.bliss import automorphism_group
++        except ImportError:
++            has_bliss=False
++
+         if (algorithm == 'bliss'           or   # explicit choice from the user; or
+             (algorithm is None             and  # by default
+              not edge_labels               and
+-             is_package_installed('bliss'))):
++             has_bliss)):
++
++            if (not has_bliss):
++                raise NotImplementedError("you need to install bliss or set algorithm=sage to use this command")
++
+             if edge_labels:
+                 raise ValueError("bliss cannot be used when edge_labels is True")
+-            try:
+-                from sage.graphs.bliss import automorphism_group
+-            except ImportError:
+-                raise ImportError("You must install the 'bliss' package to run this command.")
+ 
+             A = automorphism_group(self, partition)
+ 
+@@ -20903,17 +20909,22 @@ class GenericGraph(GenericGraph_pyx):
+             True
+ 
+         """
+-        from sage.misc.package import is_package_installed
++        has_bliss=True
++        try:
++            from sage.graphs.bliss import canonical_form
++        except ImportError:
++            has_bliss=False
++
+         if (algorithm == 'bliss'           or  # explicit request; or
+             (algorithm is None             and # default choice
+-             is_package_installed('bliss') and
++	     has_bliss                     and
+              not edge_labels)):
++
++            if (not has_bliss):
++                raise NotImplementedError("you need to install bliss or set algorithm=sage to use this command")
++
+             if edge_labels:
+                 raise ValueError("bliss cannot be used when edge_labels is True")
+-            try:
+-                from sage.graphs.bliss import canonical_form
+-            except ImportError:
+-                raise ImportError("You must install the 'bliss' package to run this command.")
+             return canonical_form(self, partition, return_graph, certify)
+ 
+         if (algorithm is not None and
+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
+@@ -1396,15 +1396,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, "gap", "latest", "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)):
+@@ -1683,9 +1680,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):
+         """
+@@ -1736,9 +1731,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):
+         """
+@@ -4114,8 +4107,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,11 +53,6 @@ from fpickle import pickle_function, unpickle_function
+ 
+ from .dist import install_scripts
+ 
+-from .package import (install_package,
+-        installed_packages, is_package_installed,
+-        standard_packages, optional_packages, experimental_packages,
+-        upgrade, 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
+@@ -159,7 +159,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
+ 
+@@ -1429,10 +1428,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 188529, sagemath/trunk/jupyter-path.patch)
===================================================================
--- community-staging-x86_64/jupyter-path.patch	                        (rev 0)
+++ community-staging-x86_64/jupyter-path.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,31 @@
+--- 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):
+
+@@ -151,7 +151,7 @@
+              '{connection_file}']
+         """
+         return [
+-            os.path.join(SAGE_ROOT, 'sage'),
++            os.path.join(SAGE_ROOT, 'bin', 'sage'),
+             '--python',
+             '-m', 'sage.repl.ipython_kernel',
+             '-f', '{connection_file}',
+@@ -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/linbox-1.4.patch (from rev 188529, sagemath/trunk/linbox-1.4.patch)
===================================================================
--- community-staging-x86_64/linbox-1.4.patch	                        (rev 0)
+++ community-staging-x86_64/linbox-1.4.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,470 @@
+diff --git a/src/module_list.py b/src/module_list.py
+index a49ed36..7798cb8 100644
+--- a/src/module_list.py
++++ b/src/module_list.py
+@@ -27,6 +27,18 @@ lapack_libs = list(lapack_pc['libraries'])
+ lapack_library_dirs = list(lapack_pc['library_dirs'])
+ lapack_include_dirs = list(lapack_pc['include_dirs'])
+ 
++# FFLAS-FFPACK
++fflas_ffpack_pc = pkgconfig.parse('fflas-ffpack')
++fflas_ffpack_libs = list(fflas_ffpack_pc['libraries'])
++fflas_ffpack_library_dirs = list(fflas_ffpack_pc['library_dirs'])
++fflas_ffpack_cflags = pkgconfig.cflags('fflas-ffpack').split()
++
++# Givaro
++givaro_pc = pkgconfig.parse('givaro')
++givaro_libs = list(givaro_pc['libraries'])
++givaro_library_dirs = list(givaro_pc['library_dirs'])
++givaro_cflags = pkgconfig.cflags('givaro').split()
++
+ # GNU Scientific Library
+ # Note we replace the built-in gslcblas with the above cblas
+ gsl_pc = pkgconfig.parse('gsl')
+@@ -40,6 +52,12 @@ gd_libs = list(gd_pc['libraries'])
+ gd_library_dirs = list(gd_pc['library_dirs'])
+ gd_include_dirs = list(gd_pc['include_dirs'])
+ 
++# LinBox
++linbox_pc = pkgconfig.parse('linbox')
++linbox_libs = list(linbox_pc['libraries'])
++linbox_library_dirs = list(linbox_pc['library_dirs'])
++linbox_cflags = pkgconfig.cflags('linbox').split()
++
+ # PNG image library
+ png_pc = pkgconfig.parse('libpng')
+ png_libs = list(png_pc['libraries'])
+@@ -58,9 +76,18 @@ zlib_include_dirs = list(zlib_pc['include_dirs'])
+ #########################################################
+ 
+ aliases = dict(
++    FFLASFFPACK_CFLAGS=fflas_ffpack_cflags,
++    FFLASFFPACK_LIBRARIES=fflas_ffpack_libs,
++    FFLASFFPACK_LIBDIR=fflas_ffpack_library_dirs,
++    GIVARO_CFLAGS=givaro_cflags,
++    GIVARO_LIBRARIES=givaro_libs,
++    GIVARO_LIBDIR=givaro_library_dirs,
+     GSL_LIBRARIES=gsl_libs,
+     GSL_LIBDIR=gsl_library_dirs,
+     GSL_INCDIR=gsl_include_dirs,
++    LINBOX_CFLAGS=linbox_cflags,
++    LINBOX_LIBRARIES=linbox_libs,
++    LINBOX_LIBDIR=linbox_library_dirs,
+ )
+ 
+ #########################################################
+@@ -91,12 +118,6 @@ except ValueError:
+ singular_libs = ['singular', 'flint', 'ntl', 'gmpxx', 'gmp', 'readline', 'm']
+ 
+ #########################################################
+-### Givaro flags
+-#########################################################
+-
+-givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS']
+-
+-#########################################################
+ ### Library order
+ #########################################################
+ 
+@@ -111,8 +132,7 @@ givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS']
+ # at the very end of the list.
+ library_order_list = [
+     "singular", "ec", "ecm",
+-    "linboxsage", "ntl", "iml", "linbox", "givaro",
+-] + gsl_libs + [
++] + linbox_libs  + gsl_libs + [
+     "pari", "flint", "ratpoints", "ecl", "glpk", "ppl",
+     "arb", "fplll", "mpfi", "mpfr", "mpc", "gmp", "gmpxx",
+     "brial",
+@@ -611,13 +631,10 @@ ext_modules = [
+ 
+     Extension('sage.libs.linbox.linbox',
+               sources = ['sage/libs/linbox/linbox.pyx'],
+-              libraries = ['linboxsage', 'ntl', 'iml', 'linbox',
+-                           'givaro', 'mpfr', 'gmp', 'gmpxx'] + cblas_libs,
++              libraries = linbox_libs,
+               language = 'c++',
+               library_dirs = cblas_library_dirs,
+-              include_dirs = cblas_include_dirs,
+-              extra_compile_args = givaro_extra_compile_args,
+-              depends = [os.path.join(SAGE_INC, 'givaro', 'givconfig.h')]),
++              include_dirs = cblas_include_dirs),
+ 
+     Extension('sage.libs.lcalc.lcalc_Lfunction',
+               sources = ['sage/libs/lcalc/lcalc_Lfunction.pyx'],
+@@ -665,9 +682,8 @@ ext_modules = [
+ 
+     Extension('sage.libs.singular.singular',
+               sources = ['sage/libs/singular/singular.pyx'],
+-              libraries = ['givaro'] + singular_libs,
+-              language="c++",
+-              extra_compile_args = givaro_extra_compile_args),
++              libraries = singular_libs,
++              language="c++"),
+ 
+     Extension('sage.libs.singular.polynomial',
+               sources = ['sage/libs/singular/polynomial.pyx'],
+@@ -687,8 +703,7 @@ ext_modules = [
+     Extension('sage.libs.singular.function',
+               sources = ['sage/libs/singular/function.pyx'],
+               libraries = singular_libs,
+-              language="c++",
+-              extra_compile_args = givaro_extra_compile_args),
++              language="c++"),
+ 
+     Extension('sage.libs.singular.option',
+               sources = ['sage/libs/singular/option.pyx'],
+@@ -944,19 +959,17 @@ ext_modules = [
+     Extension('sage.matrix.matrix_modn_dense_float',
+               sources = ['sage/matrix/matrix_modn_dense_float.pyx'],
+               language="c++",
+-              libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs,
++              libraries = linbox_libs + cblas_libs,
+               library_dirs = cblas_library_dirs,
+-              include_dirs = cblas_include_dirs,
+-              extra_compile_args = nocxx11_args + ['-DDISABLE_COMMENTATOR'] + givaro_extra_compile_args),
++              include_dirs = cblas_include_dirs),
+ 
+     Extension('sage.matrix.matrix_modn_dense_double',
+               sources = ['sage/matrix/matrix_modn_dense_double.pyx'],
+               language="c++",
+-              libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs,
++              libraries = linbox_libs + cblas_libs,
+               library_dirs = cblas_library_dirs,
+               include_dirs = cblas_include_dirs,
+-              extra_compile_args = nocxx11_args + ["-D_XPG6", "-DDISABLE_COMMENTATOR"]
+-                    + m4ri_extra_compile_args + givaro_extra_compile_args),
++              extra_compile_args = ["-D_XPG6"]),
+ 
+     Extension('sage.matrix.matrix_modn_sparse',
+               sources = ['sage/matrix/matrix_modn_sparse.pyx']),
+@@ -1400,8 +1413,7 @@ ext_modules = [
+     Extension('sage.rings.finite_rings.element_givaro',
+               sources = ["sage/rings/finite_rings/element_givaro.pyx"],
+               libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'],
+-              language='c++',
+-              extra_compile_args = givaro_extra_compile_args),
++              language='c++'),
+ 
+     Extension('sage.rings.finite_rings.element_ntl_gf2e',
+               sources = ['sage/rings/finite_rings/element_ntl_gf2e.pyx'],
+@@ -1421,8 +1433,7 @@ ext_modules = [
+               sources = ["sage/rings/finite_rings/hom_finite_field_givaro.pyx"],
+               # this order is needed to compile under windows.
+               libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'],
+-              language='c++',
+-              extra_compile_args = givaro_extra_compile_args),
++              language='c++'),
+ 
+     ################################
+     ##
+@@ -1574,8 +1585,7 @@ ext_modules = [
+     Extension('sage.rings.polynomial.plural',
+               sources = ['sage/rings/polynomial/plural.pyx'],
+               libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'],
+-              language="c++",
+-              extra_compile_args = givaro_extra_compile_args),
++              language="c++"),
+ 
+     Extension('sage.rings.polynomial.multi_polynomial_libsingular',
+               sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'],
+diff --git a/src/sage/libs/linbox/echelonform.pxd b/src/sage/libs/linbox/echelonform.pxd
+index 3097c8b..cf4902d 100644
+--- a/src/sage/libs/linbox/echelonform.pxd
++++ b/src/sage/libs/linbox/echelonform.pxd
+@@ -1,23 +1,27 @@
++# distutils: extra_compile_args = LINBOX_CFLAGS
++# distutils: libraries = LINBOX_LIBRARIES
++# distutils: library_dirs = LINBOX_LIBDIR
++
+ from sage.libs.linbox.modular cimport ModDoubleField, ModDoubleFieldElement, ModFloatField, ModFloatFieldElement
+ from libc.stdint cimport uint64_t
+ 
+-cdef extern from "linbox/matrix/blas-matrix.h" namespace "LinBox":
+-    cdef cppclass BlasMatrixDouble "LinBox::BlasMatrix<LinBox::Modular<double> >":
++cdef extern from "linbox/matrix/dense-matrix.h" namespace "LinBox":
++    cdef cppclass BlasMatrixDouble "LinBox::DenseMatrix<Givaro::Modular<double> >":
+         BlasMatrixDouble(ModDoubleField F, uint64_t nrows, uint64_t ncols)
+         void setEntry(size_t i, size_t j, ModDoubleFieldElement t)
+         ModDoubleFieldElement &getEntry(size_t i, size_t j)
+ 
+-    cdef cppclass BlasMatrixFloat "LinBox::BlasMatrix<LinBox::Modular<float> >":
++    cdef cppclass BlasMatrixFloat "LinBox::DenseMatrix<Givaro::Modular<float> >":
+         BlasMatrixFloat(ModFloatField F, uint64_t nrows, uint64_t ncols)
+         void setEntry(size_t i, size_t j, ModFloatFieldElement t)
+         ModFloatFieldElement &getEntry(size_t i, size_t j)
+ 
+ cdef extern from "linbox/algorithms/echelon-form.h":
+-    cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<LinBox::Modular<double> >":
++    cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<Givaro::Modular<double> >":
+         EchelonFormDomainDouble(ModDoubleField)
+         int rowReducedEchelon(BlasMatrixDouble, BlasMatrixDouble)
+ 
+-    cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<LinBox::Modular<float> >":
++    cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<Givaro::Modular<float> >":
+         EchelonFormDomainFloat(ModFloatField)
+         int rowReducedEchelon(BlasMatrixFloat, BlasMatrixFloat)
+ 
+diff --git a/src/sage/libs/linbox/fflas.pxd b/src/sage/libs/linbox/fflas.pxd
+index e102004..01ab1b1 100644
+--- a/src/sage/libs/linbox/fflas.pxd
++++ b/src/sage/libs/linbox/fflas.pxd
+@@ -1,3 +1,7 @@
++# distutils: extra_compile_args = FFLASFFPACK_CFLAGS
++# distutils: libraries = FFLASFFPACK_LIBRARIES
++# distutils: library_dirs = FFLASFFPACK_LIBDIR
++
+ from .modular cimport ModDoubleField, ModFloatField, ModDoubleFieldElement, ModFloatFieldElement
+ 
+ cdef extern from "fflas-ffpack/fflas-ffpack.h" namespace "std":
+diff --git a/src/sage/libs/linbox/linbox.pyx b/src/sage/libs/linbox/linbox.pyx
+index e932347..a9bd6d1 100644
+--- a/src/sage/libs/linbox/linbox.pyx
++++ b/src/sage/libs/linbox/linbox.pyx
+@@ -1,3 +1,7 @@
++# distutils: extra_compile_args = LINBOX_CFLAGS
++# distutils: libraries = LINBOX_LIBRARIES
++# distutils: library_dirs = LINBOX_LIBDIR
++
+ r"""
+ Linbox interface
+ """
+diff --git a/src/sage/libs/linbox/modular.pxd b/src/sage/libs/linbox/modular.pxd
+index 7ef204c..ea5fb29 100644
+--- a/src/sage/libs/linbox/modular.pxd
++++ b/src/sage/libs/linbox/modular.pxd
+@@ -1,10 +1,10 @@
+-cdef extern from "linbox/field/modular.h":
++cdef extern from "givaro/modular.h":
+     # double
+ 
+-    cdef cppclass ModDoubleFieldElement "LinBox::Modular<double>::Element":
++    cdef cppclass ModDoubleFieldElement "Givaro::Modular<double>::Element":
+         pass
+ 
+-    cdef cppclass ModDoubleField "LinBox::Modular<double>":
++    cdef cppclass ModDoubleField "Givaro::Modular<double>":
+         ModDoubleField(int modulus)
+         ModDoubleFieldElement init(ModDoubleFieldElement res, int v)
+         ModDoubleFieldElement init(ModDoubleFieldElement res, double v)
+@@ -20,10 +20,10 @@ cdef extern from "linbox/field/modular.h":
+ 
+ 
+     # float
+-    cdef cppclass ModFloatFieldElement "LinBox::Modular<float>::Element":
++    cdef cppclass ModFloatFieldElement "Givaro::Modular<float>::Element":
+         pass
+ 
+-    cdef cppclass ModFloatField "LinBox::Modular<float>":
++    cdef cppclass ModFloatField "Givaro::Modular<float>":
+         ModFloatField(int modulus)
+         ModFloatFieldElement init(ModFloatFieldElement res, int v)
+         ModFloatFieldElement init(ModFloatFieldElement res, double v)
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index 33d7f7ec..77f6e0a 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -23,6 +23,7 @@ cdef extern from "limits.h":
+ 
+ import os
+ 
++from libc.stdint cimport int64_t
+ from sage.libs.singular.decl cimport intvec
+ from sage.libs.singular.decl cimport SR_HDL, SR_INT, SR_TO_INT
+ from sage.libs.singular.decl cimport singular_options, singular_verbose_options
+@@ -156,7 +157,7 @@ cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache):
+     order = cache.objectptr.cardinality() - 1
+ 
+     while z:
+-        c = cache.objectptr.initi(c, <long>napGetCoeff(z))
++        c = cache.objectptr.initi(c, <int64_t>napGetCoeff(z))
+         e = napGetExpFrom(z,1, _ring)
+         if e == 0:
+             ret = cache.objectptr.add(ret, c, ret)
+diff --git a/src/sage/rings/finite_rings/element_givaro.pxd b/src/sage/rings/finite_rings/element_givaro.pxd
+index 68def46..91c4ed7 100644
+--- a/src/sage/rings/finite_rings/element_givaro.pxd
++++ b/src/sage/rings/finite_rings/element_givaro.pxd
+@@ -1,9 +1,15 @@
+-from sage.structure.element cimport Element, RingElement, ModuleElement
+-from sage.rings.finite_rings.element_base cimport FinitePolyExtElement
++# distutils: extra_compile_args = GIVARO_CFLAGS
++
++from libcpp.vector cimport vector
++ctypedef vector[int] intvec
++
++from libc.stdint cimport int64_t
+ 
+-from sage.structure.parent  cimport Parent
++from sage.rings.finite_rings.element_base cimport FinitePolyExtElement
++from sage.structure.parent cimport Parent
+ from sage.structure.sage_object cimport SageObject
+ 
++
+ cdef extern from "givaro/givconfig.h":
+     pass
+ 
+@@ -13,16 +19,7 @@ cdef extern from "givaro/givrandom.h":
+ 
+     GivRandom GivRandomSeeded  "Givaro::GivRandom"(unsigned long seed)
+ 
+-cdef extern from "givaro/givgfq.h":
+-    ctypedef struct intvec "std::vector<unsigned int>":
+-        void (* push_back)(int elem)
+-
+-    ctypedef struct constintvec "const std::vector<unsigned int>"
+-
+-    intvec intvec_factory "std::vector<unsigned int>"(int len)
+-
+-cdef extern from "givaro/givgfq.h":
+-
++cdef extern from "givaro/gfq.h":
+     ctypedef struct GivaroGfq "Givaro::GFqDom<int>":
+         #attributes
+         unsigned int one
+@@ -40,10 +37,10 @@ cdef extern from "givaro/givgfq.h":
+         unsigned int (* cardinality)()
+         int (* exponent)()
+         int (* random)(GivRandom gen, int res)
+-        int (* initi "init")(int res, int e)
++        int (* initi "init")(int res, int64_t e)
+         int (* initd "init")(int res, double e)
+         int (* indeterminate)()
+-        int (* convert)(int r, int p)
++        int (* convert)(int64_t r, int p)
+         int (* read)(int r, int p)
+         int (* axpyin)(int r, int a, int x)
+         int (* axpy)(int r, int a, int b, int c)
+@@ -60,7 +57,12 @@ cdef extern from "givaro/givgfq.h":
+     void delete "delete "(void *o)
+     int gfq_element_factory "Givaro::GFqDom<int>::Element"()
+ 
+-cdef class FiniteField_givaroElement(FinitePolyExtElement) #forward declaration
++
++cdef class FiniteField_givaroElement(FinitePolyExtElement):
++    cdef int element
++    cdef Cache_givaro _cache
++    cdef object _multiplicative_order
++    cdef FiniteField_givaroElement _new_c(self, int value)
+ 
+ cdef class Cache_givaro(SageObject):
+     cdef GivaroGfq *objectptr # C++ object
+@@ -85,11 +87,4 @@ cdef class FiniteField_givaro_iterator:
+     cdef int iterator
+     cdef Cache_givaro _cache
+ 
+-cdef class FiniteField_givaroElement(FinitePolyExtElement):
+-    cdef int element
+-    cdef Cache_givaro _cache
+-    cdef object _multiplicative_order
+-    cdef FiniteField_givaroElement _new_c(self, int value)
+-
+-
+ cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x)
+diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx
+index d32b5cf..f2afa44 100644
+--- a/src/sage/rings/finite_rings/element_givaro.pyx
++++ b/src/sage/rings/finite_rings/element_givaro.pyx
+@@ -59,8 +59,9 @@ from sage.misc.randstate cimport randstate, current_randstate
+ from sage.rings.finite_rings.finite_field_base cimport FiniteField
+ from sage.rings.ring cimport Ring
+ from element_ext_pari import FiniteField_ext_pariElement
+-from element_pari_ffelt import FiniteFieldElement_pari_ffelt
++from element_pari_ffelt cimport FiniteFieldElement_pari_ffelt
+ from sage.structure.sage_object cimport SageObject
++from sage.structure.element cimport Element, ModuleElement, RingElement
+ import operator
+ import sage.arith.all
+ import finite_field_constructor as finite_field
+@@ -374,18 +375,16 @@ cdef class Cache_givaro(SageObject):
+         elif isinstance(e, int) or \
+              isinstance(e, Integer) or \
+              isinstance(e, long) or is_IntegerMod(e):
+-            try:
+-                e_int = e
+-            except OverflowError:
+-                e_int = e % self.characteristic()
++            e_int = e % self.characteristic()
+             res = self.objectptr.initi(res, e_int)
+ 
+         elif e is None:
+             e_int = 0
+-            res = self.objectptr.initi(res,e_int)
++            res = self.objectptr.initi(res, e_int)
+ 
+         elif isinstance(e, float):
+-            res = self.objectptr.initd(res,e)
++            e_int = int(e) % self.characteristic()
++            res = self.objectptr.initd(res, e_int)
+ 
+         elif isinstance(e, str):
+             return self.parent(eval(e.replace("^","**"),self.parent.gens_dict()))
+@@ -395,8 +394,8 @@ cdef class Cache_givaro(SageObject):
+                 raise TypeError("e.parent must match self.vector_space")
+             ret = self._zero_element
+             for i in range(len(e)):
+-                e_entry = e[i] % self.characteristic()
+-                res = self.objectptr.initi(res, int(e_entry))
++                e_int = e[i] % self.characteristic()
++                res = self.objectptr.initi(res, e_int)
+                 to_add = make_FiniteField_givaroElement(self, res)
+                 ret = ret + to_add*self.parent.gen()**i
+             return ret
+@@ -435,8 +434,8 @@ cdef class Cache_givaro(SageObject):
+                 raise ValueError("list is too long")
+             ret = self._zero_element
+             for i in range(len(e)):
+-                e_entry = e[i] % self.characteristic()
+-                res = self.objectptr.initi(res, int(e_entry))
++                e_int = e[i] % self.characteristic()
++                res = self.objectptr.initi(res, e_int)
+                 to_add = make_FiniteField_givaroElement(self, res)
+                 ret = ret + to_add*self.parent.gen()**i
+             return ret
+@@ -573,19 +572,17 @@ cdef class Cache_givaro(SageObject):
+         cdef int ret = k.zero
+         cdef int a = k.indeterminate()
+         cdef int at = k.one
+-        cdef unsigned int ch = k.characteristic()
+-        cdef int _n, t, i
++        cdef int ch = k.characteristic()
++        cdef int t, i
+ 
+         if n<0 or n>k.cardinality():
+             raise TypeError("n must be between 0 and self.order()")
+ 
+-        _n = n
+-
+         for i from 0 <= i < k.exponent():
+-            t = k.initi(t, _n%ch)
++            t = k.initi(t, n % ch)
+             ret = k.axpy(ret, t, at, ret)
+             at = k.mul(at,at,a)
+-            _n = _n/ch
++            n //= ch
+         return make_FiniteField_givaroElement(self, ret)
+ 
+     def _element_repr(self, FiniteField_givaroElement e):
+diff --git a/src/sage/rings/finite_rings/finite_field_givaro.py b/src/sage/rings/finite_rings/finite_field_givaro.py
+index adbaab3..c431f6d 100644
+--- a/src/sage/rings/finite_rings/finite_field_givaro.py
++++ b/src/sage/rings/finite_rings/finite_field_givaro.py
+@@ -270,7 +270,8 @@ class FiniteField_givaro(FiniteField):
+             sage: k(2) # indirect doctest
+             0
+ 
+-            Floats coerce in:
++        Floats are converted like integers::
++
+             sage: k(float(2.0))
+             0
+ 
+@@ -344,7 +345,7 @@ class FiniteField_givaro(FiniteField):
+             sage: k(pari('Mod(1,2)'))
+             1
+             sage: k(pari('Mod(2,3)'))
+-            0
++            a
+             sage: k(pari('Mod(1,3)*a^20'))
+             a^7 + a^5 + a^4 + a^2
+ 

Copied: sagemath/repos/community-staging-x86_64/package.patch (from rev 188529, sagemath/trunk/package.patch)
===================================================================
--- community-staging-x86_64/package.patch	                        (rev 0)
+++ community-staging-x86_64/package.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,11 @@
+--- 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
+@@ -204,7 +204,7 @@
+     Otherwise, installing "pillow" will cause this function to think
+     that "pil" is installed, for example.
+     """
+-    return any(p.split('-')[0] == package for p in installed_packages())
++    return True
+ 
+ def package_versions(package_type, local=False):
+     r"""

Copied: sagemath/repos/community-staging-x86_64/paths.patch (from rev 188529, sagemath/trunk/paths.patch)
===================================================================
--- community-staging-x86_64/paths.patch	                        (rev 0)
+++ community-staging-x86_64/paths.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,13 @@
+--- src/sage/env.py.orig	2014-06-25 10:47:25.827203554 +1200
++++ src/sage/env.py	2014-06-25 10:49:07.667402821 +1200
+@@ -90,8 +90,8 @@
+ 
+ # bunch of sage directories and files
+ _add_variable_or_fallback('SAGE_ROOT',       None)
+-_add_variable_or_fallback('SAGE_LOCAL',      opj('$SAGE_ROOT', 'local'))
+-_add_variable_or_fallback('SAGE_ETC',        opj('$SAGE_LOCAL', 'etc'))
++_add_variable_or_fallback('SAGE_LOCAL',      '/usr')
++_add_variable_or_fallback('SAGE_ETC',        '/etc/sage')
+ _add_variable_or_fallback('SAGE_INC',        opj('$SAGE_LOCAL', 'include'))
+ _add_variable_or_fallback('SAGE_SHARE',      opj('$SAGE_LOCAL', 'share'))
+ 

Copied: sagemath/repos/community-staging-x86_64/python-2.7.11.patch (from rev 188529, sagemath/trunk/python-2.7.11.patch)
===================================================================
--- community-staging-x86_64/python-2.7.11.patch	                        (rev 0)
+++ community-staging-x86_64/python-2.7.11.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,11 @@
+--- src/sage/misc/sage_timeit.py.orig	2015-12-19 11:09:42.836938821 +0100
++++ src/sage/misc/sage_timeit.py	2015-12-19 11:10:27.090217304 +0100
+@@ -217,7 +217,7 @@
+     # but is there a better way to achieve that the code stmt has access
+     # to the shell namespace?
+ 
+-    src = timeit_.template % {'stmt': timeit_.reindent(stmt, 8),
++    src = timeit_.template % {'init': "", 'stmt': timeit_.reindent(stmt, 8),
+                              'setup': "pass"}
+     code = compile(src, "<magic-timeit>", "exec")
+     ns = {}

Copied: sagemath/repos/community-staging-x86_64/sagemath-ipython5.patch (from rev 188529, sagemath/trunk/sagemath-ipython5.patch)
===================================================================
--- community-staging-x86_64/sagemath-ipython5.patch	                        (rev 0)
+++ community-staging-x86_64/sagemath-ipython5.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,548 @@
+diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
+index 2654016..d3daed6 100644
+--- a/src/sage/doctest/forker.py
++++ b/src/sage/doctest/forker.py
+@@ -116,10 +116,6 @@ def init_sage():
+     from sage.structure.debug_options import debug
+     debug.refine_category_hash_check = True
+ 
+-    # Disable IPython colors during doctests
+-    from sage.repl.interpreter import DEFAULT_SAGE_CONFIG
+-    DEFAULT_SAGE_CONFIG.TerminalInteractiveShell.colors = 'NoColor'
+-
+     # We import readline before forking, otherwise Pdb doesn't work
+     # os OS X: http://trac.sagemath.org/14289
+     import readline
+@@ -1088,15 +1084,13 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             sage: _ = sage0.eval("import doctest, sys, os, multiprocessing, subprocess")
+             sage: _ = sage0.eval("from sage.doctest.parsing import SageOutputChecker")
+             sage: _ = sage0.eval("import sage.doctest.forker as sdf")
+-            sage: _ = sage0.eval("sdf.init_sage()")
+             sage: _ = sage0.eval("from sage.doctest.control import DocTestDefaults")
+             sage: _ = sage0.eval("DD = DocTestDefaults(debug=True)")
+             sage: _ = sage0.eval("ex1 = doctest.Example('a = 17', '')")
+             sage: _ = sage0.eval("ex2 = doctest.Example('2*a', '1')")
+             sage: _ = sage0.eval("DT = doctest.DocTest([ex1,ex2], globals(), 'doubling', None, 0, None)")
+             sage: _ = sage0.eval("DTR = sdf.SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)")
+-            sage: sage0._prompt = r"debug: "
+-            sage: print(sage0.eval("DTR.run(DT, clear_globs=False)")) # indirect doctest
++            sage: print(sage0.eval("sdf.init_sage(); DTR.run(DT, clear_globs=False)")) # indirect doctest
+             **********************************************************************
+             Line 1, in doubling
+             Failed example:
+@@ -1110,7 +1104,6 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             ...
+             sage: sage0.eval("a")
+             '...17'
+-            sage: sage0._prompt = "sage: "
+             sage: sage0.eval("quit")
+             'Returning to doctests...TestResults(failed=1, attempted=2)'
+         """
+@@ -1144,13 +1137,14 @@ class SageDocTestRunner(doctest.DocTestRunner):
+                         print(src)
+                         if ex.want:
+                             print(doctest._indent(ex.want[:-1]))
+-                    from sage.repl.interpreter import DEFAULT_SAGE_CONFIG
++                    from sage.repl.configuration import sage_ipython_config
++                    from sage.repl.prompts import DebugPrompts
+                     from IPython.terminal.embed import InteractiveShellEmbed
+-                    import copy
+-                    cfg = copy.deepcopy(DEFAULT_SAGE_CONFIG)
+-                    prompt_config = cfg.PromptManager
+-                    prompt_config.in_template = 'debug: '
+-                    prompt_config.in2_template = '.....: '
++                    cfg = sage_ipython_config.default()
++                    # Currently this doesn't work: prompts only work in pty
++                    # We keep simple_prompt=True, prompts will be "In [0]:"
++                    # cfg.InteractiveShell.prompts_class = DebugPrompts
++                    # cfg.InteractiveShell.simple_prompt = False
+                     shell = InteractiveShellEmbed(config=cfg, banner1='', user_ns=dict(globs))
+                     shell(header='', stack_depth=2)
+                 except KeyboardInterrupt:
+@@ -1248,6 +1242,7 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             sage: _ = sage0.eval("ex = doctest.Example('E = EllipticCurve([0,0]); E', 'A singular Elliptic Curve')")
+             sage: _ = sage0.eval("DT = doctest.DocTest([ex], globals(), 'singular_curve', None, 0, None)")
+             sage: _ = sage0.eval("DTR = sdf.SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)")
++            sage: old_prompt = sage0._prompt
+             sage: sage0._prompt = r"\(Pdb\) "
+             sage: sage0.eval("DTR.run(DT, clear_globs=False)") # indirect doctest
+             '... ArithmeticError("invariants " + str(ainvs) + " define a singular curve")'
+@@ -1257,7 +1252,7 @@ class SageDocTestRunner(doctest.DocTestRunner):
+             '...EllipticCurve_field.__init__(self, K, ainvs)'
+             sage: sage0.eval("p ainvs")
+             '(0, 0, 0, 0, 0)'
+-            sage: sage0._prompt = "sage: "
++            sage: sage0._prompt = old_prompt
+             sage: sage0.eval("quit")
+             'TestResults(failed=1, attempted=1)'
+         """
+diff --git a/src/sage/doctest/test.py b/src/sage/doctest/test.py
+index d69136f..a6cc4d0 100644
+--- a/src/sage/doctest/test.py
++++ b/src/sage/doctest/test.py
+@@ -360,7 +360,7 @@ Test the ``--debug`` option::
+         s...: b = 5
+         s...: a + b
+         8
+-    debug:
++    In [1]:
+     <BLANKLINE>
+     Returning to doctests...
+     **********************************************************************
+diff --git a/src/sage/interfaces/sage0.py b/src/sage/interfaces/sage0.py
+index 87bfc0b..77cd151 100644
+--- a/src/sage/interfaces/sage0.py
++++ b/src/sage/interfaces/sage0.py
+@@ -18,6 +18,7 @@ from __future__ import absolute_import
+ 
+ import cPickle
+ import os
++import re
+ 
+ from .expect import Expect, ExpectElement, FunctionElement
+ import sage.repl.preparse
+@@ -146,10 +147,17 @@ class Sage(ExtraTabCompletion, Expect):
+             if init_code is None:
+                 init_code = ['from sage.all import *', 'import cPickle']
+         else:
+-            # Disable the IPython history (implemented as SQLite database)
+-            # to avoid problems with locking.
+-            command = "sage-ipython --HistoryManager.hist_file=:memory: --colors=NoColor"
+-            prompt = "sage: "
++            command = ' '.join([
++                'sage-ipython',
++                # Disable the IPython history (implemented as SQLite database)
++                # to avoid problems with locking.
++                '--HistoryManager.hist_file=:memory:',
++                # Disable everything that prints ANSI codes
++                '--colors=NoColor',
++                '--no-term-title',
++                '--simple-prompt',
++            ])
++            prompt = re.compile('In \[\d+\]: ')
+             if init_code is None:
+                 init_code = ['import cPickle']
+ 
+diff --git a/src/sage/misc/trace.py b/src/sage/misc/trace.py
+index 0da17e7..efcaa33 100644
+--- a/src/sage/misc/trace.py
++++ b/src/sage/misc/trace.py
+@@ -54,6 +54,7 @@ def trace(code, preparse=True):
+         sage: import pexpect
+         sage: s = pexpect.spawn('sage')
+         sage: _ = s.sendline("trace('print(factor(10))'); print(3+97)")
++        sage: _ = s.expect('ipdb>', timeout=90)
+         sage: _ = s.sendline("s"); _ = s.sendline("c");
+         sage: _ = s.expect('100', timeout=90)
+ 
+diff --git a/src/sage/repl/configuration.py b/src/sage/repl/configuration.py
+new file mode 100644
+index 0000000..5034039
+--- /dev/null
++++ b/src/sage/repl/configuration.py
+@@ -0,0 +1,152 @@
++r"""
++Sage's IPython Configuration
++"""
++
++#*****************************************************************************
++#       Copyright (C) 2016 Volker Braun <vbraun.name at gmail.com>
++#
++#  Distributed under the terms of the GNU General Public License (GPL)
++#  as published by the Free Software Foundation; either version 2 of
++#  the License, or (at your option) any later version.
++#                  http://www.gnu.org/licenses/
++#*****************************************************************************
++
++from __future__ import absolute_import
++
++import sys
++import copy
++from traitlets.config.loader import Config
++
++from sage.repl.prompts import SagePrompts
++
++
++# Name of the Sage IPython extension
++SAGE_EXTENSION = 'sage'
++
++
++class SageIpythonConfiguration(object):
++
++    def _doctest_mode(self):
++        """
++        Whether we are in doctest mode
++
++        This returns ``True`` during doctests.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config._doctest_mode()
++            True
++        """
++        from sage.doctest import DOCTEST_MODE
++        return DOCTEST_MODE
++    
++    def _allow_ansi(self):
++        """
++        Whether to allow ANSI escape sequences
++
++        This returns ``False`` during doctests to avoid ANSI escape 
++        sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config._allow_ansi()
++            False
++        """
++        return (not self._doctest_mode()) and sys.stdout.isatty()
++
++    def colors(self):
++        """
++        Return the IPython color palette
++
++        This returns ``'NoColor'`` during doctests to avoid ANSI escape 
++        sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.simple_prompt()
++            True
++        """
++        return 'LightBG' if self._allow_ansi() else 'NoColor'
++
++    def simple_prompt(self):
++        """
++        Return whether to use the simple prompt
++
++        This returns ``True`` during doctests to avoid ANSI escape sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.simple_prompt()
++            True
++        """
++        return not self._allow_ansi()
++
++    def term_title(self):
++        """
++        Return whether to set the terminal title
++
++        This returns false during doctests to avoid ANSI escape sequences.
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.term_title()
++            False
++        """
++        return self._allow_ansi()
++
++    def default(self):
++        """
++        Return a new default configuration object
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.default()
++            {'InteractiveShell': {'colors': ...
++        """
++        from sage.repl.interpreter import SageTerminalInteractiveShell
++        cfg = Config(
++            TerminalIPythonApp=Config(
++                display_banner=False,
++                verbose_crash=True,
++                test_shell=False,
++                shell_class=SageTerminalInteractiveShell,
++            ),
++            InteractiveShell=Config(
++                prompts_class=SagePrompts,
++                ast_node_interactivity='all',
++                colors=self.colors(),
++                simple_prompt=self.simple_prompt(),
++                term_title=self.term_title(),
++                confirm_exit=False,
++                separate_in=''
++            ),
++            InteractiveShellApp=Config(extensions=[SAGE_EXTENSION]),
++        )
++        if self._doctest_mode():
++            # Using the file-backed history causes problems in parallel tests
++            cfg.HistoryManager = Config(hist_file=':memory:')
++        return cfg
++
++    def copy(self):
++        """
++        Return a copy of the current configuration
++
++        EXAMPLES::
++        
++            sage: from sage.repl.configuration import sage_ipython_config
++            sage: sage_ipython_config.copy()
++            {'InteractiveShell': {'colors': ...
++        """
++        try:
++            return copy.deepcopy(get_ipython().config)
++        except NameError:
++            return self.default()
++
++
++sage_ipython_config = SageIpythonConfiguration()
+diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py
+index e0499c7..1f4eda7 100644
+--- a/src/sage/repl/interpreter.py
++++ b/src/sage/repl/interpreter.py
+@@ -102,18 +102,15 @@ Check that Cython source code appears in tracebacks::
+ #*****************************************************************************
+ 
+ 
+-import copy
+ import os
+ import re
+-import sys
+ from sage.repl.preparse import preparse
++from sage.repl.prompts import SagePrompts, InterfacePrompts
+ 
+-from traitlets.config.loader import Config
+ from traitlets import Bool, Type
+ 
+ from sage.env import SAGE_LOCAL
+-
+-SAGE_EXTENSION = 'sage'
++from sage.repl.configuration import sage_ipython_config, SAGE_EXTENSION
+ 
+ def embedded():
+     """
+@@ -370,31 +367,7 @@ class SageTestShell(SageShellOverride, TerminalInteractiveShell):
+         rc = super(SageTestShell, self).run_cell(*args, **kwds)
+ 
+ 
+-###################################################################
+-# Default configuration
+-###################################################################
+-
+-DEFAULT_SAGE_CONFIG = Config(
+-    PromptManager = Config(
+-        in_template = 'sage: ',
+-        in2_template = '....: ',
+-        justify = False,
+-        out_template = ''),
+-    TerminalIPythonApp = Config(
+-        display_banner = False,
+-        verbose_crash = True,
+-        test_shell = False,
+-        shell_class = SageTerminalInteractiveShell,
+-    ),
+-    InteractiveShell = Config(
+-        ast_node_interactivity = 'all',
+-        colors = 'LightBG' if sys.stdout.isatty() else 'NoColor',
+-        confirm_exit = False,
+-        separate_in = ''),
+-    InteractiveShellApp = Config(extensions=[SAGE_EXTENSION]),
+-)
+-
+-
++    
+ ###################################################################
+ # Transformers used in the SageInputSplitter
+ ###################################################################
+@@ -614,19 +587,17 @@ def interface_shell_embed(interface):
+         sage: shell = interface_shell_embed(gap)
+         sage: shell.run_cell('List( [1..10], IsPrime )')
+         [ false, true, true, false, true, false, true, false, false, false ]
+-        <IPython.core.interactiveshell.ExecutionResult object at 0x...>
+-    """
+-    try:
+-        cfg = copy.deepcopy(get_ipython().config)
+-    except NameError:
+-        cfg = copy.deepcopy(DEFAULT_SAGE_CONFIG)
+-    cfg.PromptManager['in_template'] = interface.name() + ': '
+-    cfg.PromptManager['in2_template'] = len(interface.name())*'.' + ': '
++        <repr(<IPython.core.interactiveshell.ExecutionResult at 0x...>) failed: 
++        AttributeError: type object 'ExecutionResult' has no attribute '__qualname__'>
+ 
++    Note that the repr error is https://github.com/ipython/ipython/issues/9756
++    """
++    cfg = sage_ipython_config.copy()
+     ipshell = InteractiveShellEmbed(config=cfg,
+                                     banner1='\n  --> Switching to %s <--\n\n'%interface,
+-                                    exit_msg = '\n  --> Exiting back to Sage <--\n')
++                                    exit_msg='\n  --> Exiting back to Sage <--\n')
+     ipshell.interface = interface
++    ipshell.prompts = InterfacePrompts(interface.name())
+ 
+     while ipshell.prefilter_manager.transformers:
+         ipshell.prefilter_manager.transformers.pop()
+@@ -669,7 +640,7 @@ def get_test_shell():
+         sage: out + err
+         ''
+     """
+-    config = copy.deepcopy(DEFAULT_SAGE_CONFIG)
++    config = sage_ipython_config.default()
+     config.TerminalIPythonApp.test_shell = True
+     config.TerminalIPythonApp.shell_class = SageTestShell
+     app = SageTerminalApp.instance(config=config)
+@@ -748,12 +719,9 @@ class SageTerminalApp(TerminalIPythonApp):
+             sage: os.environ['IPYTHONDIR'] = IPYTHONDIR
+         """
+         super(SageTerminalApp, self).load_config_file(*args, **kwds)
+-
+-        newconfig = copy.deepcopy(DEFAULT_SAGE_CONFIG)
+-
++        newconfig = sage_ipython_config.default()
+         # merge in the config loaded from file
+         newconfig.merge(self.config)
+-
+         self.config = newconfig
+ 
+     def init_shell(self):
+@@ -767,7 +735,7 @@ class SageTerminalApp(TerminalIPythonApp):
+ 
+         EXAMPLES::
+ 
+-            sage: from sage.repl.interpreter import SageTerminalApp, DEFAULT_SAGE_CONFIG
++            sage: from sage.repl.interpreter import SageTerminalApp
+             sage: app = SageTerminalApp.instance()
+             sage: app.shell
+             <sage.repl.interpreter.SageTestShell object at 0x...>
+@@ -776,7 +744,6 @@ class SageTerminalApp(TerminalIPythonApp):
+         self.shell = self.shell_class.instance(
+             parent=self,
+             config=self.config,
+-            display_banner=False,
+             profile_dir=self.profile_dir,
+             ipython_dir=self.ipython_dir)
+         self.shell.configurables.append(self)
+diff --git a/src/sage/repl/ipython_tests.py b/src/sage/repl/ipython_tests.py
+index 0fa568d..2bb34cd 100644
+--- a/src/sage/repl/ipython_tests.py
++++ b/src/sage/repl/ipython_tests.py
+@@ -100,6 +100,12 @@ Next, test the pinfo2 magic for Cython code::
+     ...
+     File:   .../sage/tests/stl_vector.pyx
+     Type:   type
++
++Test that there are no warnings being ignored internally::
++
++    sage: import warnings
++    sage: warnings.simplefilter('error');  get_test_shell()
++    <sage.repl.interpreter.SageTestShell object at 0x...>
+ '''
+ 
+ 
+diff --git a/src/sage/repl/prompts.py b/src/sage/repl/prompts.py
+new file mode 100644
+index 0000000..e885730
+--- /dev/null
++++ b/src/sage/repl/prompts.py
+@@ -0,0 +1,92 @@
++r"""
++Sage Commandline Prompts
++"""
++
++#*****************************************************************************
++#       Copyright (C) 2016 Volker Braun <vbraun.name at gmail.com>
++#
++# This program is free software: you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation, either version 2 of the License, or
++# (at your option) any later version.
++#                  http://www.gnu.org/licenses/
++#*****************************************************************************
++
++from pygments.token import Token
++from IPython.terminal.prompts import Prompts
++
++
++class SagePrompts(Prompts):
++
++    def in_prompt_tokens(self, cli=None):
++        return [
++            (Token.Prompt, 'sage: '),
++        ]
++
++    def continuation_prompt_tokens(self, cli=None, width=None):
++        return [
++            (Token.Prompt, '....: '),
++        ]
++
++    def rewrite_prompt_tokens(self):
++        return [
++            (Token.Prompt, '----> '),
++        ]
++
++    def out_prompt_tokens(self):
++        return [
++            (Token.OutPrompt, ''),
++        ]
++
++    
++class InterfacePrompts(Prompts):
++
++    def __init__(self, interface_name):
++        self.__name = interface_name
++        self.__width = len(interface_name)
++    
++    def in_prompt_tokens(self, cli=None):
++        return [
++            (Token.Prompt, self.__name + ': '),
++        ]
++
++    def continuation_prompt_tokens(self, cli=None, width=None):
++        return [
++            (Token.Prompt, '.' * self.__width + ': '),
++        ]
++
++    def rewrite_prompt_tokens(self):
++        return [
++            (Token.Prompt, '-' * self.__width + '> '),
++        ]
++
++    def out_prompt_tokens(self):
++        return [
++            (Token.OutPrompt, ''),
++        ]
++
++
++class DebugPrompts(Prompts):
++
++    def in_prompt_tokens(self, cli=None):
++        return [
++            (Token.Prompt, 'debug: '),
++        ]
++
++    def continuation_prompt_tokens(self, cli=None, width=None):
++        return [
++            (Token.Prompt, '.....: '),
++        ]
++
++    def rewrite_prompt_tokens(self):
++        return [
++            (Token.Prompt, '-----> '),
++        ]
++
++    def out_prompt_tokens(self):
++        return [
++            (Token.OutPrompt, ''),
++        ]
++
++    
++    
+diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py
+index 0d15d82..417ec5e 100644
+--- a/src/sage/tests/cmdline.py
++++ b/src/sage/tests/cmdline.py
+@@ -385,7 +385,7 @@ def test_executable(args, input="", timeout=100.0, **kwds):
+         **********************************************************************
+         Previously executed commands:
+             s...: assert True == False
+-        debug:
++        In [1]:
+         <BLANKLINE>
+         Returning to doctests...
+         **********************************************************************

Copied: sagemath/repos/community-staging-x86_64/skip-check.patch (from rev 188529, sagemath/trunk/skip-check.patch)
===================================================================
--- community-staging-x86_64/skip-check.patch	                        (rev 0)
+++ community-staging-x86_64/skip-check.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -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 188529, sagemath/trunk/test-optional.patch)
===================================================================
--- community-staging-x86_64/test-optional.patch	                        (rev 0)
+++ community-staging-x86_64/test-optional.patch	2016-09-04 13:25:54 UTC (rev 188530)
@@ -0,0 +1,11 @@
+--- src/sage/doctest/control.py.orig	2015-10-31 09:40:55.173671531 +0100
++++ src/sage/doctest/control.py	2015-10-31 09:40:05.370125436 +0100
+@@ -253,7 +253,7 @@
+                 if 'optional' in options.optional:
+                     options.optional.discard('optional')
+                     from sage.misc.package import package_versions
+-                    optional_pkgs = package_versions("optional", local=True)
++                    optional_pkgs = {}
+                     for pkg, versions in optional_pkgs.items():
+                         if versions[0] == versions[1]:
+                             options.optional.add(pkg)



More information about the arch-commits mailing list