PYTHONPATH=..:/var/tmp/portage/dev-python/sympy-0.7.6.1-r1/work/sympy-0.7.6.1-python3_4/lib: sphinx-build -b html -d _build/doctrees src _build/html Running Sphinx v1.3.5 Exception occurred: File "/usr/lib64/python3.4/site-packages/sphinx/application.py", line 431, in setup_extension mod = __import__(extension, None, None, ['setup']) File "ext/numpydoc.py", line 41 title_re = re.compile(ur'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*', ^ SyntaxError: invalid syntax Full stack trace: # Sphinx version: 1.3.5 # Python version: 3.4.3 (CPython) # Docutils version: 0.12 release # Jinja2 version: 2.8 # Last messages: # Loaded extensions: Traceback (most recent call last): File "/usr/lib64/python3.4/site-packages/sphinx/cmdline.py", line 243, in main opts.warningiserror, opts.tags, opts.verbosity, opts.jobs) File "/usr/lib64/python3.4/site-packages/sphinx/application.py", line 144, in __init__ self.setup_extension(extension) File "/usr/lib64/python3.4/site-packages/sphinx/application.py", line 431, in setup_extension mod = __import__(extension, None, None, ['setup']) File "ext/numpydoc.py", line 41 title_re = re.compile(ur'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*', ^ SyntaxError: invalid syntax The immediate source of the problem appears to be that python 3.4 doesn't support unicode string literals. On 2015-11-20 I had successfully emerged dev-python/sympy-0.7.6.1-r1::sage-on-gentoo using Sphinx 1.3.1. Looking at the build log from that, it appears that it was building the documentation from the python2_7 tree only. Not sure why that's the case, and it won't help people who use python3_4 as their only Python target.
I just noticed this in the ebuild: > REQUIRED_USE="… doc? ( python_targets_python2_7 )" So the intention appears to be that the documentation should be built with 2.7. Presumably I did have pyhon 2 enabled via eselect when last I emerged sympy. Looking through some eclasses, I think the correct way to force building the docs using python 2.7 would be adding this line to the ebuild: DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' ) Or perhaps include 3.5 there and in the REQUIRED_USE, since it again supports unicode literals. In any case, I can't build for Python 3.5 just yet, so I just added that line and gave it a try. Indeed I get this: PYTHONPATH=..:/var/tmp/portage/dev-python/sympy-0.7.6.1-r1/work/sympy-0.7.6.1-python2_7/lib: sphinx-build -b html -d _build/doctrees src _build/html Running Sphinx v1.3.5 Setting permissions of DOT_SAGE directory so only you can read and write it. Exception occurred: File "/usr/lib64/python2.7/site-packages/mpmath/ctx_mp.py", line 49, in <module> import sage.libs.mpmath.ext_main as _mpf_module AttributeError: 'module' object has no attribute 'ext_main' OK, that's https://github.com/cschwan/sage-on-gentoo/issues/380; I should have used the version from the sage-on-gentoo overlay. That works with the mentioned fix.
Created attachment 424174 [details, diff] Add DISTUTILS_ALL_SUBPHASE_IMPLS right after PYTHON_COMPAT Applied to the sage-on-gentoo version of this ebuild, this works for me.
Thanks, committed commit fc5d879ab4745029d16af3dfc770dfadec394a16 Author: Andrey Grozin <grozin@gentoo.org> Date: Sat Jan 30 19:10:41 2016 +0600 dev-python/sympy: docs are now built by python-2.7 Bug: 573282 Package-Manager: portage-2.2.27