From c1f4d9a185acc82bfac2656fd933d69b5a294d3a809891cd3323db6f69de095a Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sat, 19 Mar 2022 12:12:01 +0000 Subject: [PATCH] Accepting request 963034 from home:bnavigator:branches:devel:languages:python - Update to 0.8.0 * Fix compatibility with flake8 v4 (GH#58) - Drop support-new-flake8.patch fixed upstream - Add unpin-black.patch and unpin-tomli.patch - Clean requirements OBS-URL: https://build.opensuse.org/request/show/963034 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-blue?expand=0&rev=10 --- blue-0.7.0.tar.gz | 3 --- blue-0.8.0.tar.gz | 3 +++ python-blue.changes | 9 ++++++++ python-blue.spec | 48 ++++++++++++++-------------------------- support-new-flake8.patch | 21 ------------------ unpin-black.patch | 29 ++++++++++++++++++++++++ unpin-tomli.patch | 15 +++++++++++++ 7 files changed, 73 insertions(+), 55 deletions(-) delete mode 100644 blue-0.7.0.tar.gz create mode 100644 blue-0.8.0.tar.gz delete mode 100644 support-new-flake8.patch create mode 100644 unpin-black.patch create mode 100644 unpin-tomli.patch diff --git a/blue-0.7.0.tar.gz b/blue-0.7.0.tar.gz deleted file mode 100644 index d8941af..0000000 --- a/blue-0.7.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4f64ae7a338c5da11f51a9d53f25f78a650f51a9d41e258f930b7eafd8a92613 -size 86381 diff --git a/blue-0.8.0.tar.gz b/blue-0.8.0.tar.gz new file mode 100644 index 0000000..edc08bc --- /dev/null +++ b/blue-0.8.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e097b83a5937b9c420e4a18063525f5b38e65a4396976ea681bdb405f07269d1 +size 86462 diff --git a/python-blue.changes b/python-blue.changes index 6b4ff96..9805bdc 100644 --- a/python-blue.changes +++ b/python-blue.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Sat Mar 19 10:29:26 UTC 2022 - Ben Greiner + +- Update to 0.8.0 + * Fix compatibility with flake8 v4 (GH#58) +- Drop support-new-flake8.patch fixed upstream +- Add unpin-black.patch and unpin-tomli.patch +- Clean requirements + ------------------------------------------------------------------- Wed Jan 12 07:25:55 UTC 2022 - Steve Kowalik diff --git a/python-blue.spec b/python-blue.spec index 8ace926..1ac26fc 100644 --- a/python-blue.spec +++ b/python-blue.spec @@ -16,48 +16,32 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 -%define modname blue Name: python-blue -Version: 0.7.0 +Version: 0.8.0 Release: 0 Summary: A code formatter written in, and written for Python License: MIT URL: https://github.com/grantjenks/blue -Source: https://github.com/grantjenks/%{modname}/archive/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz -Patch0: support-new-flake8.patch +Source: https://github.com/grantjenks/blue/archive/v%{version}.tar.gz#/blue-%{version}.tar.gz +# PATCH-FIX-OPENSUSE unpin-black.patch -- we can't have a fixed black version in the distribution +Patch0: unpin-black.patch +# PATCH-FIX-OPENSUSE unpin-tomli.patch -- gh#grantjenks/blue#66 +Patch1: unpin-tomli.patch BuildRequires: %{python_module Sphinx} BuildRequires: %{python_module base >= 3.6} BuildRequires: %{python_module black >= 21.7} -# BuildRequires: %%{python_module doc8} -BuildRequires: %{python_module flake8} -BuildRequires: %{python_module pytest-cov} -BuildRequires: %{python_module pytest} -BuildRequires: %{python_module rstcheck} +BuildRequires: %{python_module flake8 >= 3.8} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module twine} -BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros -BuildRequires: (python3-dataclasses if python3-base < 3.7) -BuildRequires: (python36-dataclasses if python36-base) -Requires: python-aiohttp >= 3.3.2 -Requires: python-aiohttp_cors -Requires: python-appdirs -Requires: python-attrs >= 18.1.0 +# SECTION doc and test requirements +BuildRequires: %{python_module Sphinx} +BuildRequires: %{python_module pytest} +# /SECTION Requires: python-black >= 21.7 -Requires: python-click >= 7.1.2 -Requires: python-flake8 -Requires: python-mypy_extensions >= 0.4.3 -Requires: python-pathspec >= 0.6 -Requires: python-regex >= 2020.1.8 -Requires: python-toml >= 0.10.1 -Requires: python-typed-ast >= 1.4.0 -Requires: python-typing_extensions -%if 0%{?python_version_nodots} == 36 -Requires: python-dataclasses -%endif +Requires: python-flake8 > 3.8 Requires(post): update-alternatives Requires(postun):update-alternatives BuildArch: noarch @@ -83,6 +67,8 @@ HTML Documentation and examples for %name. %prep %autosetup -p1 -n blue-%{version} +# avoid pytest addopts for coverage checks +sed -i '/--cov/d' tox.ini %build %python_build @@ -105,8 +91,8 @@ HTML Documentation and examples for %name. %doc README.rst %license LICENSE %python_alternative %{_bindir}/blue -%{python_sitelib}/blue/ -%{python_sitelib}/blue-%{version}-py*.egg-info +%{python_sitelib}/blue +%{python_sitelib}/blue-%{version}*-info %files -n python-blue-doc %doc docs/_build/html diff --git a/support-new-flake8.patch b/support-new-flake8.patch deleted file mode 100644 index 9f541dc..0000000 --- a/support-new-flake8.patch +++ /dev/null @@ -1,21 +0,0 @@ -Index: blue-0.7.0/blue/__init__.py -=================================================================== ---- blue-0.7.0.orig/blue/__init__.py -+++ blue-0.7.0/blue/__init__.py -@@ -332,7 +332,7 @@ def format_file_in_place(*args, **kws): - return black_format_file_in_place(*args, **kws) - - --class MergedConfigParser(flake8_config.MergedConfigParser): -+class MergedConfigParser(flake8_config.ConfigParser): - def _parse_config(self, config_parser, parent=None): - """Skip option parsing in flake8's config parsing.""" - config_dict = {} -@@ -382,7 +382,6 @@ def main(): - ) - # Change the config param callback to support setup.cfg, tox.ini, etc. - config_param = black.main.params[21] -- assert config_param.name == 'config' - config_param.callback = read_configs - # Change the version string by adding a redundant Click `version_option` - # decorator on `black.main`. Fortunately the added `version_option` takes diff --git a/unpin-black.patch b/unpin-black.patch new file mode 100644 index 0000000..1a2881b --- /dev/null +++ b/unpin-black.patch @@ -0,0 +1,29 @@ +Index: blue-0.8.0/blue/__init__.py +=================================================================== +--- blue-0.8.0.orig/blue/__init__.py ++++ blue-0.8.0/blue/__init__.py +@@ -387,8 +387,9 @@ def main(): + 'Black', 'Blue' + ) + # Change the config param callback to support setup.cfg, tox.ini, etc. +- config_param = black.main.params[21] +- assert config_param.name == 'config' ++ # the index changed somewhere between black 21.7b and 21.12b ++ cfgidx = {p.name: i for (i, p) in enumerate(black.main.params)}['config'] ++ config_param = black.main.params[cfgidx] + config_param.callback = read_configs + # Change the version string by adding a redundant Click `version_option` + # decorator on `black.main`. Fortunately the added `version_option` takes +Index: blue-0.8.0/setup.py +=================================================================== +--- blue-0.8.0.orig/setup.py ++++ blue-0.8.0/setup.py +@@ -37,7 +37,7 @@ setup( + packages=['blue'], + tests_require=['tox'], + cmdclass={'test': Tox}, +- install_requires=['black==21.7b0', 'flake8>=3.8'], ++ install_requires=['black>=21.7b0', 'flake8>=3.8'], + project_urls={ + 'Documentation': 'https://blue.readthedocs.io/en/latest', + 'Source': 'https://github.com/grantjenks/blue.git', diff --git a/unpin-tomli.patch b/unpin-tomli.patch new file mode 100644 index 0000000..b9204bf --- /dev/null +++ b/unpin-tomli.patch @@ -0,0 +1,15 @@ +Index: blue-0.8.0/blue/__init__.py +=================================================================== +--- blue-0.8.0.orig/blue/__init__.py ++++ blue-0.8.0/blue/__init__.py +@@ -263,8 +263,8 @@ def parse_pyproject_toml(path_config: st + + If parsing fails, will raise a tomli.TOMLDecodeError + """ +- with open(path_config, encoding="utf8") as f: +- pyproject_toml = tomli.load(f) # type: ignore # due to deprecated API usage ++ with open(path_config, mode='rb') as f: ++ pyproject_toml = tomli.load(f) + config = pyproject_toml.get("tool", {}).get("blue", {}) + return {k.replace("--", "").replace("-", "_"): v for k, v in config.items()} + \ No newline at end of file