pyparsing/pyparsing.spec
Zbigniew Jędrzejewski-Szmek 8a92544d1b Convert to rpmautospec
2022-07-14 19:42:31 +02:00

130 lines
3.2 KiB
RPMSpec

%global srcname pyparsing
%global _summary Python package with an object-oriented approach to text processing
# when bootstrapping Python 3, pyparsing needs to be rebuilt before depndency generator is available
%bcond_with bootstrap
%if %{without bootstrap}
%global build_wheel 1
%global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
%endif
Summary: %{_summary}
Name: pyparsing
Version: 2.4.7
Release: %autorelease
License: MIT
URL: https://github.com/pyparsing/pyparsing
Source0: https://github.com/%{name}/%{name}/archive/%{name}_%{version}/%{name}-%{version}.tar.gz
# sre_constants module is deprecated in Python 3.11, this patch replaces it with the re module
# Merged upstream in https://github.com/pyparsing/pyparsing/pull/379
# Included in 3.0.8+
Patch: 0001-No-longer-use-undocumented-module-sre_constants.patch
BuildArch: noarch
BuildRequires: dos2unix
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%if %{without bootstrap}
BuildRequires: python%{python3_pkgversion}-sphinx
%endif
%if 0%{?build_wheel}
BuildRequires: python%{python3_pkgversion}-pip
BuildRequires: python%{python3_pkgversion}-wheel
%endif
%description
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 pyparsing python package
# 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
%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.
This is the Python 3 version.
%prep
%autosetup -p1 -n %{name}-%{name}_%{version}
dos2unix -k CHANGES LICENSE
%build
%if 0%{?build_wheel}
%py3_build_wheel
%else
%py3_build
%endif
%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}
%py3_install_wheel %{python_wheelname}
%else
%py3_install
%endif
%check
%{__python3} unitTests.py
%{__python3} simple_unit_tests.py
%files -n python%{python3_pkgversion}-pyparsing
%license LICENSE
%doc CHANGES README.rst
%{python3_sitelib}/pyparsing.py
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/pyparsing-*-info/
%if %{without bootstrap}
%files doc
%license LICENSE
%doc CHANGES README.rst docs/html examples
%endif
%changelog
%autochangelog