From a9e69a49fccb365becc2e4754c2ee86f8a93f7794a3aa2dd6955f9ed5c6fa757 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 29 Nov 2024 00:00:36 +0000 Subject: [PATCH] - Update to 1.7.5: * Features + fix: not recognizing `yield` as a sphinx field name + feat: support epytext style + feat: use tomllib for Python 3.11+ + feat: wrap Sphinx style long parameter descriptions + feat: add option for user to provide list of words not to capitalize + Support python 3.11 * Bug Fixes + fix: summary with back ticks and sphinx field names with periods + fix: removing newline between Sphinx field lists + fix: wrapping issues with reST directives, quoted URLs, and Sphinx field lists + fix: improper wrapping of short anonymous hyperlnks + fix: removing blank line after import section + fix: IndexError when only URL in long description + fix: removing newline after shebang + fix: not capitalizing first word when summary ends in period + fix: adding newlines around wrapped URL + fix: adding blank line in summary with symbol + fix: remove blank lines after line beginning with 'def' + fix: update URL handling functions - Switch to autosetup and pyproject macros. - No more greedy globs in %files. - Add patches: * remove-mock.patch + Do not use external mock module * support-python-312.patch + Support Python 3.12+ changes * do-not-require-venv.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-docformatter?expand=0&rev=19 --- .gitattributes | 23 ++++++++ .gitignore | 1 + do-not-require-venv.patch | 15 ++++++ docformatter-1.4.tar.gz | 3 ++ docformatter-1.7.5.tar.gz | 3 ++ python-docformatter.changes | 92 ++++++++++++++++++++++++++++++++ python-docformatter.spec | 101 ++++++++++++++++++++++++++++++++++++ remove-mock.patch | 28 ++++++++++ support-python-312.patch | 76 +++++++++++++++++++++++++++ 9 files changed, 342 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 do-not-require-venv.patch create mode 100644 docformatter-1.4.tar.gz create mode 100644 docformatter-1.7.5.tar.gz create mode 100644 python-docformatter.changes create mode 100644 python-docformatter.spec create mode 100644 remove-mock.patch create mode 100644 support-python-312.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/do-not-require-venv.patch b/do-not-require-venv.patch new file mode 100644 index 0000000..4d8feda --- /dev/null +++ b/do-not-require-venv.patch @@ -0,0 +1,15 @@ +Index: docformatter-1.7.5/tests/conftest.py +=================================================================== +--- docformatter-1.7.5.orig/tests/conftest.py ++++ docformatter-1.7.5/tests/conftest.py +@@ -113,8 +113,9 @@ def run_docformatter(arguments, temporar + os.environ["VIRTUAL_ENV"] + "/bin/docformatter", + ] + else: ++ version = f"{sys.version_info.major}.{sys.version_info.minor}" + DOCFORMATTER_COMMAND = [ +- os.environ["VIRTUAL_ENV"] + "/bin/docformatter", ++ f"{os.environ['BUILDROOT']}/usr/bin/docformatter-{version}", + ] # pragma: no cover + + if "-" not in arguments: diff --git a/docformatter-1.4.tar.gz b/docformatter-1.4.tar.gz new file mode 100644 index 0000000..be8b879 --- /dev/null +++ b/docformatter-1.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:064e6d81f04ac96bc0d176cbaae953a0332482b22d3ad70d47c8a7f2732eef6f +size 208955 diff --git a/docformatter-1.7.5.tar.gz b/docformatter-1.7.5.tar.gz new file mode 100644 index 0000000..b59c96b --- /dev/null +++ b/docformatter-1.7.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d35de4c83b78172bf618500a8b0e9075378ec41aa4a71b28f2f633a60668b3ab +size 265766 diff --git a/python-docformatter.changes b/python-docformatter.changes new file mode 100644 index 0000000..55173ac --- /dev/null +++ b/python-docformatter.changes @@ -0,0 +1,92 @@ +------------------------------------------------------------------- +Fri Nov 29 00:00:01 UTC 2024 - Steve Kowalik + +- Update to 1.7.5: + * Features + + fix: not recognizing `yield` as a sphinx field name + + feat: support epytext style + + feat: use tomllib for Python 3.11+ + + feat: wrap Sphinx style long parameter descriptions + + feat: add option for user to provide list of words not to capitalize + + Support python 3.11 + * Bug Fixes + + fix: summary with back ticks and sphinx field names with periods + + fix: removing newline between Sphinx field lists + + fix: wrapping issues with reST directives, quoted URLs, and Sphinx + field lists + + fix: improper wrapping of short anonymous hyperlnks + + fix: removing blank line after import section + + fix: IndexError when only URL in long description + + fix: removing newline after shebang + + fix: not capitalizing first word when summary ends in period + + fix: adding newlines around wrapped URL + + fix: adding blank line in summary with symbol + + fix: remove blank lines after line beginning with 'def' + + fix: update URL handling functions +- Switch to autosetup and pyproject macros. +- No more greedy globs in %files. +- Add patches: + * remove-mock.patch + + Do not use external mock module + * support-python-312.patch + + Support Python 3.12+ changes + * do-not-require-venv.patch + + Do not require a virtualenv to run the testsuite + +------------------------------------------------------------------- +Thu May 20 07:18:31 UTC 2021 - pgajdos@suse.com + +- version update to 1.4 + * Add --docstring-length flag + * Not add period for summary formatted as title + * Added command line exclude option +- use %pytest macro + +------------------------------------------------------------------- +Tue May 26 07:22:42 UTC 2020 - Petr Gajdos + +- %python3_only -> %python_alternative + +------------------------------------------------------------------- +Thu Apr 2 12:38:39 UTC 2020 - Marketa Calabkova + +- update to 1.3.1 + * A pydoc reference such as ':see:' should not be start of sentence + +------------------------------------------------------------------- +Fri Jul 26 09:26:07 UTC 2019 - pgajdos@suse.com + +- version update to 1.3 + * no upstream changelog + +------------------------------------------------------------------- +Fri Mar 8 14:28:00 UTC 2019 - Tomáš Chvátal + +- Update to 1.1: + * fixes for python 3.7 + * varioius cleanups + +------------------------------------------------------------------- +Tue Dec 4 12:47:23 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Sun Jul 29 13:14:37 UTC 2018 - jengelh@inai.de + +- Use noun phrase in summary. + +------------------------------------------------------------------- +Thu May 24 17:31:41 UTC 2018 - toddrme2178@gmail.com + +- Update to version 1.0 + * Document and test disabling of wrapping + * Add @kapsh + * Make text wrapping trigger more conservative + * Adds support for argument lists +- Spec file cleanups + +------------------------------------------------------------------- +Tue Nov 7 18:41:21 UTC 2017 - toddrme2178@gmail.com + +- initial version diff --git a/python-docformatter.spec b/python-docformatter.spec new file mode 100644 index 0000000..d40ffa4 --- /dev/null +++ b/python-docformatter.spec @@ -0,0 +1,101 @@ +# +# spec file for package python-docformatter +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: python-docformatter +Version: 1.7.5 +Release: 0 +Summary: Utility to re-format docstrings per PEP 257 +License: MIT +URL: https://github.com/myint/docformatter +Source: https://github.com/PyCQA/docformatter/archive/refs/tags/v%{version}.tar.gz#/docformatter-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#PyCQA/docformatter#280 +Patch0: remove-mock.patch +# PATCH-FIX-UPSTREAM gh#PyCQA/docformatter#296 +Patch1: support-python-312.patch +# PATCH-FIX-OPENSUSE Do not require virtualenvs to run the tests +Patch2: do-not-require-venv.patch +BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module poetry-core} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-charset-normalizer +Requires: python-untokenize +Requires(post): update-alternatives +Requires(postun): update-alternatives +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module charset-normalizer >= 3.0} +BuildRequires: %{python_module untokenize} +# /SECTION +%python_subpackages + +%description +Docformatter currently automatically formats docstrings to follow a +subset of the PEP 257 conventions. Below are the relevant items quoted +from PEP 257. + +- For consistency, always use triple double quotes around docstrings. +- Triple quotes are used even though the string fits on one line. +- Multi-line docstrings consist of a summary line just like a one-line + docstring, followed by a blank line, followed by a more elaborate + description. +- The BDFL recommends inserting a blank line between the last paragraph + in a multi-line docstring and its closing quotes, placing the closing + quotes on a line by themselves. + +docformatter also handles some of the PEP 8 conventions. + +- Don't write string literals that rely on significant trailing + whitespace. Such trailing whitespace is visually indistinguishable + and some editors (or more recently, reindent.py) will trim them. + +%prep +%autosetup -p1 -n docformatter-%{version} +sed -i -e '/^#!\//, 1d' src/docformatter/*.py +chmod -x src/docformatter/__main__.py + +%build +%pyproject_wheel + +%install +%pyproject_install +# Do not install LICENSE +%python_expand rm %{buildroot}%{$python_sitelib}/LICENSE +%python_clone -a %{buildroot}%{_bindir}/docformatter +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export BUILDROOT=%{buildroot} +%pytest + +%post +%python_install_alternative docformatter + +%postun +%python_uninstall_alternative docformatter + +%files %{python_files} +%license LICENSE +%doc AUTHORS.rst README.rst +%python_alternative %{_bindir}/docformatter +%{python_sitelib}/docformatter +%{python_sitelib}/docformatter-%{version}.dist-info + +%changelog diff --git a/remove-mock.patch b/remove-mock.patch new file mode 100644 index 0000000..53c3225 --- /dev/null +++ b/remove-mock.patch @@ -0,0 +1,28 @@ +From ba56f8498a1ebed724316e3affcc2c98eeac4ca7 Mon Sep 17 00:00:00 2001 +From: Alexandre Detiste +Date: Sat, 27 Apr 2024 13:44:08 +0200 +Subject: [PATCH] prefer new unittest.mock from the standard library + +--- + tests/test_utility_functions.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tests/test_utility_functions.py b/tests/test_utility_functions.py +index c9fffd3..e127f33 100644 +--- a/tests/test_utility_functions.py ++++ b/tests/test_utility_functions.py +@@ -36,9 +36,13 @@ + - is_some_sort_of_code() + """ + ++try: ++ from unittest.mock import patch ++except ImportError: ++ from mock import patch ++ + # Third Party Imports + import pytest +-from mock import patch + + # docformatter Package Imports + import docformatter diff --git a/support-python-312.patch b/support-python-312.patch new file mode 100644 index 0000000..9a42cbb --- /dev/null +++ b/support-python-312.patch @@ -0,0 +1,76 @@ +From ea60c5528506361f1f9edbeabb75ff874bb77046 Mon Sep 17 00:00:00 2001 +From: finswimmer +Date: Sat, 19 Oct 2024 13:22:28 +0200 +Subject: [PATCH 1/2] feat: drop support for Python < 3.9 + +Added CI pipelines for Pyton 3.12, 3.13 +--- + .github/workflows/ci.yml | 6 +-- + pyproject.toml | 46 ++++++++++---------- + tests/_data/string_files/do_format_code.toml | 6 +-- + tests/test_docformatter.py | 14 +++--- + 4 files changed, 35 insertions(+), 37 deletions(-) + +diff --git a/tests/_data/string_files/do_format_code.toml b/tests/_data/string_files/do_format_code.toml +index 5d886f3..469c78b 100644 +--- a/tests/_data/string_files/do_format_code.toml ++++ b/tests/_data/string_files/do_format_code.toml +@@ -37,7 +37,7 @@ instring=''' + CONST = 123 + + """docstring for CONST.""" +- ''' ++''' + outstring=''' + CONST = 123 + """docstring for CONST.""" +@@ -50,7 +50,7 @@ instring=''' + :cvar test_int: a class attribute. + ..py.method: big_method() + """ +- ''' ++''' + outstring=''' + class TestClass: + """This is a class docstring. +@@ -74,7 +74,7 @@ instring=''' + + + """This is a second class variable docstring.""" +- ''' ++''' + outstring=''' + class TestClass: + """This is a class docstring.""" +diff --git a/tests/test_docformatter.py b/tests/test_docformatter.py +index 20c0809..dbad7c0 100644 +--- a/tests/test_docformatter.py ++++ b/tests/test_docformatter.py +@@ -688,9 +688,9 @@ class TestEndToEndPyproject: + "contents", + [ + '''\ +- class TestFoo(): +- """Docstring that should not have a pre-summary space.""" +- ''' ++class TestFoo(): ++ """ Docstring that should not have a pre-summary space.""" ++''' + ], + ) + @pytest.mark.parametrize( +@@ -725,10 +725,10 @@ def test_no_pre_summary_space_using_pyproject( + See issue #119. + """ + assert '''\ +-@@ -1,3 +1,2 @@ +- class TestFoo(): +- """Docstring that should not have a pre-summary space.""" +-- ++@@ -1,2 +1,2 @@ ++ class TestFoo(): ++- """ Docstring that should not have a pre-summary space.""" +++ """Docstring that should not have a pre-summary space.""" + ''' == "\n".join( + run_docformatter.communicate()[0].decode().replace("\r", "").split("\n")[2:] + )