diff options
author | Florian Schmaus <flow@gentoo.org> | 2022-10-28 20:22:37 +0200 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2022-10-29 18:46:28 +0200 |
commit | d742652dd114a3f4661a0da49bec81835c2bd6b7 (patch) | |
tree | 439ca01bd1612460321c1441a5c5c86fc92e4189 /app-text | |
parent | dev-python/dict2xml: new package, add 1.7.2 (diff) | |
download | gentoo-d742652dd114a3f4661a0da49bec81835c2bd6b7.tar.gz gentoo-d742652dd114a3f4661a0da49bec81835c2bd6b7.tar.bz2 gentoo-d742652dd114a3f4661a0da49bec81835c2bd6b7.zip |
app-text/xml2rfc: new package, add 3.15.2
Closes: https://github.com/gentoo/gentoo/pull/27749
Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to 'app-text')
-rw-r--r-- | app-text/xml2rfc/Manifest | 1 | ||||
-rw-r--r-- | app-text/xml2rfc/files/xml2rfc-Remove-broken-test.patch | 79 | ||||
-rw-r--r-- | app-text/xml2rfc/metadata.xml | 12 | ||||
-rw-r--r-- | app-text/xml2rfc/xml2rfc-3.15.2.ebuild | 54 |
4 files changed, 146 insertions, 0 deletions
diff --git a/app-text/xml2rfc/Manifest b/app-text/xml2rfc/Manifest new file mode 100644 index 000000000000..2d450428dc8f --- /dev/null +++ b/app-text/xml2rfc/Manifest @@ -0,0 +1 @@ +DIST xml2rfc-3.15.2.gh.tar.gz 2849091 BLAKE2B e792d07a2c8123dc32f4c2cfe794420f98db13da1812a4a7e82a4f2a2e2e70fa0e6b7385e189e70eba47c9be7e0ac281d3858437103b828ea8dbaaf8cef73b87 SHA512 5953ae40ad479b0aa6ab90f08f235ceddfa9c7e1edd868ee43bfd261f4c4d0fdfbbe052ff8a3274c39d283efc1105a0be3b4578fa372269f3274a72acdc950e8 diff --git a/app-text/xml2rfc/files/xml2rfc-Remove-broken-test.patch b/app-text/xml2rfc/files/xml2rfc-Remove-broken-test.patch new file mode 100644 index 000000000000..d7d027962c24 --- /dev/null +++ b/app-text/xml2rfc/files/xml2rfc-Remove-broken-test.patch @@ -0,0 +1,79 @@ +From ed27e2983c27065bd88ac82cd26a5b9128544b45 Mon Sep 17 00:00:00 2001 +From: Florian Schmaus <flo@geekplace.eu> +Date: Fri, 28 Oct 2022 20:18:10 +0200 +Subject: [PATCH] Remove broken test + +--- a/test.py ++++ b/test.py +@@ -466,71 +466,6 @@ class WriterRfcTest(WriterRootTest): + return self.status_test() + + +-class PdfWriterTests(unittest.TestCase): +- elements_root = None +- elements_pdfxml = None +- +- @classmethod +- def setUpClass(cls) -> None: +- # Putting this in setUpClass() allows this module to be imported even if this +- # procedure will fail. This improves some error messages and makes debugging +- # a little bit easier. The setUpClass() method is run by unittest during init. +- # This happens only once, avoiding repeated execution of slow operations. +- def _pdfwriter(path): +- """ Parse a minimal RFC tree and instantiate a writer """ +- parser = xml2rfc.XmlRfcParser(path, quiet=True, **options_for_xmlrfcparser) +- xmlrfc = parser.parse() +- writer = xml2rfc.writers.pdf.PdfWriter(xmlrfc, quiet=True, ) +- return writer +- +- elements_writer = _pdfwriter('tests/input/elements.xml') +- try: +- elements_pdfdoc = elements_writer.pdf() # has side effects on .root +- except Exception as e: +- print(e) +- raise +- cls.pdf_writer = elements_writer +- cls.elements_root = elements_writer.root +- cls.elements_pdfxml = xmldoc(None, bytes=elements_pdfdoc) +- +- def setUp(self): +- xml2rfc.log.quiet = True +- self.pdfxml = copy.deepcopy(self.elements_pdfxml) +- self.root = copy.deepcopy(self.elements_root) +- +- def test_text_content(self): +- def norm(t): +- return re.sub(r'\s+', ' ', t).strip() +- # +- text = norm('\n'.join( p.text for p in self.pdfxml.xpath('.//Page/text') )) +- for e in self.root.xpath('./middle//*'): +- 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): +- t = norm(e.text.split(None, 1)[0]) +- self.assertIn(t, text) +- +- def test_included_fonts(self): +- if xml2rfc.HAVE_WEASYPRINT and xml2rfc.HAVE_PANGO: +- font_families = set([ f.text for f in self.pdfxml.xpath('.//FontFamily') ]) +- for script in self.root.get('scripts').split(','): +- family = xml2rfc.util.fonts.get_noto_serif_family_for_script(script) +- self.assertIn(family, font_families, 'Missing font match for %s' % script) +- +- def test_flatten_unicode_spans(self): +- input_html = '<body><p>f<span class="unicode">o</span>o<span class="unicode">ba</span>r</p></body>' +- output_html = self.pdf_writer.flatten_unicode_spans(input_html) +- self.assertEqual(output_html, '<body><p>foobar</p></body>') +- +- def test_get_serif_fonts(self): +- fonts = self.pdf_writer.get_serif_fonts() +- for font in ['Noto Serif', 'Noto Sans Cherokee', 'Noto Serif CJK SC', 'Noto Serif Hebrew']: +- self.assertIn(font, fonts) +- +- def test_get_mono_fonts(self): +- fonts = self.pdf_writer.get_mono_fonts() +- for font in ['Roboto Mono', 'Noto Sans Cherokee', 'Noto Serif CJK SC', 'Noto Serif Hebrew']: +- self.assertIn(font, fonts) +- +- + class HtmlWriterTest(unittest.TestCase): + '''HtmlWriter tests''' + diff --git a/app-text/xml2rfc/metadata.xml b/app-text/xml2rfc/metadata.xml new file mode 100644 index 000000000000..53c1b948fa53 --- /dev/null +++ b/app-text/xml2rfc/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <name>Florian Schmaus</name> + <email>flow@gentoo.org</email> + </maintainer> + <upstream> + <remote-id type="pypi">xml2rfc</remote-id> + <remote-id type="github">ietf-tools/xml2rfc</remote-id> + </upstream> +</pkgmetadata> diff --git a/app-text/xml2rfc/xml2rfc-3.15.2.ebuild b/app-text/xml2rfc/xml2rfc-3.15.2.ebuild new file mode 100644 index 000000000000..fb60768a8577 --- /dev/null +++ b/app-text/xml2rfc/xml2rfc-3.15.2.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{8..10} ) + +inherit distutils-r1 + +DESCRIPTION="Generates RFCs and IETF drafts from document source in XML" +HOMEPAGE="https://ietf-tools.github.io/xml2rfc/ https://github.com/ietf-tools/xml2rfc" +SRC_URI="https://github.com/ietf-tools/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz" + +RESTRICT="!test? ( test )" +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64" + +BDEPEND=" + test? ( + dev-python/PyPDF2[${PYTHON_USEDEP}] + dev-python/decorator[${PYTHON_USEDEP}] + dev-python/dict2xml[${PYTHON_USEDEP}] + dev-python/weasyprint[${PYTHON_USEDEP}] + media-fonts/noto[cjk] + ) +" + +RDEPEND=" + dev-python/appdirs[${PYTHON_USEDEP}] + dev-python/ConfigArgParse[${PYTHON_USEDEP}] + dev-python/intervaltree[${PYTHON_USEDEP}] + dev-python/google-i18n-address[${PYTHON_USEDEP}] + >=dev-python/html5lib-1.0.1[${PYTHON_USEDEP}] + >=dev-python/jinja-3.1.2[${PYTHON_USEDEP}] + dev-python/lxml[${PYTHON_USEDEP}] + >=dev-python/markupsafe-2.1.1[${PYTHON_USEDEP}] + dev-python/pycountry[${PYTHON_USEDEP}] + >=dev-python/pyyaml-5.3.1[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] + dev-python/six[${PYTHON_USEDEP}] +" + +PATCHES=( + "${FILESDIR}/xml2rfc-Remove-broken-test.patch" +) + +distutils_enable_tests setup.py + +#src_test() { + # https://github.com/ietf-tools/xml2rfc/issues/561 +# emake tests-no-network +#} |