15
0
forked from pool/python-blue

Accepting request 963039 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/963039
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-blue?expand=0&rev=4
This commit is contained in:
2022-03-19 21:20:49 +00:00
committed by Git OBS Bridge
7 changed files with 73 additions and 55 deletions

View File

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

3
blue-0.8.0.tar.gz Normal file
View File

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

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sat Mar 19 10:29:26 UTC 2022 - Ben Greiner <code@bnavigator.de>
- 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 <steven.kowalik@suse.com>

View File

@@ -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

View File

@@ -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

29
unpin-black.patch Normal file
View File

@@ -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',

15
unpin-tomli.patch Normal file
View File

@@ -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()}