summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-01-15 21:31:21 +0000
committerMichał Górny <mgorny@gentoo.org>2013-01-15 21:31:21 +0000
commit2c7f48322afd056f201a39b09329199d1cc94aa4 (patch)
tree43d2eac58d07761e0bdf5558f4539d36f274ce17 /dev-python/sphinx
parentRemove myself from metadata (diff)
downloadgentoo-2-2c7f48322afd056f201a39b09329199d1cc94aa4.tar.gz
gentoo-2-2c7f48322afd056f201a39b09329199d1cc94aa4.tar.bz2
gentoo-2-2c7f48322afd056f201a39b09329199d1cc94aa4.zip
Make sure to always generate and install Grammar pickles. Work-around the older ebuild's postrm() removing it.
(Portage version: 2.2.0_alpha152/cvs/Linux x86_64, signed Manifest commit with key 42B9401D)
Diffstat (limited to 'dev-python/sphinx')
-rw-r--r--dev-python/sphinx/ChangeLog9
-rw-r--r--dev-python/sphinx/sphinx-1.1.3-r5.ebuild (renamed from dev-python/sphinx/sphinx-1.1.3-r4.ebuild)58
2 files changed, 64 insertions, 3 deletions
diff --git a/dev-python/sphinx/ChangeLog b/dev-python/sphinx/ChangeLog
index 06e5af5412af..96043ae632a4 100644
--- a/dev-python/sphinx/ChangeLog
+++ b/dev-python/sphinx/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for dev-python/sphinx
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/sphinx/ChangeLog,v 1.122 2013/01/14 00:03:38 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/sphinx/ChangeLog,v 1.123 2013/01/15 21:31:21 mgorny Exp $
+
+*sphinx-1.1.3-r5 (15 Jan 2013)
+
+ 15 Jan 2013; Michał Górny <mgorny@gentoo.org> +sphinx-1.1.3-r5.ebuild,
+ -sphinx-1.1.3-r4.ebuild:
+ Make sure to always generate and install Grammar pickles. Work-around the
+ older ebuild's postrm() removing it.
*sphinx-1.1.3-r4 (14 Jan 2013)
diff --git a/dev-python/sphinx/sphinx-1.1.3-r4.ebuild b/dev-python/sphinx/sphinx-1.1.3-r5.ebuild
index 599b054cdde6..98c85d3e1e72 100644
--- a/dev-python/sphinx/sphinx-1.1.3-r4.ebuild
+++ b/dev-python/sphinx/sphinx-1.1.3-r5.ebuild
@@ -1,12 +1,12 @@
# Copyright 1999-2013 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-r4.ebuild,v 1.1 2013/01/14 00:03:38 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/sphinx/sphinx-1.1.3-r5.ebuild,v 1.1 2013/01/15 21:31:21 mgorny Exp $
EAPI=5
PYTHON_COMPAT=( python{2_5,2_6,2_7,3_1,3_2} pypy1_9 )
-inherit distutils-r1
+inherit distutils-r1 versionator
MY_PN="Sphinx"
MY_P="${MY_PN}-${PV}"
@@ -47,6 +47,14 @@ python_compile() {
2to3 -w --no-diffs "${BUILD_DIR}"/lib/tests || die
fi
fi
+
+ # Generate the grammar. It will be catched by install somehow.
+ # Note that the tests usually do it for us. However, I don't want
+ # to trust USE=test really running all the tests, especially
+ # with FEATURES=test-fail-continue.
+ cd "${BUILD_DIR}"/lib || die
+ "${PYTHON}" -m sphinx.pycode.__init__ \
+ || die "Grammar generation failed."
}
python_compile_all() {
@@ -62,3 +70,49 @@ python_install_all() {
distutils-r1_python_install_all
}
+
+replacing_python_eclass() {
+ local pv
+ for pv in ${REPLACING_VERSIONS}; do
+ if ! version_is_at_least 1.1.3-r4 ${pv}; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+pkg_preinst() {
+ if replacing_python_eclass; then
+ # the old python.eclass ebuild will want to remove our pickles...
+ backup_pickle() {
+ # array to enable filename expansion
+ local pickle_name=(
+ "${D}$(python_get_sitedir)"/sphinx/pycode/Grammar*.pickle
+ )
+
+ local dest=${ROOT}${pickle_name[0]#${D}}.backup
+
+ cp -p -v "${pickle_name[0]}" "${dest}" \
+ || die "Unable to backup grammar pickle from overwriting"
+ }
+
+ python_foreach_impl backup_pickle
+ fi
+}
+
+pkg_postinst() {
+ if replacing_python_eclass; then
+ restore_pickle() {
+ local backup_name=(
+ "${ROOT}$(python_get_sitedir)"/sphinx/pycode/Grammar*.pickle.backup
+ )
+ local dest=${backup_name[0]%.backup}
+
+ mv -v "${backup_name[0]}" "${dest}" \
+ || die "Unable to restore grammar pickle backup"
+ }
+
+ python_foreach_impl restore_pickle
+ fi
+}