RHEL: Convert from Fedora for the Python 3.11 stack in RHEL

Resolves: rhbz#2157718
This commit is contained in:
Charalampos Stratakis 2022-11-25 19:16:53 +01:00
parent 372a08158f
commit 4e850794f4

View File

@ -1,112 +1,56 @@
%global __python3 /usr/bin/python3.11
%global python3_pkgversion 3.11
%global srcname pyparsing
# when bootstrapping Python 3, pyparsing needs to be rebuilt before dependency generator is available
%bcond_with bootstrap
%if %{without bootstrap}
%global build_wheel 1
%global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
%endif
%global python_wheelname %{srcname}-%{version}-py3-none-any.whl
# When bootstraping we don't have pytest yet
%bcond_with tests
Summary: Python package with an object-oriented approach to text processing
Name: pyparsing
Name: python%{python3_pkgversion}-pyparsing
Version: 3.0.7
Release: 1%{?dist}
License: MIT
URL: https://github.com/pyparsing/pyparsing
Source0: https://github.com/%{name}/%{name}/archive/%{name}_%{version}/%{name}-%{version}.tar.gz
Source0: https://github.com/%{srcname}/%{srcname}/archive/%{srcname}_%{version}/%{srcname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: dos2unix
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%if %{without bootstrap}
BuildRequires: python%{python3_pkgversion}-sphinx
%if %{with tests}
BuildRequires: python%{python3_pkgversion}-pytest
%endif
%if 0%{?build_wheel}
BuildRequires: python%{python3_pkgversion}-pip
BuildRequires: python%{python3_pkgversion}-wheel
%endif
BuildRequires: python%{python3_pkgversion}-pytest
%description
pyparsing is a module that can be used to easily and directly configure syntax
definitions for any number of text parsing applications.
%package -n python%{python3_pkgversion}-pyparsing
Summary: %{summary}
%if %{with bootstrap}
Provides: python%{python3_pkgversion}dist(pyparsing) = %{version}
Provides: python%{python3_version}dist(pyparsing) = %{version}
Requires: python(abi) = %{python3_version}
%endif
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
%description -n python%{python3_pkgversion}-pyparsing
pyparsing is a module that can be used to easily and directly configure syntax
definitions for any number of text parsing applications.
%if %{without bootstrap}
%package doc
Summary: Documentation for %{name}
# Most examples are under the project's license, MIT
# pymicko.py is under GPLv3+
# snmp_api.h is under CMU-UC (MIT)
# sparser.py is under GPLv2+
# searchparser.py is under BSD (3-clause, with advertising)
# btpyparse.py is under "Simplified BSD license"
License: MIT and GPLv2+ and GPLv3+ and BSD
%description doc
The package contains documentation for pyparsing.
%endif
%prep
%autosetup -p1 -n %{name}-%{name}_%{version}
%autosetup -p1 -n %{srcname}-%{srcname}_%{version}
dos2unix -k examples/*
%if 0%{?build_wheel}
%generate_buildrequires
%pyproject_buildrequires -t
%endif
%build
%if 0%{?build_wheel}
%pyproject_wheel
%else
%py3_build
%endif
%py3_build_wheel
%if %{without bootstrap}
# build docs
pushd docs
# Theme is not available
sed -i '/alabaster/d' conf.py
sphinx-build -b html . html
popd
%endif
%install
%if 0%{?build_wheel}
%pyproject_install
%else
%py3_install
%endif
%py3_install_wheel %{python_wheelname}
%if %{with tests}
%check
%pytest -v
# Ignore the tests that require the missing railroad dependency
%pytest -v --ignore=tests/test_diagram.py -k "not testEmptyExpressionsAreHandledProperly"
%endif
%files -n python%{python3_pkgversion}-pyparsing
@ -115,13 +59,30 @@ popd
%{python3_sitelib}/pyparsing/
%{python3_sitelib}/pyparsing-%{version}.dist-info/
%if %{without bootstrap}
%files doc
%license LICENSE
%doc CHANGES README.rst docs/html examples
%endif
%changelog
* Fri Nov 25 2022 Charalampos Stratakis <cstratak@redhat.com> - 3.0.7-1
- Initial package
- Fedora contributions by:
# Alan Pevec <alan.pevec@redhat.com>
# Bill Nottingham <notting@fedoraproject.org>
# Charalampos Stratakis <cstratak@redhat.com>
# Dan Horák <dan@danny.cz>
# David King <amigadave@amigadave.com>
# David Malcolm <dmalcolm@redhat.com>
# Dennis Gilmore <dennis@ausil.us>
# Ignacio Vazquez-Abrams <ivazquez@fedoraproject.org>
# Iryna Shcherbina <shcherbina.iryna@gmail.com>
# Jesse Keating <jkeating@fedoraproject.org>
# José Abílio Oliveira Matos <jamatos@fedoraproject.org>
# José Matos <jamatos@fedoraproject.org>
# Lumir Balhar <lbalhar@redhat.com>
# Miro Hrončok <miro@hroncok.cz>
# Petr Viktorin <pviktori@redhat.com>
# Robert Kuska <rkuska@redhat.com>
# Slavek Kabrda <bkabrda@redhat.com>
# Terje Røsten <terje.rosten@ntnu.no>
# Thomas Spura <thomas.spura@gmail.com>
# Tomáš Hrnčiar <thrnciar@redhat.com>
# Ville Skyttä <scop@fedoraproject.org>
# yatin <ykarel@redhat.com>
# Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>