Add proper "except" error return values
Cython depends on setuptools
trac #17156: Creating a graph from a immutable digraph raises an error
trac #17156: Remove a deprecation warning
Merge remote-tracking branch 'origin/develop' into ticket/11945

Conflicts:
	src/sage/graphs/base/static_sparse_backend.pxd
Fix Cython warnings
Fix numerical noise
Trac #17126: Floating-point precision issues fail matrix2.py doctests

This is on the develop branch at version 6.4beta4:

{{{
darij@travis-virtualbox:~/gitsage$ ./sage -bt
src/sage/matrix/matrix2.pyx
scons: `install' is up to date.
Updating Cython code....
Enabling Cython debugging support
Finished Cythonizing, time: 6.46 seconds.
Discovering Python source code....
Discovered Python source, time: 0.03 seconds.
Cleaning up stale installed files....
- cleaning /home/darij/sage-6.3.beta6/local/lib/python2.7/site-packages
- cleaning /home/darij/sage-6.3.beta6/local/lib/site-python
- cleaning /home/darij/sage-6.3.beta6/src/build/lib.linux-i686-2.7
Finished cleaning, time: 0.14 seconds.
running install
running build
running build_py
running build_ext
Executing 0 commands (using 1 thread)
Time to execute 0 commands: 0.11 seconds.
Total time spent compiling C/C++ extensions: 0.31 seconds.
running install_lib
running install_egg_info
Removing /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
packages/sage-6.4.beta4-py2.7.egg-info
Writing /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
packages/sage-6.4.beta4-py2.7.egg-info
too many failed tests, not using stored timings
Running doctests with ID 2014-10-09-21-38-47-a9d849b9.
Doctesting 1 file.
sage -t src/sage/matrix/matrix2.pyx
**********************************************************************
File "src/sage/matrix/matrix2.pyx", line 5209, in
sage.matrix.matrix2.Matrix.diagonal.eigenspaces_right
Failed example:
    eigenvalues = em[0]; eigenvalues.dense_matrix().zero_at(1e-15)
Expected:
    [ 13.348469228349...                0.0                 0.0]
    [                0.0 -1.348469228349...                 0.0]
    [                0.0                0.0                 0.0]
Got:
    [13.348469228349522                0.0                0.0]
    [               0.0 -1.348469228349534                0.0]
    [               0.0                0.0                0.0]
**********************************************************************
File "src/sage/matrix/matrix2.pyx", line 5689, in
sage.matrix.matrix2.Matrix.diagonal.eigenmatrix_right
Failed example:
    evalues = em[0]; evalues.dense_matrix().zero_at(2e-15)
Expected:
    [ 13.348469228349...                0.0                 0.0]
    [                0.0 -1.348469228349...                 0.0]
    [                0.0                0.0                 0.0]
Got:
    [13.348469228349522                0.0                0.0]
    [               0.0 -1.348469228349534                0.0]
    [               0.0                0.0                0.0]
**********************************************************************
File "src/sage/matrix/matrix2.pyx", line 12207, in
sage.matrix.matrix2.Matrix.diagonal.norm
Failed example:
    A.norm()
Expected:
    15.0
Got:
    14.999999999999998
**********************************************************************
3 items had failures:
   1 of  19 in sage.matrix.matrix2.Matrix.diagonal.eigenmatrix_right
   1 of  24 in sage.matrix.matrix2.Matrix.diagonal.eigenspaces_right
   1 of  18 in sage.matrix.matrix2.Matrix.diagonal.norm
    [2116 tests, 3 failures, 17.51 s]
----------------------------------------------------------------------
sage -t src/sage/matrix/matrix2.pyx  # 3 doctests failed
----------------------------------------------------------------------
Total time for all tests: 18.4 seconds
    cpu time: 16.5 seconds
    cumulative wall time: 17.5 seconds
}}}

I suspect I should post some system info, but I don't know what kind of,
so I fear you'll have to worm it out of me. Here is some random data:

{{{
darij@travis-virtualbox:~/gitsage$ lscpu
Architecture:          i686
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 42
Stepping:              7
CPU MHz:               1973.427
BogoMIPS:              3943.87
L1d cache:             32K
L1d cache:             32K
L2d cache:             6144K
darij@travis-virtualbox:~/gitsage$ uname -a
Linux travis-virtualbox 3.2.0-69-generic #103-Ubuntu SMP Tue Sep 2
05:03:16 UTC 2014 i686 i686 i386 GNU/Linux
darij@travis-virtualbox:~/gitsage$ uname -m
i686
}}}

URL: http://trac.sagemath.org/17126
Reported by: darij
Ticket author(s): Jeroen Demeyer
Reviewer(s): Frédéric Chapoton
Trac #17152: Cython depends on setuptools

Sometimes installing Cython fails:
{{{
****************************************************
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    from setuptools import setup, Extension
  File "build/bdist.linux-x86_64/egg/setuptools/__init__.py", line 12,
in <module>
IOError: zipimport: can not open file
/home/buildbot/build/sage/snapperkob/sage_git/build/local/lib/python2.7
/site-packages/setuptools-3.6-py2.7.egg
Error installing Cython
}}}

URL: http://trac.sagemath.org/17152
Reported by: vbraun
Ticket author(s): Volker Braun
Reviewer(s): Jeroen Demeyer
Trac #11945: Throw exception instead of printing error in c_graph.pyx

The following text currently occurs in
`$SAGE_ROOT/devel/sage/sage/graphs/base/c_graph.pyx`:

{{{
#!python
        # The following is due to a hard to reproduce bug in Cython
where except,
        # cpdef, and classes don't play well together:
        print "Not Implemented!"
        # raise NotImplementedError() ... results in:
        # Exception exceptions.NotImplementedError:
NotImplementedError() in 'sage.graphs.base.c_graph.CGraph.has_arc'
ignored
        # False
}}}

There is no Cython bug, it's just a matter of properly declaring the
`except` value in the `.pxd` file (not just the `.pyx` file). The
attached patch further adds `except` values to some other functions
where needed.

URL: http://trac.sagemath.org/11945
Reported by: kini
Ticket author(s): Jeroen Demeyer
Reviewer(s): Nathann Cohen
Trac #17156: Creating a graph from a immutable digraph raises an error

We currently have the following:
{{{
sage: D = DiGraph([[1, 2]], immutable=True)
sage: Graph(D)
------------------------------------------------------------------------
---
NotImplementedError                       Traceback (most recent call
last)
...
NotImplementedError: An immutable graph does not change name
}}}
For the record, this works
{{{
sage: D = DiGraph([[1, 2]])
sage: Graph(D)
Graph on 2 vertices
}}}

I'm also wondering about the error type of (attempted) mutations of
immutable (di)graphs. Some raise a `ValueError`, others raise a
`NotImplementedError`. This needs to be made consistent at some point.

URL: http://trac.sagemath.org/17156
Reported by: tscrim
Ticket author(s): Nathann Cohen
Reviewer(s): Travis Scrimshaw