diff options
author | Kacper Kowalik <xarthisius@gentoo.org> | 2012-05-06 12:10:06 +0000 |
---|---|---|
committer | Kacper Kowalik <xarthisius@gentoo.org> | 2012-05-06 12:10:06 +0000 |
commit | 974601857d117e9b80176eb8ab6fad19080637c4 (patch) | |
tree | 98e289e7afa6cca9aad2da1c418fdfcdd67b50f9 /dev-python/sphinx | |
parent | Stable for amd64, wrt bug #414387 (diff) | |
download | gentoo-2-974601857d117e9b80176eb8ab6fad19080637c4.tar.gz gentoo-2-974601857d117e9b80176eb8ab6fad19080637c4.tar.bz2 gentoo-2-974601857d117e9b80176eb8ab6fad19080637c4.zip |
Backport upstream patch with python3 fixes
(Portage version: 2.2.0_alpha100/cvs/Linux x86_64)
Diffstat (limited to 'dev-python/sphinx')
-rw-r--r-- | dev-python/sphinx/ChangeLog | 8 | ||||
-rw-r--r-- | dev-python/sphinx/files/sphinx-1.1.3-python3.patch | 45 | ||||
-rw-r--r-- | dev-python/sphinx/sphinx-1.1.3-r3.ebuild | 121 |
3 files changed, 173 insertions, 1 deletions
diff --git a/dev-python/sphinx/ChangeLog b/dev-python/sphinx/ChangeLog index fb4c60c4f7f0..9d4a9189d38c 100644 --- a/dev-python/sphinx/ChangeLog +++ b/dev-python/sphinx/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-python/sphinx # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/sphinx/ChangeLog,v 1.110 2012/05/01 12:00:37 xarthisius Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/sphinx/ChangeLog,v 1.111 2012/05/06 12:10:06 xarthisius Exp $ + +*sphinx-1.1.3-r3 (06 May 2012) + + 06 May 2012; Kacper Kowalik <xarthisius@gentoo.org> + +files/sphinx-1.1.3-python3.patch, +sphinx-1.1.3-r3.ebuild: + Backport upstream patch with python3 fixes 01 May 2012; Kacper Kowalik <xarthisius@gentoo.org> sphinx-1.1.3-r2.ebuild: Add dependency on app-text/dvipng required for rendering math expressions diff --git a/dev-python/sphinx/files/sphinx-1.1.3-python3.patch b/dev-python/sphinx/files/sphinx-1.1.3-python3.patch new file mode 100644 index 000000000000..4817034eb683 --- /dev/null +++ b/dev-python/sphinx/files/sphinx-1.1.3-python3.patch @@ -0,0 +1,45 @@ +# HG changeset patch +# User Rob Reilink <r.reilink@science-applied.nl> +# Date 1331657734 -3600 +# Node ID 8aba132b1337fc351fe1464f3a4b61f21f55e64e +# Parent 4a6d33249418befdf587603fc31db58fb863fee4 +fixed encoding for hashing functions for Python 3 + +diff -r 4a6d33249418befdf587603fc31db58fb863fee4 -r 8aba132b1337fc351fe1464f3a4b61f21f55e64e sphinx/ext/graphviz.py +--- a/sphinx/ext/graphviz.py Sat Mar 10 22:24:59 2012 +0100 ++++ b/sphinx/ext/graphviz.py Tue Mar 13 17:55:34 2012 +0100 +@@ -121,9 +121,11 @@ + + def render_dot(self, code, options, format, prefix='graphviz'): + """Render graphviz code into a PNG or PDF output file.""" +- hashkey = code.encode('utf-8') + str(options) + \ ++ hashkey = (code + str(options) + \ + str(self.builder.config.graphviz_dot) + \ + str(self.builder.config.graphviz_dot_args) ++ ).encode('utf-8') ++ + fname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest(), format) + if hasattr(self.builder, 'imgpath'): + # HTML +diff -r 4a6d33249418befdf587603fc31db58fb863fee4 -r 8aba132b1337fc351fe1464f3a4b61f21f55e64e sphinx/ext/inheritance_diagram.py +--- a/sphinx/ext/inheritance_diagram.py Sat Mar 10 22:24:59 2012 +0100 ++++ b/sphinx/ext/inheritance_diagram.py Tue Mar 13 17:55:34 2012 +0100 +@@ -39,7 +39,7 @@ + import re + import sys + import inspect +-import __builtin__ ++import __builtin__ as __builtin__ # as __builtin__ is for lib2to3 compatibility + try: + from hashlib import md5 + except ImportError: +@@ -314,7 +314,8 @@ + + + def get_graph_hash(node): +- return md5(node['content'] + str(node['parts'])).hexdigest()[-10:] ++ encoded = (node['content'] + str(node['parts'])).encode('utf-8') ++ return md5(encoded).hexdigest()[-10:] + + + def html_visit_inheritance_diagram(self, node): diff --git a/dev-python/sphinx/sphinx-1.1.3-r3.ebuild b/dev-python/sphinx/sphinx-1.1.3-r3.ebuild new file mode 100644 index 000000000000..d34c91a2d240 --- /dev/null +++ b/dev-python/sphinx/sphinx-1.1.3-r3.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/sphinx/sphinx-1.1.3-r3.ebuild,v 1.1 2012/05/06 12:10:06 xarthisius Exp $ + +EAPI="4" +PYTHON_DEPEND="2" +SUPPORT_PYTHON_ABIS="1" +DISTUTILS_SRC_TEST="nosetests" +PYTHON_TESTS_RESTRICTED_ABIS="2.5 *-pypy-*" + +inherit eutils distutils + +MY_PN="Sphinx" +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="Python documentation generator" +HOMEPAGE="http://sphinx.pocoo.org/ http://pypi.python.org/pypi/Sphinx" +SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="doc latex" + +DEPEND=">=dev-python/docutils-0.7 + >=dev-python/jinja-2.3 + >=dev-python/pygments-1.2 + dev-python/setuptools + latex? ( + dev-texlive/texlive-latexextra + app-text/dvipng + )" +RDEPEND="${DEPEND}" + +S="${WORKDIR}/${MY_P}" + +DOCS="CHANGES" + +src_prepare() { + epatch "${FILESDIR}"/${P}-python3.patch + distutils_src_prepare + + prepare_tests() { + mkdir -p build-${PYTHON_ABI} + cp -r tests build-${PYTHON_ABI}/tests + if [[ $(python_get_version -l --major) == "3" ]]; then + 2to3-${PYTHON_ABI} -nw --no-diffs build-${PYTHON_ABI}/tests + fi + } + use test && python_execute_function prepare_tests +} + +src_compile() { + distutils_src_compile + + if use doc; then + einfo "Generation of documentation" + sed -e "/import sys/a sys.path.insert(0, '${S}/build-$(PYTHON -f --ABI)/lib')" -i sphinx-build.py + pushd doc > /dev/null + emake SPHINXBUILD="$(PYTHON -f) ../sphinx-build.py" html || die + popd > /dev/null + fi +} + +src_test() { + testing() { + pushd build-${PYTHON_ABI} > /dev/null + echo PYTHONPATH=lib nosetests --verbosity=1 + PYTHONPATH=lib nosetests --verbosity=1 + local rv=$? + popd > /dev/null + return $rv + } + python_execute_function testing +} + +src_install() { + distutils_src_install + python_generate_wrapper_scripts -E -f -q "${ED}usr/bin/sphinx-build" + + delete_grammar_pickle() { + rm -f "${ED}$(python_get_sitedir)/sphinx/pycode/Grammar$(python_get_version -l).pickle" + } + python_execute_function -q delete_grammar_pickle + + if use doc; then + dohtml -A txt -r doc/_build/html/* || die "Installation of documentation failed" + fi +} + +pkg_postinst() { + distutils_pkg_postinst + + # Generate the Grammar pickle to avoid sandbox violations. + generation_of_grammar_pickle() { + "$(PYTHON)" -c "import sys; sys.path.insert(0, '${EROOT}$(python_get_sitedir -b)'); from sphinx.pycode.pgen2.driver import load_grammar; load_grammar('${EROOT}$(python_get_sitedir -b)/sphinx/pycode/Grammar.txt')" + } + python_execute_function \ + --action-message 'Generation of Grammar pickle with $(python_get_implementation_and_version)...' \ + --failure-message 'Generation of Grammar pickle with $(python_get_implementation_and_version) failed' \ + generation_of_grammar_pickle +} + +pkg_postrm() { + distutils_pkg_postrm + + deletion_of_grammar_pickle() { + rm -f "${EROOT}$(python_get_sitedir -b)/sphinx/pycode"/Grammar*.pickle || return 1 + + # Delete empty parent directories. + local dir="${EROOT}$(python_get_sitedir -b)/sphinx/pycode" + while [[ "${dir}" != "${EROOT%/}" ]]; do + rmdir "${dir}" 2> /dev/null || break + dir="${dir%/*}" + done + } + python_execute_function \ + --action-message 'Deletion of Grammar pickle with $(python_get_implementation_and_version)...' \ + --failure-message 'Deletion of Grammar pickle with $(python_get_implementation_and_version) failed' \ + deletion_of_grammar_pickle +} |