Keep the ply library bundled, as intended upstream

This commit is contained in:
Miro Hrončok 2026-01-21 18:54:01 +01:00
commit eafc82f518
2 changed files with 13 additions and 63 deletions

View file

@ -4,22 +4,18 @@ Name: python-pycparser
Summary: C parser and AST generator written in Python
Version: 2.22
Release: %autorelease
# pycparser: BSD-3-Clause
# bundled ply: BSD-3-Clause
License: BSD-3-Clause
URL: http://github.com/eliben/pycparser
Source0: %{url}/archive/release_v%{version}.tar.gz
Source1: pycparser-0.91.1-remove-relative-sys-path.py
# This is Fedora-specific; I don't think we should request upstream to
# remove embedded libraries from their distribution, when we can remove
# them during packaging.
# It also ensures that pycparser uses the same YACC __tabversion__ as ply
# package to prevent "yacc table file version is out of date" problem.
Patch100: pycparser-unbundle-ply.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-ply
# for unit tests
%if %{with tests}
@ -34,6 +30,12 @@ need to parse C source code.
%package -n python3-pycparser
Summary: %{summary}
# pycaparser bundles ply,
# which is the preferred upstream for both upstreams.
# See https://github.com/eliben/pycparser/pull/589
%global ply_version 3.9
Provides: bundled(python3dist(ply)) = %{ply_version}
%description -n python3-pycparser
pycparser is a complete parser for the C language, written in pure Python.
It is a module designed to be easily integrated into applications that
@ -42,9 +44,6 @@ need to parse C source code.
%prep
%autosetup -p1 -n pycparser-release_v%{version}
# remove embedded copy of ply
rm -r pycparser/ply
# Remove relative sys.path from the examples
%{python3} %{SOURCE1} examples
@ -63,9 +62,11 @@ popd
%check
%pyproject_check_import
export %{py3_test_envvars}
%if %{with tests}
%py3_test_envvars %{python3} -m unittest discover
%{python3} -m unittest discover
%endif
%{python3} -c 'import pycparser; assert pycparser.ply.__version__ == "%{ply_version}"'
%files -n python3-pycparser -f %{pyproject_files}
%doc examples