File python-http-parser.spec of Package failed_python-http-parser

Name:           python-http-parser
Version:        0.9.3
Release:        0%{?dist}
Summary:        HTTP parser used by uWSGI and others

License:        MIT
URL:            https://github.com/benoitc/http-parser
Source0:        https://files.pythonhosted.org/packages/source/p/python-http-parser/python-http-parser-%{version}.tar.gz

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pytest
BuildRequires:  python3-pip
Requires:       python3

%description
HTTP parser used by uWSGI and others.

%prep
%autosetup -n python-http-parser-%{version}
# Fix usage of deprecated/removed imp.load_source on Python 3.12+
# Replace the import with a small importlib-based loader implementation so
# setup.py can continue to load version module during packaging.
python3 - <<'PY'
from pathlib import Path
p = Path('setup.py')
if p.exists():
    s = p.read_text()
    if 'from imp import load_source' in s:
        s = s.replace(
            'from imp import load_source',
            'import importlib.util\n\ndef load_source(name, pathname):\n    spec = importlib.util.spec_from_file_location(name, pathname)\n    module = importlib.util.module_from_spec(spec)\n    spec.loader.exec_module(module)\n    return module'
        )
        p.write_text(s)
PY

%build
%py3_build

%check
%py3_check

%install
%py3_install

%files
%license LICENSE
%doc README.rst
%{python3_sitelib}/http_parser*

%changelog
* Thu Aug  8 2024 Packager <packager@example.com> - 0.9.3-0
- Initial package
openSUSE Build Service is sponsored by