summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-10 04:55:26 +0000
committerSam James <sam@gentoo.org>2023-01-10 04:56:16 +0000
commit45846fb0a873286029d6673f114c43433b7be91c (patch)
tree09019bfe80c5c5271cc43caccea0f54ff8c5187e /media-gfx
parentdev-vcs/git-filter-repo: enable py3.11, run tests per python impl (diff)
downloadgentoo-45846fb0a873286029d6673f114c43433b7be91c.tar.gz
gentoo-45846fb0a873286029d6673f114c43433b7be91c.tar.bz2
gentoo-45846fb0a873286029d6673f114c43433b7be91c.zip
media-gfx/mypaint: update EAPI 7 -> 8, enable py3.11
Small chance the gettext stuff in the Python 3.11 patch helps w/ the musl segfault, bug #836232. Bug: https://bugs.gentoo.org/836232 Closes: https://bugs.gentoo.org/807979 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-gfx')
-rw-r--r--media-gfx/mypaint/files/mypaint-2.0.1-python3.11.patch92
-rw-r--r--media-gfx/mypaint/files/mypaint-2.0.1-setuptools.patch74
-rw-r--r--media-gfx/mypaint/mypaint-2.0.1-r3.ebuild79
3 files changed, 245 insertions, 0 deletions
diff --git a/media-gfx/mypaint/files/mypaint-2.0.1-python3.11.patch b/media-gfx/mypaint/files/mypaint-2.0.1-python3.11.patch
new file mode 100644
index 000000000000..7a652754204d
--- /dev/null
+++ b/media-gfx/mypaint/files/mypaint-2.0.1-python3.11.patch
@@ -0,0 +1,92 @@
+https://github.com/mypaint/mypaint/pull/1193
+
+From 032a155b72f2b021f66a994050d83f07342d04af Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
+ <congdanhqx@gmail.com>
+Date: Wed, 9 Nov 2022 11:24:33 +0700
+Subject: [PATCH] python: fix for Python 3.11
+
+- python 3 always open in universal mode, U is default mode in 3.0,
+ and removed in 3.11
+- mypaint doesn't use ld?n?gettext, so bind_textdomain_codeset isn't
+ needed, that function is deprecated in 3.8 and is no-ops in 3.10 and
+ removed in 3.11
+--- a/lib/gettext_setup.py
++++ b/lib/gettext_setup.py
+@@ -82,13 +82,11 @@ def init_gettext(localepath):
+ # yanked in over GI.
+ # https://bugzilla.gnome.org/show_bug.cgi?id=574520#c26
+ bindtextdomain = None
+- bind_textdomain_codeset = None
+ textdomain = None
+
+ # Try the POSIX/Linux way first.
+ try:
+ bindtextdomain = locale.bindtextdomain
+- bind_textdomain_codeset = locale.bind_textdomain_codeset
+ textdomain = locale.textdomain
+ except AttributeError:
+ logger.warning(
+@@ -117,12 +115,6 @@ def init_gettext(localepath):
+ ctypes.c_char_p,
+ )
+ bindtextdomain.restype = ctypes.c_char_p
+- bind_textdomain_codeset = libintl.bind_textdomain_codeset
+- bind_textdomain_codeset.argtypes = (
+- ctypes.c_char_p,
+- ctypes.c_char_p,
+- )
+- bind_textdomain_codeset.restype = ctypes.c_char_p
+ textdomain = libintl.textdomain
+ textdomain.argtypes = (
+ ctypes.c_char_p,
+@@ -177,35 +169,22 @@ def init_gettext(localepath):
+ # complete set from the same source.
+ # Required for translatable strings in GtkBuilder XML
+ # to be translated.
+- if bindtextdomain and bind_textdomain_codeset and textdomain:
++ if bindtextdomain and textdomain:
+ assert os.path.exists(path)
+ assert os.path.isdir(path)
+ if sys.platform == 'win32':
+ p = bindtextdomain(dom.encode('utf-8'), path.encode('utf-8'))
+- c = bind_textdomain_codeset(
+- dom.encode('utf-8'), codeset.encode('utf-8')
+- )
+ else:
+ p = bindtextdomain(dom, path)
+- c = bind_textdomain_codeset(dom, codeset)
+ logger.debug("C bindtextdomain(%r, %r): %r", dom, path, p)
+- logger.debug(
+- "C bind_textdomain_codeset(%r, %r): %r",
+- dom, codeset, c,
+- )
+ # Call the implementations in Python's standard gettext module
+ # too. This has proper cross-platform support, but it only
+ # initializes the native Python "gettext" module.
+ # Required for marked strings in Python source to be translated.
+ # See http://docs.python.org/release/2.7/library/locale.html
+ p = gettext.bindtextdomain(dom, path)
+- c = gettext.bind_textdomain_codeset(dom, codeset)
+ logger.debug("Python bindtextdomain(%r, %r): %r", dom, path, p)
+- logger.debug(
+- "Python bind_textdomain_codeset(%r, %r): %r",
+- dom, codeset, c,
+- )
+- if bindtextdomain and bind_textdomain_codeset and textdomain:
++ if bindtextdomain and textdomain:
+ if sys.platform == 'win32':
+ d = textdomain(defaultdom.encode('utf-8'))
+ else:
+--- a/setup.py
++++ b/setup.py
+@@ -679,7 +679,7 @@ def _install_script(self, src, header):
+ self.announce("installing %s as %s" % (src, targ_basename), level=2)
+ if self.dry_run:
+ return []
+- with open(src, "rU") as in_fp:
++ with open(src, "r") as in_fp:
+ with open(targ, "w") as out_fp:
+ line = in_fp.readline().rstrip()
+ if line.startswith("#!"):
+
diff --git a/media-gfx/mypaint/files/mypaint-2.0.1-setuptools.patch b/media-gfx/mypaint/files/mypaint-2.0.1-setuptools.patch
new file mode 100644
index 000000000000..352e23aceb7d
--- /dev/null
+++ b/media-gfx/mypaint/files/mypaint-2.0.1-setuptools.patch
@@ -0,0 +1,74 @@
+https://github.com/mypaint/mypaint/commit/1e97b4e1c0ea785b527ea63bf19f8554f3a25319
+https://github.com/mypaint/mypaint/commit/423950bec96d6057eac70442de577364d784a847
+
+From 1e97b4e1c0ea785b527ea63bf19f8554f3a25319 Mon Sep 17 00:00:00 2001
+From: Jan Tojnar <jtojnar@gmail.com>
+Date: Wed, 6 Apr 2022 22:55:21 +0200
+Subject: [PATCH] setup.py:
+
+Setuptools 54.1.0+ complains:
+
+ lib/python3.9/site-packages/setuptools/dist.py:732: UserWarning: Usage of dash-separated 'install-data' will not be supported in future versions. Please use the underscore name 'install_data' instead
+
+https://github.com/pypa/setuptools/commit/a2e9ae4cb75f9b00ddf37713ec307e5f00869737
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -7,11 +7,11 @@
+
+ [install]
+ verbose=1
+-install-scripts=$base/bin
+-install-platlib=$base/lib/mypaint
+-install-purelib=$base/lib/mypaint
+-install-data=$base/share
+-install-headers=$base/include
++install_scripts=$base/bin
++install_platlib=$base/lib/mypaint
++install_purelib=$base/lib/mypaint
++install_data=$base/share
++install_headers=$base/include
+
+ [nosetests]
+ with-doctest=1
+
+From 423950bec96d6057eac70442de577364d784a847 Mon Sep 17 00:00:00 2001
+From: Jan Tojnar <jtojnar@gmail.com>
+Date: Wed, 6 Apr 2022 23:13:06 +0200
+Subject: [PATCH] setup.py: Ensure setuptools-compatible distutils are used
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Setuptools is warning:
+
+ lib/python3.9/site-packages/_distutils_hack/__init__.py:17: UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.
+
+And in fact, I am getting such errors:
+
+ distutils.errors.DistutilsClassError: command class <class '__main__.Build'> must subclass Command
+
+Let’s do as asked.
+--- a/setup.py
++++ b/setup.py
+@@ -16,9 +16,6 @@
+ import shutil
+ import functools
+
+-from distutils.command.build import build
+-from distutils.command.clean import clean
+-
+ from setuptools import setup
+ from setuptools import Extension
+ from setuptools import Command
+@@ -26,6 +23,11 @@
+ from setuptools.command.install import install
+ from setuptools.command.install_scripts import install_scripts
+
++# setuptools must be imported first since they ensure
++# their distutils implementation will be used.
++from distutils.command.build import build
++from distutils.command.clean import clean
++
+ # Constants
+
+
diff --git a/media-gfx/mypaint/mypaint-2.0.1-r3.ebuild b/media-gfx/mypaint/mypaint-2.0.1-r3.ebuild
new file mode 100644
index 000000000000..a491c415a316
--- /dev/null
+++ b/media-gfx/mypaint/mypaint-2.0.1-r3.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..11} )
+DISTUTILS_SINGLE_IMPL=1
+
+inherit desktop distutils-r1 xdg
+
+DESCRIPTION="Fast and easy graphics application for digital painters"
+HOMEPAGE="http://mypaint.org/"
+SRC_URI="https://github.com/mypaint/${PN}/releases/download/v${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="openmp"
+LANGS="cs de en_CA en_GB es fr hu id it ja ko nb nn_NO pl pt_BR ro ru sl sv uk zh_CN zh_TW"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ $(python_gen_cond_dep '
+ dev-python/pygobject:3[${PYTHON_USEDEP}]
+ dev-python/numpy[${PYTHON_USEDEP}]
+ >=dev-python/pycairo-1.4[${PYTHON_USEDEP}]
+ dev-python/protobuf-python[${PYTHON_USEDEP}]
+ ')
+ >=dev-libs/json-c-0.11:=
+ gnome-base/librsvg
+ media-gfx/mypaint-brushes:2.0
+ media-libs/lcms:2
+ >=media-libs/libmypaint-1.5.0[openmp?]
+ media-libs/libpng:=
+ sys-devel/gettext
+ sys-libs/libomp
+ x11-libs/gdk-pixbuf[jpeg]
+ x11-libs/gtk+:3
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ ${PYTHON_DEPS}
+ dev-lang/swig
+ sys-devel/gettext
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.0.1-r1-build-system.patch
+ "${FILESDIR}"/${P}-GIL-hold.patch
+ "${FILESDIR}"/${P}-setuptools.patch
+ "${FILESDIR}"/${PN}-2.0.1-python3.11.patch
+)
+
+distutils_enable_tests setup.py
+
+src_compile() {
+ # --disable-openmp can't be passed to setup.py build,
+ # only setup.py build_ext.
+ # Trying to call build_ext then build and such fails.
+ #
+ # We just override the environment instead for simplicity.
+ local openmp=$(usex openmp '-fopenmp' '-fno-openmp')
+
+ OPENMP_CFLAG="${openmp}" OPENMP_LDFLAG="${openmp}" distutils-r1_src_compile
+}
+
+src_install() {
+ distutils-r1_src_install
+
+ newicon pixmaps/${PN}_logo.png ${PN}.png
+
+ local lang=
+ for lang in ${LANGS}; do
+ if ! has ${lang} ${LINGUAS}; then
+ rm -rf "${ED}"/usr/share/locale/${lang} || die
+ fi
+ done
+}