commit
5d99cac870
@ -0,0 +1 @@
|
|||||||
|
SOURCES/release_v2.20.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
3a7e92b87f9fe0b863ec99b0c4ee9f90a32a3c3f SOURCES/release_v2.20.tar.gz
|
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
'''
|
||||||
|
pycparser examples all contain the following boiler plate code
|
||||||
|
for running in tree. This script removes them:
|
||||||
|
|
||||||
|
# This is not required if you've installed pycparser into
|
||||||
|
# your site-packages/ with setup.py
|
||||||
|
#
|
||||||
|
sys.path.extend(['.', '..'])
|
||||||
|
'''
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
boiler_plate = "sys.path.extend(['.', '..'])\n"
|
||||||
|
d = sys.argv[1]
|
||||||
|
for (root, dirs, files) in os.walk(d):
|
||||||
|
for i in files:
|
||||||
|
if not i.endswith('.py'):
|
||||||
|
continue
|
||||||
|
fname = os.path.join(root, i)
|
||||||
|
lines = open(fname).readlines()
|
||||||
|
try:
|
||||||
|
start = lines.index(boiler_plate)
|
||||||
|
end = start
|
||||||
|
except ValueError:
|
||||||
|
start = None
|
||||||
|
end = start
|
||||||
|
if start is not None:
|
||||||
|
while lines[start-1].startswith('#'):
|
||||||
|
start -= 1
|
||||||
|
|
||||||
|
if start is not None and end is not None:
|
||||||
|
f = open(fname, 'w')
|
||||||
|
f.writelines(lines[:start])
|
||||||
|
f.writelines(lines[end+1:])
|
||||||
|
f.close()
|
@ -0,0 +1,51 @@
|
|||||||
|
diff --git a/pycparser/c_lexer.py b/pycparser/c_lexer.py
|
||||||
|
index 045d24e..9b3cbf2 100644
|
||||||
|
--- a/pycparser/c_lexer.py
|
||||||
|
+++ b/pycparser/c_lexer.py
|
||||||
|
@@ -9,8 +9,8 @@
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
-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 744ede8..50156a3 100644
|
||||||
|
--- a/pycparser/c_parser.py
|
||||||
|
+++ b/pycparser/c_parser.py
|
||||||
|
@@ -8,7 +8,7 @@
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
import re
|
||||||
|
|
||||||
|
-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 6dce89c..b3dbfb4 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.6',
|
||||||
|
],
|
||||||
|
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
|
||||||
|
- packages=['pycparser', 'pycparser.ply'],
|
||||||
|
+ packages=['pycparser'],
|
||||||
|
+ install_requires=['ply==' + ply.__version__],
|
||||||
|
package_data={'pycparser': ['*.cfg']},
|
||||||
|
cmdclass={'install': install, 'sdist': sdist},
|
||||||
|
)
|
@ -0,0 +1,89 @@
|
|||||||
|
%global __python3 /usr/bin/python3.11
|
||||||
|
%global python3_pkgversion 3.11
|
||||||
|
|
||||||
|
%bcond_without tests
|
||||||
|
|
||||||
|
Name: python%{python3_pkgversion}-pycparser
|
||||||
|
Summary: C parser and AST generator written in Python
|
||||||
|
Version: 2.20
|
||||||
|
Release: 1%{?dist}
|
||||||
|
License: BSD
|
||||||
|
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}-rpm-macros
|
||||||
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
||||||
|
BuildRequires: python%{python3_pkgversion}-ply
|
||||||
|
|
||||||
|
Requires: python%{python3_pkgversion}-ply
|
||||||
|
|
||||||
|
# for unit tests
|
||||||
|
%if %{with tests}
|
||||||
|
BuildRequires: cpp
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%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
|
||||||
|
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
|
||||||
|
|
||||||
|
%build
|
||||||
|
%py3_build
|
||||||
|
pushd build/lib/pycparser
|
||||||
|
%{__python3} _build_tables.py
|
||||||
|
popd
|
||||||
|
|
||||||
|
%install
|
||||||
|
%py3_install
|
||||||
|
|
||||||
|
%check
|
||||||
|
%if %{with tests}
|
||||||
|
%{python3} tests/all_tests.py
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%files -n python%{python3_pkgversion}-pycparser
|
||||||
|
%license LICENSE
|
||||||
|
%doc examples
|
||||||
|
%{python3_sitelib}/pycparser/
|
||||||
|
%{python3_sitelib}/pycparser-*.egg-info/
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Nov 29 2022 Charalampos Stratakis <cstratak@redhat.com> - 2.20-1
|
||||||
|
- Initial package
|
||||||
|
- Fedora contributions by:
|
||||||
|
Charalampos Stratakis <cstratak@redhat.com>
|
||||||
|
Christian Heimes <cheimes@redhat.com>
|
||||||
|
Dennis Gilmore <dennis@ausil.us>
|
||||||
|
Eric Smith <brouhaha@fedoraproject.org>
|
||||||
|
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
||||||
|
Iryna Shcherbina <shcherbina.iryna@gmail.com>
|
||||||
|
Lumir Balhar <lbalhar@redhat.com>
|
||||||
|
Marcel Plch <mplch@redhat.com>
|
||||||
|
Miro Hrončok <miro@hroncok.cz>
|
||||||
|
Nathaniel McCallum <nathaniel@themccallums.org>
|
||||||
|
Orion Poplawski <orion@cora.nwra.com>
|
||||||
|
Robert Kuska <rkuska@redhat.com>
|
||||||
|
Slavek Kabrda <bkabrda@redhat.com>
|
||||||
|
Stephen Gallagher <sgallagh@redhat.com>
|
||||||
|
Tom Callaway <spot@fedoraproject.org>
|
||||||
|
Troy Dawson <tdawson@redhat.com>
|
Loading…
Reference in new issue