Compare commits

..

No commits in common. "c10s" and "imports/c10s/python3.14-pycparser-2.22-3.el10" have entirely different histories.

2 changed files with 63 additions and 13 deletions

View File

@ -0,0 +1,51 @@
diff --git a/pycparser/c_lexer.py b/pycparser/c_lexer.py
index 22c64bc..a97c5d1 100644
--- a/pycparser/c_lexer.py
+++ b/pycparser/c_lexer.py
@@ -8,8 +8,8 @@
#------------------------------------------------------------------------------
import re
-from .ply import lex
-from .ply.lex import TOKEN
+from ply import lex
+from ply.lex import TOKEN
class CLexer(object):
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py
index d31574a..5fc3544 100644
--- a/pycparser/c_parser.py
+++ b/pycparser/c_parser.py
@@ -6,7 +6,7 @@
# Eli Bendersky [https://eli.thegreenplace.net/]
# License: BSD
#------------------------------------------------------------------------------
-from .ply import yacc
+from ply import yacc
from . import c_ast
from .c_lexer import CLexer
diff --git a/setup.py b/setup.py
index f7e89bf..f78f559 100644
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,8 @@ except ImportError:
from distutils.command.install import install as _install
from distutils.command.sdist import sdist as _sdist
+import ply
+
def _run_build_tables(dir):
from subprocess import check_call
@@ -60,7 +62,8 @@ setup(
'Programming Language :: Python :: 3.12',
],
python_requires=">=3.8",
- packages=['pycparser', 'pycparser.ply'],
+ packages=['pycparser'],
+ install_requires=['ply==' + ply.__version__],
package_data={'pycparser': ['*.cfg']},
cmdclass={'install': install, 'sdist': sdist},
)

View File

@ -6,30 +6,28 @@ Name: python%{python3_pkgversion}-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: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-ply
# for unit tests
%if %{with tests}
BuildRequires: gcc
%endif
# 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(python%{python3_pkgversion}dist(ply)) = %{ply_version}
%description
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
@ -38,6 +36,9 @@ 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
@ -56,11 +57,9 @@ popd
%check
%pyproject_check_import
export %{py3_test_envvars}
%if %{with tests}
%{python3} -m unittest discover
%py3_test_envvars %{python3} -m unittest discover
%endif
%{python3} -c 'import pycparser; assert pycparser.ply.__version__ == "%{ply_version}"'
%files -n python%{python3_pkgversion}-pycparser -f %{pyproject_files}
%doc examples