1 |
commit: d742652dd114a3f4661a0da49bec81835c2bd6b7 |
2 |
Author: Florian Schmaus <flow <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Oct 28 18:22:37 2022 +0000 |
4 |
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 29 16:46:28 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d742652d |
7 |
|
8 |
app-text/xml2rfc: new package, add 3.15.2 |
9 |
|
10 |
Closes: https://github.com/gentoo/gentoo/pull/27749 |
11 |
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> |
12 |
|
13 |
app-text/xml2rfc/Manifest | 1 + |
14 |
.../xml2rfc/files/xml2rfc-Remove-broken-test.patch | 79 ++++++++++++++++++++++ |
15 |
app-text/xml2rfc/metadata.xml | 12 ++++ |
16 |
app-text/xml2rfc/xml2rfc-3.15.2.ebuild | 54 +++++++++++++++ |
17 |
4 files changed, 146 insertions(+) |
18 |
|
19 |
diff --git a/app-text/xml2rfc/Manifest b/app-text/xml2rfc/Manifest |
20 |
new file mode 100644 |
21 |
index 000000000000..2d450428dc8f |
22 |
--- /dev/null |
23 |
+++ b/app-text/xml2rfc/Manifest |
24 |
@@ -0,0 +1 @@ |
25 |
+DIST xml2rfc-3.15.2.gh.tar.gz 2849091 BLAKE2B e792d07a2c8123dc32f4c2cfe794420f98db13da1812a4a7e82a4f2a2e2e70fa0e6b7385e189e70eba47c9be7e0ac281d3858437103b828ea8dbaaf8cef73b87 SHA512 5953ae40ad479b0aa6ab90f08f235ceddfa9c7e1edd868ee43bfd261f4c4d0fdfbbe052ff8a3274c39d283efc1105a0be3b4578fa372269f3274a72acdc950e8 |
26 |
|
27 |
diff --git a/app-text/xml2rfc/files/xml2rfc-Remove-broken-test.patch b/app-text/xml2rfc/files/xml2rfc-Remove-broken-test.patch |
28 |
new file mode 100644 |
29 |
index 000000000000..d7d027962c24 |
30 |
--- /dev/null |
31 |
+++ b/app-text/xml2rfc/files/xml2rfc-Remove-broken-test.patch |
32 |
@@ -0,0 +1,79 @@ |
33 |
+From ed27e2983c27065bd88ac82cd26a5b9128544b45 Mon Sep 17 00:00:00 2001 |
34 |
+From: Florian Schmaus <flo@×××××××××.eu> |
35 |
+Date: Fri, 28 Oct 2022 20:18:10 +0200 |
36 |
+Subject: [PATCH] Remove broken test |
37 |
+ |
38 |
+--- a/test.py |
39 |
++++ b/test.py |
40 |
+@@ -466,71 +466,6 @@ class WriterRfcTest(WriterRootTest): |
41 |
+ return self.status_test() |
42 |
+ |
43 |
+ |
44 |
+-class PdfWriterTests(unittest.TestCase): |
45 |
+- elements_root = None |
46 |
+- elements_pdfxml = None |
47 |
+- |
48 |
+- @classmethod |
49 |
+- def setUpClass(cls) -> None: |
50 |
+- # Putting this in setUpClass() allows this module to be imported even if this |
51 |
+- # procedure will fail. This improves some error messages and makes debugging |
52 |
+- # a little bit easier. The setUpClass() method is run by unittest during init. |
53 |
+- # This happens only once, avoiding repeated execution of slow operations. |
54 |
+- def _pdfwriter(path): |
55 |
+- """ Parse a minimal RFC tree and instantiate a writer """ |
56 |
+- parser = xml2rfc.XmlRfcParser(path, quiet=True, **options_for_xmlrfcparser) |
57 |
+- xmlrfc = parser.parse() |
58 |
+- writer = xml2rfc.writers.pdf.PdfWriter(xmlrfc, quiet=True, ) |
59 |
+- return writer |
60 |
+- |
61 |
+- elements_writer = _pdfwriter('tests/input/elements.xml') |
62 |
+- try: |
63 |
+- elements_pdfdoc = elements_writer.pdf() # has side effects on .root |
64 |
+- except Exception as e: |
65 |
+- print(e) |
66 |
+- raise |
67 |
+- cls.pdf_writer = elements_writer |
68 |
+- cls.elements_root = elements_writer.root |
69 |
+- cls.elements_pdfxml = xmldoc(None, bytes=elements_pdfdoc) |
70 |
+- |
71 |
+- def setUp(self): |
72 |
+- xml2rfc.log.quiet = True |
73 |
+- self.pdfxml = copy.deepcopy(self.elements_pdfxml) |
74 |
+- self.root = copy.deepcopy(self.elements_root) |
75 |
+- |
76 |
+- def test_text_content(self): |
77 |
+- def norm(t): |
78 |
+- return re.sub(r'\s+', ' ', t).strip() |
79 |
+- # |
80 |
+- text = norm('\n'.join( p.text for p in self.pdfxml.xpath('.//Page/text') )) |
81 |
+- for e in self.root.xpath('./middle//*'): |
82 |
+- if e.text and e.text.strip() and e.tag not in xml2rfc.util.unicode.unicode_content_tags and not xml2rfc.util.unicode.is_svg(e): |
83 |
+- t = norm(e.text.split(None, 1)[0]) |
84 |
+- self.assertIn(t, text) |
85 |
+- |
86 |
+- def test_included_fonts(self): |
87 |
+- if xml2rfc.HAVE_WEASYPRINT and xml2rfc.HAVE_PANGO: |
88 |
+- font_families = set([ f.text for f in self.pdfxml.xpath('.//FontFamily') ]) |
89 |
+- for script in self.root.get('scripts').split(','): |
90 |
+- family = xml2rfc.util.fonts.get_noto_serif_family_for_script(script) |
91 |
+- self.assertIn(family, font_families, 'Missing font match for %s' % script) |
92 |
+- |
93 |
+- def test_flatten_unicode_spans(self): |
94 |
+- input_html = '<body><p>f<span class="unicode">o</span>o<span class="unicode">ba</span>r</p></body>' |
95 |
+- output_html = self.pdf_writer.flatten_unicode_spans(input_html) |
96 |
+- self.assertEqual(output_html, '<body><p>foobar</p></body>') |
97 |
+- |
98 |
+- def test_get_serif_fonts(self): |
99 |
+- fonts = self.pdf_writer.get_serif_fonts() |
100 |
+- for font in ['Noto Serif', 'Noto Sans Cherokee', 'Noto Serif CJK SC', 'Noto Serif Hebrew']: |
101 |
+- self.assertIn(font, fonts) |
102 |
+- |
103 |
+- def test_get_mono_fonts(self): |
104 |
+- fonts = self.pdf_writer.get_mono_fonts() |
105 |
+- for font in ['Roboto Mono', 'Noto Sans Cherokee', 'Noto Serif CJK SC', 'Noto Serif Hebrew']: |
106 |
+- self.assertIn(font, fonts) |
107 |
+- |
108 |
+- |
109 |
+ class HtmlWriterTest(unittest.TestCase): |
110 |
+ '''HtmlWriter tests''' |
111 |
+ |
112 |
|
113 |
diff --git a/app-text/xml2rfc/metadata.xml b/app-text/xml2rfc/metadata.xml |
114 |
new file mode 100644 |
115 |
index 000000000000..53c1b948fa53 |
116 |
--- /dev/null |
117 |
+++ b/app-text/xml2rfc/metadata.xml |
118 |
@@ -0,0 +1,12 @@ |
119 |
+<?xml version="1.0" encoding="UTF-8"?> |
120 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
121 |
+<pkgmetadata> |
122 |
+ <maintainer type="person"> |
123 |
+ <name>Florian Schmaus</name> |
124 |
+ <email>flow@g.o</email> |
125 |
+ </maintainer> |
126 |
+ <upstream> |
127 |
+ <remote-id type="pypi">xml2rfc</remote-id> |
128 |
+ <remote-id type="github">ietf-tools/xml2rfc</remote-id> |
129 |
+ </upstream> |
130 |
+</pkgmetadata> |
131 |
|
132 |
diff --git a/app-text/xml2rfc/xml2rfc-3.15.2.ebuild b/app-text/xml2rfc/xml2rfc-3.15.2.ebuild |
133 |
new file mode 100644 |
134 |
index 000000000000..fb60768a8577 |
135 |
--- /dev/null |
136 |
+++ b/app-text/xml2rfc/xml2rfc-3.15.2.ebuild |
137 |
@@ -0,0 +1,54 @@ |
138 |
+# Copyright 1999-2022 Gentoo Authors |
139 |
+# Distributed under the terms of the GNU General Public License v2 |
140 |
+ |
141 |
+EAPI=8 |
142 |
+ |
143 |
+DISTUTILS_USE_PEP517=setuptools |
144 |
+PYTHON_COMPAT=( python3_{8..10} ) |
145 |
+ |
146 |
+inherit distutils-r1 |
147 |
+ |
148 |
+DESCRIPTION="Generates RFCs and IETF drafts from document source in XML" |
149 |
+HOMEPAGE="https://ietf-tools.github.io/xml2rfc/ https://github.com/ietf-tools/xml2rfc" |
150 |
+SRC_URI="https://github.com/ietf-tools/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz" |
151 |
+ |
152 |
+RESTRICT="!test? ( test )" |
153 |
+LICENSE="BSD" |
154 |
+SLOT="0" |
155 |
+KEYWORDS="~amd64" |
156 |
+ |
157 |
+BDEPEND=" |
158 |
+ test? ( |
159 |
+ dev-python/PyPDF2[${PYTHON_USEDEP}] |
160 |
+ dev-python/decorator[${PYTHON_USEDEP}] |
161 |
+ dev-python/dict2xml[${PYTHON_USEDEP}] |
162 |
+ dev-python/weasyprint[${PYTHON_USEDEP}] |
163 |
+ media-fonts/noto[cjk] |
164 |
+ ) |
165 |
+" |
166 |
+ |
167 |
+RDEPEND=" |
168 |
+ dev-python/appdirs[${PYTHON_USEDEP}] |
169 |
+ dev-python/ConfigArgParse[${PYTHON_USEDEP}] |
170 |
+ dev-python/intervaltree[${PYTHON_USEDEP}] |
171 |
+ dev-python/google-i18n-address[${PYTHON_USEDEP}] |
172 |
+ >=dev-python/html5lib-1.0.1[${PYTHON_USEDEP}] |
173 |
+ >=dev-python/jinja-3.1.2[${PYTHON_USEDEP}] |
174 |
+ dev-python/lxml[${PYTHON_USEDEP}] |
175 |
+ >=dev-python/markupsafe-2.1.1[${PYTHON_USEDEP}] |
176 |
+ dev-python/pycountry[${PYTHON_USEDEP}] |
177 |
+ >=dev-python/pyyaml-5.3.1[${PYTHON_USEDEP}] |
178 |
+ dev-python/requests[${PYTHON_USEDEP}] |
179 |
+ dev-python/six[${PYTHON_USEDEP}] |
180 |
+" |
181 |
+ |
182 |
+PATCHES=( |
183 |
+ "${FILESDIR}/xml2rfc-Remove-broken-test.patch" |
184 |
+) |
185 |
+ |
186 |
+distutils_enable_tests setup.py |
187 |
+ |
188 |
+#src_test() { |
189 |
+ # https://github.com/ietf-tools/xml2rfc/issues/561 |
190 |
+# emake tests-no-network |
191 |
+#} |