File python3-hug.spec of Package python-hug
#
# spec file for package python-hug
#
Name: python3-hug
Version: 2.6.1
Release: 0
Summary: Python3 framework for HTTP and CLI APIs
License: MIT
Group: Development/Libraries/Python
URL: https://www.hug.rest
# Tag/Release for 2.6.1 is missing on GitHub: https://github.com/hugapi/hug/issues/854 and pypi does not have tests
#Source: https://files.pythonhosted.org/packages/source/h/hug/hug-%%{version}.tar.gz
Source: python-hug_2.6.1.orig.tar.gz
# Remove unneeded test dependency mock
Patch0: remove-mock-test-dep.patch
# Upgrade sync syntax
Patch1: fix-async-coroutines.patch
# https://github.com/hugapi/hug/pull/852 Fix SyntaxWarning due to is 1
Patch2: fix-syntax-warning-is-1-pr-852.patch
# https://github.com/hugapi/hug/pull/869 Fix deprecation warnings due to invalid escape sequences and comparison of literals using is.
Patch3: fix-invalid-escape-sequences-pr-869.patch
Patch4: https://github.com/wagner-intevation/hug/commit/7aa46f91604d123406266d2ae86292ba401a0fc2.patch#/isinstance-instead-type.patch
Patch5: https://github.com/wagner-intevation/hug/commit/4d673d90188fae008a44b4f7023a975523487b9d.patch#/fix-np.unicode_.patch
Patch6: https://github.com/wagner-intevation/hug/commit/bb51c603c1f1573738966af39d42acc95925f341.patch#/fix-np.bool8.patch
Patch7: https://github.com/wagner-intevation/hug/commit/bf00a647fa8758533f8771b6932cd7baffae32bd.patch#/fix-np.float.patch
Patch8: https://github.com/hugapi/hug/pull/925.patch#/replace-distutils.patch
BuildRequires: fdupes
BuildRequires: python3-Cython
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Requires: python3-falcon == 2.0.0
Requires: python3-requests
# SECTION tests
BuildRequires: python3-falcon == 2.0.0
BuildRequires: python3-marshmallow >= 3.0.0
BuildRequires: python3-numpy
%if 0%{?suse_version} > 1500
BuildRequires: python3-pytest
%else
BuildRequires: python3-pytest-runner
%endif
BuildRequires: python3-requests
# /SECTION
%description
hug makes developing a Python driven API as succinct as a written definition.
Built-in API version management, validation and documentation generation.
Encourages self-documenting code and easy testing.
hug is Python 3+ only and built upon Falcon's high performance HTTP library
Built with Cython.
%prep
%setup -q -n hug-%{version}
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
#%%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%patch -P 8 -p1
# CentOS 8 has no pytest for Python 3.8, only for 3.6
%if 0%{?centos_version} == 800
sed -i '/pytest/d' setup.py
%endif
%if 0%{?suse_version} > 1500
sed -i 's/pytest-runner/pytest/' setup.py
%endif
%build
%python_build
%install
%python_install
%fdupes -s %{buildroot}%{python3_sitearch}
%check
# test_hug_post requires unavailable tmp_path fixture
# test_transform and test_marshmallow_schema and test_marshmallow_custom_context some error with marshmallow
# test_validate_route_args_negative_case no idea
%if 0%{?centos_version} < 800
%pytest tests/ -m 'not extnetwork' -k 'not test_hug_post and not test_transform and not test_marshmallow_schema and not test_marshmallow_custom_context and not test_validate_route_args_negative_case'
%endif
%files
%doc README.md CHANGELOG.md
%license LICENSE
%{python3_sitearch}/hug/
%{python3_sitearch}/hug-%{version}-py*.egg-info
%{_bindir}/hug
%changelog