From aa4110ff70b0a80e15661c7e71c53cab01f88d06106a39eed1381f2f034ae86b Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sat, 23 Apr 2022 18:59:19 +0000 Subject: [PATCH] - Update unpin-tomli.patch to work with the current black package. - Skip failing tests (gh#grantjenks/blue#72) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-blue?expand=0&rev=12 --- python-blue.changes | 6 ++++++ python-blue.spec | 4 +++- unpin-tomli.patch | 26 ++++++++++++++++++++------ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/python-blue.changes b/python-blue.changes index 9805bdc..5a3aa43 100644 --- a/python-blue.changes +++ b/python-blue.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Apr 23 18:57:58 UTC 2022 - Matej Cepl + +- Update unpin-tomli.patch to work with the current black package. +- Skip failing tests (gh#grantjenks/blue#72) + ------------------------------------------------------------------- Sat Mar 19 10:29:26 UTC 2022 - Ben Greiner diff --git a/python-blue.spec b/python-blue.spec index 1ac26fc..4acab1f 100644 --- a/python-blue.spec +++ b/python-blue.spec @@ -34,6 +34,7 @@ BuildRequires: %{python_module base >= 3.6} BuildRequires: %{python_module black >= 21.7} BuildRequires: %{python_module flake8 >= 3.8} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module tomli} BuildRequires: fdupes BuildRequires: python-rpm-macros # SECTION doc and test requirements @@ -79,7 +80,8 @@ sed -i '/--cov/d' tox.ini %python_clone -a %{buildroot}%{_bindir}/blue %check -%pytest +# gh#grantjenks/blue#72 +%pytest -k 'not (test_good_dirs or test_bad_dirs)' %post %python_install_alternative blue diff --git a/unpin-tomli.patch b/unpin-tomli.patch index b9204bf..fc3ec17 100644 --- a/unpin-tomli.patch +++ b/unpin-tomli.patch @@ -1,8 +1,22 @@ -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 +--- + blue/__init__.py | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/blue/__init__.py ++++ b/blue/__init__.py +@@ -15,7 +15,10 @@ import black.strings + from black import Leaf, Path, click, token + from black.cache import user_cache_dir + from black.comments import ProtoComment, make_comment +-from black.files import tomli ++try: ++ from black.files import tomli ++except ImportError: ++ from black.files import tomllib as tomli + from black.linegen import LineGenerator as BlackLineGenerator + from black.lines import Line + from black.nodes import ( +@@ -263,8 +266,8 @@ def parse_pyproject_toml(path_config: st If parsing fails, will raise a tomli.TOMLDecodeError """ @@ -12,4 +26,4 @@ Index: blue-0.8.0/blue/__init__.py + 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 +