Keep the ply library bundled, as intended upstream
Related: RHEL-120848
This commit is contained in:
parent
725fd8c685
commit
024b7df5fc
@ -1,51 +0,0 @@
|
|||||||
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},
|
|
||||||
)
|
|
||||||
@ -6,28 +6,30 @@ Name: python%{python3_pkgversion}-pycparser
|
|||||||
Summary: C parser and AST generator written in Python
|
Summary: C parser and AST generator written in Python
|
||||||
Version: 2.22
|
Version: 2.22
|
||||||
Release: %autorelease
|
Release: %autorelease
|
||||||
|
|
||||||
|
# pycparser: BSD-3-Clause
|
||||||
|
# bundled ply: BSD-3-Clause
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
|
|
||||||
URL: http://github.com/eliben/pycparser
|
URL: http://github.com/eliben/pycparser
|
||||||
Source0: %{url}/archive/release_v%{version}.tar.gz
|
Source0: %{url}/archive/release_v%{version}.tar.gz
|
||||||
Source1: pycparser-0.91.1-remove-relative-sys-path.py
|
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
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: python%{python3_pkgversion}-devel
|
BuildRequires: python%{python3_pkgversion}-devel
|
||||||
BuildRequires: python%{python3_pkgversion}-ply
|
|
||||||
|
|
||||||
# for unit tests
|
# for unit tests
|
||||||
%if %{with tests}
|
%if %{with tests}
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
%endif
|
%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
|
%description
|
||||||
pycparser is a complete parser for the C language, written in pure Python.
|
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
|
It is a module designed to be easily integrated into applications that
|
||||||
@ -36,9 +38,6 @@ need to parse C source code.
|
|||||||
%prep
|
%prep
|
||||||
%autosetup -p1 -n pycparser-release_v%{version}
|
%autosetup -p1 -n pycparser-release_v%{version}
|
||||||
|
|
||||||
# remove embedded copy of ply
|
|
||||||
rm -r pycparser/ply
|
|
||||||
|
|
||||||
# Remove relative sys.path from the examples
|
# Remove relative sys.path from the examples
|
||||||
%{python3} %{SOURCE1} examples
|
%{python3} %{SOURCE1} examples
|
||||||
|
|
||||||
@ -57,9 +56,11 @@ popd
|
|||||||
|
|
||||||
%check
|
%check
|
||||||
%pyproject_check_import
|
%pyproject_check_import
|
||||||
|
export %{py3_test_envvars}
|
||||||
%if %{with tests}
|
%if %{with tests}
|
||||||
%py3_test_envvars %{python3} -m unittest discover
|
%{python3} -m unittest discover
|
||||||
%endif
|
%endif
|
||||||
|
%{python3} -c 'import pycparser; assert pycparser.ply.__version__ == "%{ply_version}"'
|
||||||
|
|
||||||
%files -n python%{python3_pkgversion}-pycparser -f %{pyproject_files}
|
%files -n python%{python3_pkgversion}-pycparser -f %{pyproject_files}
|
||||||
%doc examples
|
%doc examples
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user