Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/fonttools/, dev-python/fonttools/files/
Date: Mon, 27 Feb 2023 15:43:25
Message-Id: 1677512599.7d043cbaeda9ad1128fe8130ca31738371e02233.mgorny@gentoo
1 commit: 7d043cbaeda9ad1128fe8130ca31738371e02233
2 Author: Jérôme Carretero <cJ-gentoo <AT> zougloub <DOT> eu>
3 AuthorDate: Fri Feb 17 19:08:41 2023 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 27 15:43:19 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d043cba
7
8 dev-python/fonttools: add pypy3 to PYTHON_COMPAT
9
10 Signed-off-by: Jérôme Carretero <cJ-gentoo <AT> zougloub.eu>
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 .../fonttools/files/fonttools-4.38.0-pypy3.patch | 34 +++++++++++
14 dev-python/fonttools/fonttools-4.38.0-r1.ebuild | 70 ++++++++++++++++++++++
15 2 files changed, 104 insertions(+)
16
17 diff --git a/dev-python/fonttools/files/fonttools-4.38.0-pypy3.patch b/dev-python/fonttools/files/fonttools-4.38.0-pypy3.patch
18 new file mode 100644
19 index 000000000000..4a85cde3891e
20 --- /dev/null
21 +++ b/dev-python/fonttools/files/fonttools-4.38.0-pypy3.patch
22 @@ -0,0 +1,34 @@
23 +url: https://github.com/fonttools/fonttools/issues/2996
24 +
25 +commit ca9d98d94c3ba98db934f0d1e3a77134171f2262
26 +Author: Jérôme Carretero <cJ-gentoo@××××××××.eu>
27 +Date: Fri Feb 17 19:24:46 2023 -0500
28 +
29 + Fixup pypy3 compatibility
30 +
31 +diff --git a/Lib/fontTools/misc/macCreatorType.py b/Lib/fontTools/misc/macCreatorType.py
32 +index 6b191054b..f680f238d 100644
33 +--- a/Lib/fontTools/misc/macCreatorType.py
34 ++++ b/Lib/fontTools/misc/macCreatorType.py
35 +@@ -24,7 +24,7 @@ def getMacCreatorAndType(path):
36 + """
37 + if xattr is not None:
38 + try:
39 +- finderInfo = xattr.getxattr(path, 'com.apple.FinderInfo')
40 ++ finderInfo = xattr.getxattr(str(path), 'com.apple.FinderInfo')
41 + except (KeyError, IOError):
42 + pass
43 + else:
44 +diff --git a/Lib/fontTools/subset/svg.py b/Lib/fontTools/subset/svg.py
45 +index 4ed2cbd20..4a8823928 100644
46 +--- a/Lib/fontTools/subset/svg.py
47 ++++ b/Lib/fontTools/subset/svg.py
48 +@@ -77,7 +77,7 @@ def iter_referenced_ids(tree: etree.Element) -> Iterator[str]:
49 +
50 + attrs = el.attrib
51 + if "style" in attrs:
52 +- attrs = {**attrs, **parse_css_declarations(el.attrib["style"])}
53 ++ attrs = {**dict(attrs), **dict(parse_css_declarations(el.attrib["style"]))}
54 + for attr in ("fill", "clip-path"):
55 + if attr in attrs:
56 + value = attrs[attr]
57
58 diff --git a/dev-python/fonttools/fonttools-4.38.0-r1.ebuild b/dev-python/fonttools/fonttools-4.38.0-r1.ebuild
59 new file mode 100644
60 index 000000000000..d401fb8fb46d
61 --- /dev/null
62 +++ b/dev-python/fonttools/fonttools-4.38.0-r1.ebuild
63 @@ -0,0 +1,70 @@
64 +# Copyright 1999-2023 Gentoo Authors
65 +# Distributed under the terms of the GNU General Public License v2
66 +
67 +EAPI=8
68 +
69 +DISTUTILS_USE_PEP517=setuptools
70 +PYTHON_COMPAT=( python3_{9..11} pypy3 )
71 +PYTHON_REQ_USE="xml(+)"
72 +
73 +inherit distutils-r1 virtualx
74 +
75 +DESCRIPTION="Library for manipulating TrueType, OpenType, AFM and Type1 fonts"
76 +HOMEPAGE="
77 + https://github.com/fonttools/fonttools/
78 + https://pypi.org/project/fonttools/
79 +"
80 +SRC_URI="
81 + https://github.com/fonttools/fonttools/archive/${PV}.tar.gz
82 + -> ${P}.gh.tar.gz
83 +"
84 +
85 +LICENSE="BSD"
86 +SLOT="0"
87 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
88 +
89 +RDEPEND="
90 + >=dev-python/fs-2.4.9[${PYTHON_USEDEP}]
91 +"
92 +BDEPEND="
93 + dev-python/cython[${PYTHON_USEDEP}]
94 + test? (
95 + app-arch/brotli[python,${PYTHON_USEDEP}]
96 + app-arch/zopfli
97 + )
98 +"
99 +
100 +PATCHES=(
101 + "${FILESDIR}/fonttools-4.38.0-pypy3.patch"
102 +)
103 +
104 +distutils_enable_tests pytest
105 +
106 +python_prepare_all() {
107 + # When dev-python/pytest-shutil is installed, we get weird import errors.
108 + # This is due to incomplete nesting in the Tests/ tree:
109 + #
110 + # Tests/feaLib/__init__.py
111 + # Tests/ufoLib/__init__.py
112 + # Tests/svgLib/path/__init__.py
113 + # Tests/otlLib/__init__.py
114 + # Tests/varLib/__init__.py
115 + #
116 + # This tree requires an __init__.py in Tests/svgLib/ too, bug #701148.
117 + touch Tests/svgLib/__init__.py || die
118 +
119 + distutils-r1_python_prepare_all
120 +}
121 +
122 +src_configure() {
123 + export FONTTOOLS_WITH_CYTHON=1
124 +}
125 +
126 +src_test() {
127 + # virtualx used when matplotlib is installed causing plot module tests to run
128 + virtx distutils-r1_src_test
129 +}
130 +
131 +python_test() {
132 + epytest Tests fontTools || die "Tests failed with ${EPYTHON}"
133 +}