Compare commits

1 Commits
1.1 ... main

4 changed files with 128 additions and 11 deletions

View File

@@ -1,3 +1,27 @@
-------------------------------------------------------------------
Tue May 13 06:49:59 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-click-8.2.patch:
* Support click 8.2+.
-------------------------------------------------------------------
Thu Jan 23 03:51:17 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Switch to autosetup macro.
- Clean up BuildRequires for test flavor.
- Add patch remove-six.patch:
* Remove use of six.
-------------------------------------------------------------------
Fri Aug 23 08:51:03 UTC 2024 - pgajdos@suse.com
- drop dependency on python-flex
-------------------------------------------------------------------
Wed Jan 3 10:05:02 UTC 2024 - Dirk Müller <dmueller@suse.com>
- require setuptools
-------------------------------------------------------------------
Mon Nov 27 18:45:20 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file
# spec file for package python-flasgger
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -33,7 +33,12 @@ Summary: Tool to extract swagger specs from Flask projects
License: MIT
URL: https://github.com/flasgger/flasgger/
Source: https://files.pythonhosted.org/packages/source/f/flasgger/flasgger-%{version}.tar.gz
# PATCH-FIX-UPSTREAM Based on gh#flasgger/flasgger#629
Patch0: remove-six.patch
# PATCH-FIX-UPSTREAM gh#flasgger/flasgger#633
Patch1: support-click-8.2.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -42,20 +47,12 @@ Requires: python-PyYAML >= 3.0
Requires: python-jsonschema >= 3.0.1
Requires: python-mistune >= 3
Requires: python-packaging
Requires: python-six >= 1.10
BuildArch: noarch
%if %{with test}
# SECTION test requirements
BuildRequires: %{python_module flasgger = %{version}}
BuildRequires: %{python_module Flask >= 0.10}
BuildRequires: %{python_module PyYAML >= 3.0}
BuildRequires: %{python_module flex}
BuildRequires: %{python_module jsonschema >= 3.0.1}
BuildRequires: %{python_module marshmallow}
BuildRequires: %{python_module mistune >= 3}
BuildRequires: %{python_module pytest >= 3.0.7}
BuildRequires: %{python_module six >= 1.10}
# /SECTION
%endif
@@ -65,7 +62,7 @@ BuildRequires: %{python_module six >= 1.10}
Flasgger is a Flask extension to extract OpenAPI=Specification from all Flask views registered in an API.
%prep
%setup -q -n flasgger-%{version}
%autosetup -p1 -n flasgger-%{version}
# Examples directory is not included in PyPI release
rm tests/test_examples.py

57
remove-six.patch Normal file
View File

@@ -0,0 +1,57 @@
From 0c4f8e15c6a730a20326ba78bf725e49e8682672 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Thu, 23 Jan 2025 14:29:09 +1100
Subject: [PATCH] Remove use of six
Now that Python 2 support has been removed, we can stop using the crutch
of six to support both versions. StringLike could probably be
refactored now to be a subclass of str, but I have left that alone to
make this diff small.
---
flasgger/utils.py | 5 ++---
requirements.txt | 3 +--
setup.py | 1 -
3 files changed, 3 insertions(+), 6 deletions(-)
Index: flasgger-0.9.7.1/flasgger/utils.py
===================================================================
--- flasgger-0.9.7.1.orig/flasgger/utils.py
+++ flasgger-0.9.7.1/flasgger/utils.py
@@ -9,7 +9,6 @@ import re
import sys
import jsonschema
import yaml
-from six import string_types, text_type
from copy import deepcopy
from functools import wraps
from importlib import import_module
@@ -269,7 +268,7 @@ def swag_from(
def is_path(specs):
""" Returns True if specs is a string or pathlib.Path
"""
- is_str_path = isinstance(specs, string_types)
+ is_str_path = isinstance(specs, str)
try:
from pathlib import Path
is_py3_path = isinstance(specs, Path)
@@ -928,7 +927,7 @@ class StringLike(object):
@property
def text_type(self):
- return text_type
+ return str
class LazyString(StringLike):
Index: flasgger-0.9.7.1/setup.py
===================================================================
--- flasgger-0.9.7.1.orig/setup.py
+++ flasgger-0.9.7.1/setup.py
@@ -54,7 +54,6 @@ setup(
'PyYAML>=3.0',
'jsonschema>=3.0.1',
'mistune',
- 'six>=1.10.0',
'packaging',
],
classifiers=[

39
support-click-8.2.patch Normal file
View File

@@ -0,0 +1,39 @@
From 08591b60e988c0002fcf1b1e9f98b78e041d2732 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Tue, 4 Mar 2025 10:13:55 +0000
Subject: [PATCH] Fix tests with Click 8.2
https://github.com/pallets/click/pull/2523 introduced changes to
`click.testing` that broke a few unit tests in Flasgger:
`mix_stderr=False` is now effectively the default and can no longer be
specified explicitly. Although this Click version hasn't been fully
released yet, this adjusts Flasgger to work with both old and new
versions.
---
tests/conftest.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index bb83d682..5acb4923 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,7 +1,9 @@
+import inspect
import json
import random
import pytest
+from click.testing import CliRunner
from flasgger import Swagger
from flasgger.utils import get_examples
@@ -99,4 +101,8 @@ def app():
@pytest.fixture(scope="function")
def cli_runner(app):
- yield app.test_cli_runner(mix_stderr=False)
+ kwargs = {}
+ if "mix_stderr" in inspect.signature(CliRunner).parameters:
+ # click < 8.2
+ kwargs["mix_stderr"] = False
+ yield app.test_cli_runner(**kwargs)