1
0

Accepting request 880504 from home:bnavigator:branches:devel:languages:python

- Update to 29.0
  * Support cmarkgfm>=0.5.0 (#180)
  * Drop support for Python 2 and 3.5 (#188)
- Release 28.0
  * Support Python 3.9 (#176)
- Release 27.0
  * Add support for align attribute rendering Markdown headers
    (#173)
- Add remove-mock.patch and remove-six.patch to reduce outdated
  dependecies -- gh#pypa/readme_renderer#192
-

OBS-URL: https://build.opensuse.org/request/show/880504
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-readme_renderer?expand=0&rev=13
This commit is contained in:
Dirk Mueller 2021-03-22 22:13:51 +00:00 committed by Git OBS Bridge
parent e5de9cad1f
commit d49c45c547
6 changed files with 237 additions and 17 deletions

View File

@ -1,4 +1,18 @@
-------------------------------------------------------------------
Mon Mar 22 10:45:29 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Update to 29.0
* Support cmarkgfm>=0.5.0 (#180)
* Drop support for Python 2 and 3.5 (#188)
- Release 28.0
* Support Python 3.9 (#176)
- Release 27.0
* Add support for align attribute rendering Markdown headers
(#173)
- Add remove-mock.patch and remove-six.patch to reduce outdated
dependecies -- gh#pypa/readme_renderer#192
--------------------------------------------------------------------
Mon Aug 3 11:54:02 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Update to 26.0

View File

@ -1,7 +1,7 @@
#
# spec file for package python-readme_renderer
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,29 +19,28 @@
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-readme_renderer
Version: 26.0
Version: 29.0
Release: 0
Summary: A library for rendering "readme" descriptions
License: Apache-2.0
URL: https://github.com/pypa/readme_renderer
Source: https://files.pythonhosted.org/packages/source/r/readme_renderer/readme_renderer-%{version}.tar.gz
BuildRequires: %{python_module Pygments >= 2.5.2}
BuildRequires: %{python_module bleach >= 3.0.0}
BuildRequires: %{python_module check-manifest}
BuildRequires: %{python_module cmarkgfm >= 0.2.0}
BuildRequires: %{python_module devel}
# PATCH-FIX-UPSTREAM remove-mock.patch -- part of gh#pypa/readme_renderer#192
Patch0: https://github.com/pypa/readme_renderer/commit/091bcd6.patch#/remove-mock.patch
# PATCH-FIX-UPSTREAM remove-six.patch -- part of gh#pypa/readme_renderer#192
Patch1: https://github.com/pypa/readme_renderer/commit/690e524.patch#/remove-six.patch
BuildRequires: %{python_module Pygments >= 2.5.1}
BuildRequires: %{python_module bleach >= 2.1.0}
BuildRequires: %{python_module cmarkgfm >= 0.5.0}
BuildRequires: %{python_module docutils >= 0.13.1}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Pygments
Requires: python-bleach >= 3.0.0
Requires: python-Pygments >= 2.5.1
Requires: python-bleach >= 2.1.0
Requires: python-docutils >= 0.13.1
Requires: python-six
Recommends: python-cmarkgfm >= 0.2.0
Recommends: python-cmarkgfm >= 0.5.0
BuildArch: noarch
%python_subpackages
@ -51,7 +50,7 @@ into HTML. It is designed to be used in Warehouse to render the
long_description for packages.
%prep
%setup -q -n readme_renderer-%{version}
%autosetup -p1 -n readme_renderer-%{version}
%build
%python_build

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cbe9db71defedd2428a1589cdc545f9bd98e59297449f69d721ef8f1cfced68d
size 27068

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92fd5ac2bf8677f310f3303aa4bce5b9d5f9f2094ab98c29f13791d7b805a3db
size 27169

117
remove-mock.patch Normal file
View File

@ -0,0 +1,117 @@
From 091bcd67ada85e54b534a71fd63e5997120590a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Tue, 23 Feb 2021 08:32:32 +0100
Subject: [PATCH] Use built-in Python 3 unittest.mock module
Replace the use of external 'mock' package with the 'unittest.mock'
module provided by Python 3. Since Python 2 is no longer supported,
this eliminates an unnecessary dependency.
---
tests/test_integration_distutils.py | 26 +++++++++++++-------------
tox.ini | 1 -
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/tests/test_integration_distutils.py b/tests/test_integration_distutils.py
index 8118692..55a857e 100644
--- a/tests/test_integration_distutils.py
+++ b/tests/test_integration_distutils.py
@@ -1,6 +1,6 @@
import distutils.dist
+import unittest.mock
-import mock
import pytest
import setuptools.dist
@@ -11,7 +11,7 @@ def test_valid_rst():
dist = distutils.dist.Distribution(attrs=dict(
long_description="Hello, I am some text."))
checker = readme_renderer.integration.distutils.Check(dist)
- checker.warn = mock.Mock()
+ checker.warn = unittest.mock.Mock()
checker.check_restructuredtext()
@@ -22,14 +22,14 @@ def test_invalid_rst():
dist = distutils.dist.Distribution(attrs=dict(
long_description="Hello, I am some `totally borked< text."))
checker = readme_renderer.integration.distutils.Check(dist)
- checker.warn = mock.Mock()
- checker.announce = mock.Mock()
+ checker.warn = unittest.mock.Mock()
+ checker.announce = unittest.mock.Mock()
checker.check_restructuredtext()
# Should warn once for the syntax error, and finally to warn that the
# overall syntax is invalid
- checker.warn.assert_called_once_with(mock.ANY)
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
message = checker.warn.call_args[0][0]
assert 'invalid markup' in message
assert 'line 1: Warning:' in message
@@ -47,14 +47,14 @@ def test_malicious_rst():
dist = distutils.dist.Distribution(attrs=dict(
long_description=description))
checker = readme_renderer.integration.distutils.Check(dist)
- checker.warn = mock.Mock()
- checker.announce = mock.Mock()
+ checker.warn = unittest.mock.Mock()
+ checker.announce = unittest.mock.Mock()
checker.check_restructuredtext()
# Should warn once for the syntax error, and finally to warn that the
# overall syntax is invalid
- checker.warn.assert_called_once_with(mock.ANY)
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
message = checker.warn.call_args[0][0]
assert 'directive disabled' in message
@@ -68,7 +68,7 @@ def test_markdown():
long_description="Hello, I am some text.",
long_description_content_type="text/markdown"))
checker = readme_renderer.integration.distutils.Check(dist)
- checker.warn = mock.Mock()
+ checker.warn = unittest.mock.Mock()
checker.check_restructuredtext()
@@ -79,11 +79,11 @@ def test_markdown():
def test_invalid_missing():
dist = distutils.dist.Distribution(attrs=dict())
checker = readme_renderer.integration.distutils.Check(dist)
- checker.warn = mock.Mock()
+ checker.warn = unittest.mock.Mock()
checker.check_restructuredtext()
- checker.warn.assert_called_once_with(mock.ANY)
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
assert 'missing' in checker.warn.call_args[0][0]
@@ -91,9 +91,9 @@ def test_invalid_empty():
dist = distutils.dist.Distribution(attrs=dict(
long_description=""))
checker = readme_renderer.integration.distutils.Check(dist)
- checker.warn = mock.Mock()
+ checker.warn = unittest.mock.Mock()
checker.check_restructuredtext()
- checker.warn.assert_called_once_with(mock.ANY)
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
assert 'missing' in checker.warn.call_args[0][0]
diff --git a/tox.ini b/tox.ini
index 70fdc66..5edb19f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,6 @@ envlist = py36,py37,py38,py39,pep8,packaging,noextra
[testenv]
deps =
pytest
- mock
commands =
py.test --strict {posargs}
extras = md

90
remove-six.patch Normal file
View File

@ -0,0 +1,90 @@
From 690e5248960280232315f804e1f0c6bf7a1d3348 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Tue, 23 Feb 2021 08:58:46 +0100
Subject: [PATCH] Remove the use of six since only Python 3 is supported
---
readme_renderer/integration/distutils.py | 2 --
readme_renderer/markdown.py | 9 ++-------
setup.py | 2 +-
tests/test_rst.py | 3 +--
4 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/readme_renderer/integration/distutils.py b/readme_renderer/integration/distutils.py
index 98d0f08..eb04460 100644
--- a/readme_renderer/integration/distutils.py
+++ b/readme_renderer/integration/distutils.py
@@ -20,7 +20,6 @@
import distutils.log
from distutils.command.check import check as _check
from distutils.core import Command
-import six
from ..rst import render
@@ -35,7 +34,6 @@
r'(?P<message>.*)', re.DOTALL | re.MULTILINE)
-@six.python_2_unicode_compatible
class _WarningStream(object):
def __init__(self):
self.output = io.StringIO()
diff --git a/readme_renderer/markdown.py b/readme_renderer/markdown.py
index ca2f03f..ae32539 100644
--- a/readme_renderer/markdown.py
+++ b/readme_renderer/markdown.py
@@ -16,17 +16,12 @@
import re
import warnings
+from html.parser import unescape
+
import pygments
import pygments.lexers
import pygments.formatters
-try:
- from six.moves.html_parser import unescape
-except ImportError: # Python 2
- from six.moves import html_parser
-
- unescape = html_parser.HTMLParser().unescape
-
from .clean import clean
_EXTRA_WARNING = (
diff --git a/setup.py b/setup.py
index ff1feaf..c8e35c1 100644
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,7 @@
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
- install_requires=["bleach>=2.1.0", "docutils>=0.13.1", "Pygments>=2.5.1", "six"],
+ install_requires=["bleach>=2.1.0", "docutils>=0.13.1", "Pygments>=2.5.1"],
entry_points={
"distutils.commands": ["check = readme_renderer.integration.distutils:Check"],
},
diff --git a/tests/test_rst.py b/tests/test_rst.py
index 3de3dbf..64e552c 100755
--- a/tests/test_rst.py
+++ b/tests/test_rst.py
@@ -3,7 +3,6 @@
import os.path
import pytest
-import six
from readme_renderer.rst import render
@@ -46,7 +45,7 @@ def test_rst_002():
def test_rst_raw():
- warnings = six.StringIO()
+ warnings = io.StringIO()
assert render("""
.. raw:: html
<script>I am evil</script>