From 09f69afdb121cf888d1e25521b61e1ce49e7d71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sun, 3 Feb 2013 20:02:10 +0100 Subject: [PATCH] Convert wxpython to distutils-r1. --- ...2.8.12.1.ebuild => wxpython-2.8.12.1-r1.ebuild} | 134 +++++++++++---------- ...n-2.9.4.1.ebuild => wxpython-2.9.4.1-r1.ebuild} | 117 +++++++++--------- 2 files changed, 130 insertions(+), 121 deletions(-) copy gx86/dev-python/wxpython/{wxpython-2.8.12.1.ebuild => wxpython-2.8.12.1-r1.ebuild} (59%) copy gx86/dev-python/wxpython/{wxpython-2.9.4.1.ebuild => wxpython-2.9.4.1-r1.ebuild} (55%) diff --git a/gx86/dev-python/wxpython/wxpython-2.8.12.1.ebuild b/gx86/dev-python/wxpython/wxpython-2.8.12.1-r1.ebuild similarity index 59% copy from gx86/dev-python/wxpython/wxpython-2.8.12.1.ebuild copy to gx86/dev-python/wxpython/wxpython-2.8.12.1-r1.ebuild index 9ecda05..5787d53 100644 --- a/gx86/dev-python/wxpython/wxpython-2.8.12.1.ebuild +++ b/gx86/dev-python/wxpython/wxpython-2.8.12.1-r1.ebuild @@ -2,13 +2,12 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-python/wxpython/wxpython-2.8.12.1.ebuild,v 1.17 2012/09/05 09:36:33 jlec Exp $ -EAPI="4" -PYTHON_DEPEND="2" +EAPI=5 + +PYTHON_COMPAT=( python{2_6,2_7} ) WX_GTK_VER="2.8" -SUPPORT_PYTHON_ABIS="1" -RESTRICT_PYTHON_ABIS="3.* *-jython 2.7-pypy-*" -inherit alternatives distutils eutils fdo-mime wxwidgets +inherit alternatives distutils-r1 eutils fdo-mime flag-o-matic wxwidgets MY_P="${P/wxpython-/wxPython-src-}" @@ -21,20 +20,20 @@ SRC_URI="mirror://sourceforge/wxpython/${MY_P}.tar.bz2 LICENSE="wxWinLL-3" SLOT="2.8" -KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sh sparc x86 ~amd64-fbsd ~x86-fbsd" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" IUSE="cairo doc examples opengl" RDEPEND=" >=x11-libs/wxGTK-${PV}:${WX_GTK_VER}[opengl?,tiff,X] dev-libs/glib:2 - dev-python/setuptools + dev-python/setuptools[${PYTHON_USEDEP}] media-libs/libpng:0 media-libs/tiff:0 virtual/jpeg x11-libs/gtk+:2 x11-libs/pango[X] - cairo? ( >=dev-python/pycairo-1.8.4 ) - opengl? ( dev-python/pyopengl )" + cairo? ( >=dev-python/pycairo-1.8.4[${PYTHON_USEDEP}] ) + opengl? ( dev-python/pyopengl[${PYTHON_USEDEP}] )" DEPEND="${RDEPEND} virtual/pkgconfig" @@ -42,88 +41,97 @@ DEPEND="${RDEPEND} S="${WORKDIR}/${MY_P}/wxPython" DOC_S="${WORKDIR}/wxPython-${PV}" -PYTHON_CFLAGS=("2.* + -fno-strict-aliasing") -PYTHON_CXXFLAGS=("2.* + -fno-strict-aliasing") - -PYTHON_MODNAME="wx-${SLOT}-gtk2-unicode wxversion.py" +# The hacky build system seems to be broken with out-of-source builds, +# and installs 'wx' package globally. +DISTUTILS_IN_SOURCE_BUILD=1 -src_prepare() { +python_prepare_all() { sed -i "s:cflags.append('-O3'):pass:" config.py || die "sed failed" - epatch "${FILESDIR}"/${PN}-2.8.9-wxversion-scripts.patch - # drop editra - we have it as a separate package now - epatch "${FILESDIR}"/${PN}-2.8.12-drop-editra.patch - if use doc; then - cd "${DOC_S}" + cd "${DOC_S}" || die epatch "${FILESDIR}"/${PN}-${SLOT}-cache-writable.patch fi if use examples; then - cd "${DOC_S}" + cd "${DOC_S}" || die epatch "${FILESDIR}"/${PN}-${SLOT}-wxversion-demo.patch fi - python_copy_sources + cd "${S}" || die - # Workaround, buildsystem uses CFLAGS as CXXFLAGS - export CFLAGS="${CXXFLAGS}" + local PATCHES=( + "${FILESDIR}"/${PN}-2.8.9-wxversion-scripts.patch + # drop editra - we have it as a separate package now + "${FILESDIR}"/${PN}-2.8.12-drop-editra.patch + ) + + distutils-r1_python_prepare_all } -src_configure() { +python_configure_all() { + append-flags -fno-strict-aliasing + # Workaround, buildsystem uses CFLAGS as CXXFLAGS + export CFLAGS="${CXXFLAGS}" need-wxwidgets unicode - DISTUTILS_GLOBAL_OPTIONS=( - "* WX_CONFIG=${WX_CONFIG}" - "* WXPORT=gtk2" - "* UNICODE=1" - "* BUILD_GLCANVAS=$(use opengl && echo 1 || echo 0)" + mydistutilsargs=( + WX_CONFIG="${WX_CONFIG}" + WXPORT=gtk2 + UNICODE=1 + BUILD_GLCANVAS=$(usex opengl 1 0) ) } -distutils_src_install_post_hook() { - # Collision protection. +python_install() { + distutils-r1_python_install + + # adjust the filenames for wxPython slots. local file - for file in "$(distutils_get_intermediate_installation_image)${EPREFIX}/usr/bin/"*; do - mv "${file}" "${file}-${SLOT}" + for file in "${D}$(python_get_sitedir)"/wx{version.*,.pth}; do + mv "${file}" "${file}-${SLOT}" || die done -} - -src_install() { - local docdir file + cd "${ED}"usr/bin || die + for file in *-"${EPYTHON}"; do + local wrapper=${file%-${EPYTHON}} - distutils_src_install + mv "${file}" "${file/-/-${SLOT}-}" || die - # Collision protection. - rename_files() { - for file in "${D}$(python_get_sitedir)/"wx{version.*,.pth}; do - mv "${file}" "${file}-${SLOT}" || return 1 - done - } - python_execute_function -q rename_files + # wrappers are common to all impls, so a parallel run may + # move it for us. ln+rm is more failure-proof. + ln -fs python-exec "${wrapper}-${SLOT}" || die + rm -f "${wrapper}" + done +} - dodoc "${S}"/docs/{CHANGES,PyManual,README,wxPackage,wxPythonManual}.txt +python_install_all() { + dodoc docs/{CHANGES,PyManual,README,wxPackage,wxPythonManual}.txt - domenu "${S}"/distrib/{Py{AlaMode,Crust,Shell},XRCed}.desktop - newicon "${S}"/wx/py/PyCrust_32.png PyCrust.png - newicon "${S}"/wx/tools/XRCed/XRCed_32.png XRCed.png + domenu distrib/{Py{AlaMode,Crust,Shell},XRCed}.desktop + newicon wx/py/PyCrust_32.png PyCrust.png + newicon wx/tools/XRCed/XRCed_32.png XRCed.png docdir=${D}usr/share/doc/${PF} if use doc; then - dodir /usr/share/doc/${PF}/docs - cp -R "${DOC_S}"/docs/* "${docdir}"/docs/ + docinto docs + dodoc -r "${DOC_S}"/docs/. # For some reason newer API docs aren't available so use 2.8.9.2's - cp -R "${WORKDIR}"/wxPython-2.8.9.2/docs/* "${docdir}"/docs/ + dodoc -r "${WORKDIR}"/wxPython-2.8.9.2/docs/. + + docompress -x /usr/share/doc/${PF}/docs fi if use examples; then - dodir /usr/share/doc/${PF}/demo - cp -R "${DOC_S}"/demo/* "${docdir}"/demo - dodir /usr/share/doc/${PF}/samples - cp -R "${DOC_S}"/samples/* "${docdir}"/samples + docinto demo + dodoc -r "${DOC_S}"/demo/. + docinto samples + dodoc -r "${DOC_S}"/samples/. + [[ -e ${docdir}/samples/embedded/embedded ]] \ && rm -f "${docdir}"/samples/embedded/embedded + + docompress -x /usr/share/doc/${PF}/{demo,samples} fi } @@ -134,17 +142,15 @@ pkg_postinst() { alternatives_auto_makesym "$(python_get_sitedir)/wx.pth" "$(python_get_sitedir)/wx.pth-[0-9].[0-9]" alternatives_auto_makesym "$(python_get_sitedir)/wxversion.py" "$(python_get_sitedir)/wxversion.py-[0-9].[0-9]" } - python_execute_function -q create_symlinks - - distutils_pkg_postinst + python_foreach_impl create_symlinks echo elog "Gentoo uses the Multi-version method for SLOT'ing." elog "Developers, see this site for instructions on using" elog "2.6 or 2.8 with your apps:" elog "http://wiki.wxpython.org/index.cgi/MultiVersionInstalls" - echo if use doc; then + elog elog "To access the general wxWidgets documentation, run" elog "/usr/share/doc/${PF}/docs/viewdocs.py" elog @@ -159,20 +165,18 @@ pkg_postinst() { elog elog "Many more example apps and modules can be found in" elog "/usr/share/doc/${PF}/samples/" - echo fi + elog elog "Editra is not packaged with wxpython in Gentoo." elog "You can find it in the tree as app-editors/editra" - echo } pkg_postrm() { - distutils_pkg_postrm fdo-mime_desktop_database_update - create_symlinks() { + update_symlinks() { alternatives_auto_makesym "$(python_get_sitedir)/wx.pth" "$(python_get_sitedir)/wx.pth-[0-9].[0-9]" alternatives_auto_makesym "$(python_get_sitedir)/wxversion.py" "$(python_get_sitedir)/wxversion.py-[0-9].[0-9]" } - python_execute_function -q create_symlinks + python_foreach_impl update_symlinks } diff --git a/gx86/dev-python/wxpython/wxpython-2.9.4.1.ebuild b/gx86/dev-python/wxpython/wxpython-2.9.4.1-r1.ebuild similarity index 55% copy from gx86/dev-python/wxpython/wxpython-2.9.4.1.ebuild copy to gx86/dev-python/wxpython/wxpython-2.9.4.1-r1.ebuild index 4456874..894f36b 100644 --- a/gx86/dev-python/wxpython/wxpython-2.9.4.1.ebuild +++ b/gx86/dev-python/wxpython/wxpython-2.9.4.1-r1.ebuild @@ -2,13 +2,12 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-python/wxpython/wxpython-2.9.4.1.ebuild,v 1.3 2012/09/05 09:36:33 jlec Exp $ -EAPI="4" -PYTHON_DEPEND="2:2.6" +EAPI=5 + +PYTHON_COMPAT=( python{2_6,2_7} ) WX_GTK_VER="2.9" -SUPPORT_PYTHON_ABIS="1" -RESTRICT_PYTHON_ABIS="2.[45] 3.* *-jython 2.7-pypy-*" -inherit alternatives distutils eutils fdo-mime wxwidgets +inherit alternatives distutils-r1 eutils fdo-mime wxwidgets MY_PN="wxPython-src" @@ -26,14 +25,14 @@ IUSE="cairo examples opengl" RDEPEND=" >=x11-libs/wxGTK-${PV}:${WX_GTK_VER}[opengl?,tiff,X] dev-libs/glib:2 - dev-python/setuptools + dev-python/setuptools[${PYTHON_USEDEP}] media-libs/libpng:0 media-libs/tiff:0 virtual/jpeg x11-libs/gtk+:2 x11-libs/pango[X] - cairo? ( >=dev-python/pycairo-1.8.4 ) - opengl? ( dev-python/pyopengl )" + cairo? ( >=dev-python/pycairo-1.8.4[${PYTHON_USEDEP}] ) + opengl? ( dev-python/pyopengl[${PYTHON_USEDEP}] )" DEPEND="${RDEPEND} virtual/pkgconfig" @@ -41,74 +40,84 @@ DEPEND="${RDEPEND} S="${WORKDIR}/${MY_PN}-2.9.4.0/wxPython" DOC_S="${WORKDIR}/wxPython-2.9.4.0" -PYTHON_CFLAGS=("2.* + -fno-strict-aliasing") -PYTHON_CXXFLAGS=("2.* + -fno-strict-aliasing") - -PYTHON_MODNAME="wx-${PV%.*}-gtk2 wxversion.py" +# The hacky build system seems to be broken with out-of-source builds, +# and installs 'wx' package globally. +DISTUTILS_IN_SOURCE_BUILD=1 -src_prepare() { +python_prepare_all() { sed -i "s:cflags.append('-O3'):pass:" config.py || die "sed failed" - cd .. + cd .. || die epatch "${DISTDIR}"/${MY_PN}-${PV}.patch - cd "${S}" - epatch "${FILESDIR}"/${P}-wxversion-scripts.patch - # drop editra - we have it as a separate package now - epatch "${FILESDIR}"/${PN}-2.8.11-drop-editra.patch if use examples; then cd "${DOC_S}" epatch "${FILESDIR}"/${PN}-${SLOT}-wxversion-demo.patch fi - python_copy_sources + cd "${S}" || die + local PATCHES=( + "${FILESDIR}"/${P}-wxversion-scripts.patch + # drop editra - we have it as a separate package now + "${FILESDIR}"/${PN}-2.8.11-drop-editra.patch + ) + + distutils-r1_python_prepare_all } src_configure() { + append-flags -fno-strict-aliasing need-wxwidgets unicode - DISTUTILS_GLOBAL_OPTIONS=( - "* WX_CONFIG=${WX_CONFIG}" - "* WXPORT=gtk2" - "* UNICODE=1" - "* BUILD_GLCANVAS=$(use opengl && echo 1 || echo 0)" + mydistutilsargs=( + WX_CONFIG="${WX_CONFIG}" + WXPORT=gtk2 + UNICODE=1 + BUILD_GLCANVAS=$(usex opengl 1 0) ) } -distutils_src_install_post_hook() { - # Collision protection. +python_install() { + distutils-r1_python_install + + # adjust the filenames for wxPython slots. local file - for file in "$(distutils_get_intermediate_installation_image)${EPREFIX}"/usr/bin/*; do - mv "${file}" "${file}-${SLOT}" + for file in "${D}$(python_get_sitedir)"/wx{version.*,.pth}; do + mv "${file}" "${file}-${SLOT}" || die done -} + cd "${ED}"usr/bin || die + for file in *-"${EPYTHON}"; do + local wrapper=${file%-${EPYTHON}} -src_install() { - distutils_src_install + mv "${file}" "${file/-/-${SLOT}-}" || die - local file x - # Collision protection. - rename_files() { - for file in "${D}$(python_get_sitedir)/"wx{version.*,.pth}; do - mv "${file}" "${file}-${SLOT}" || return 1 - done - } - python_execute_function -q rename_files + # wrappers are common to all impls, so a parallel run may + # move it for us. ln+rm is more failure-proof. + ln -fs python-exec "${wrapper}-${SLOT}" || die + rm -f "${wrapper}" + done +} - dodoc "${S}"/docs/{CHANGES,PyManual,README,wxPackage,wxPythonManual}.txt +python_install_all() { + dodoc docs/{CHANGES,PyManual,README,wxPackage,wxPythonManual}.txt for x in {Py{AlaMode,Crust,Shell},XRCed}; do - newmenu "${S}"/distrib/${x}.desktop ${x}-${SLOT}.desktop + newmenu distrib/${x}.desktop ${x}-${SLOT}.desktop done - newicon "${S}"/wx/py/PyCrust_32.png PyCrust-${SLOT}.png - newicon "${S}"/wx/py/PySlices_32.png PySlices-${SLOT}.png - newicon "${S}"/wx/tools/XRCed/XRCed_32.png XRCed-${SLOT}.png + newicon wx/py/PyCrust_32.png PyCrust-${SLOT}.png + newicon wx/py/PySlices_32.png PySlices-${SLOT}.png + newicon wx/tools/XRCed/XRCed_32.png XRCed-${SLOT}.png if use examples; then - dodir /usr/share/doc/${PF}/demo - dodir /usr/share/doc/${PF}/samples - cp -R "${DOC_S}"/demo/* "${D}"/usr/share/doc/${PF}/demo/ || die - cp -R "${DOC_S}"/samples/* "${D}"/usr/share/doc/${PF}/samples/ || die + docinto demo + dodoc -r "${DOC_S}"/demo/. + docinto samples + dodoc -r "${DOC_S}"/samples/. + + [[ -e ${docdir}/samples/embedded/embedded ]] \ + && rm -f "${docdir}"/samples/embedded/embedded + + docompress -x /usr/share/doc/${PF}/{demo,samples} fi } @@ -119,17 +128,15 @@ pkg_postinst() { alternatives_auto_makesym "$(python_get_sitedir)/wx.pth" "$(python_get_sitedir)/wx.pth-[0-9].[0-9]" alternatives_auto_makesym "$(python_get_sitedir)/wxversion.py" "$(python_get_sitedir)/wxversion.py-[0-9].[0-9]" } - python_execute_function -q create_symlinks - - distutils_pkg_postinst + python_foreach_impl create_symlinks echo elog "Gentoo uses the Multi-version method for SLOT'ing." elog "Developers, see this site for instructions on using" elog "2.8 or 2.9 with your apps:" elog "http://wiki.wxpython.org/index.cgi/MultiVersionInstalls" - elog if use examples; then + elog elog "The demo.py app which contains demo modules with" elog "documentation and source code has been installed at" elog "/usr/share/doc/${PF}/demo/demo.py" @@ -137,16 +144,14 @@ pkg_postinst() { elog "More example apps and modules can be found in" elog "/usr/share/doc/${PF}/samples/" fi - echo } pkg_postrm() { - distutils_pkg_postrm fdo-mime_desktop_database_update - create_symlinks() { + update_symlinks() { alternatives_auto_makesym "$(python_get_sitedir)/wx.pth" "$(python_get_sitedir)/wx.pth-[0-9].[0-9]" alternatives_auto_makesym "$(python_get_sitedir)/wxversion.py" "$(python_get_sitedir)/wxversion.py-[0-9].[0-9]" } - python_execute_function -q create_symlinks + python_foreach_impl update_symlinks } -- 1.8.1.2