|
|
d2f74d |
%if 0%{?fedora} > 12
|
|
|
d2f74d |
%global with_python3 1
|
|
|
d2f74d |
%else
|
|
|
d2f74d |
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
|
|
|
d2f74d |
%endif
|
|
|
d2f74d |
|
|
|
d2f74d |
Name: python-ply
|
|
|
d2f74d |
Summary: Python Lex-Yacc
|
|
|
d2f74d |
Version: 3.4
|
|
|
d2f74d |
Release: 10%{?dist}
|
|
|
d2f74d |
License: BSD
|
|
|
d2f74d |
Group: System Environment/Libraries
|
|
|
d2f74d |
URL: http://www.dabeaz.com/ply/
|
|
|
d2f74d |
Source0: http://www.dabeaz.com/ply/ply-%{version}.tar.gz
|
|
|
d2f74d |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|
|
d2f74d |
BuildArch: noarch
|
|
|
d2f74d |
BuildRequires: python-devel
|
|
|
d2f74d |
|
|
|
d2f74d |
%if 0%{?with_python3}
|
|
|
d2f74d |
BuildRequires: /usr/bin/2to3
|
|
|
d2f74d |
BuildRequires: python3-devel
|
|
|
d2f74d |
%endif # if with_python3
|
|
|
d2f74d |
|
|
|
d2f74d |
%description
|
|
|
d2f74d |
PLY is a straightforward lex/yacc implementation. Here is a list of its
|
|
|
d2f74d |
essential features:
|
|
|
d2f74d |
* It is implemented entirely in Python.
|
|
|
d2f74d |
* It uses LR-parsing which is reasonably efficient and well suited for larger
|
|
|
d2f74d |
grammars.
|
|
|
d2f74d |
* PLY provides most of the standard lex/yacc features including support
|
|
|
d2f74d |
for empty productions, precedence rules, error recovery, and support
|
|
|
d2f74d |
for ambiguous grammars.
|
|
|
d2f74d |
* PLY is straightforward to use and provides very extensive error checking.
|
|
|
d2f74d |
* PLY doesn't try to do anything more or less than provide the basic lex/yacc
|
|
|
d2f74d |
functionality. In other words, it's not a large parsing framework or a
|
|
|
d2f74d |
component of some larger system.
|
|
|
d2f74d |
|
|
|
d2f74d |
%if 0%{?with_python3}
|
|
|
d2f74d |
%package -n python3-ply
|
|
|
d2f74d |
Summary: Python Lex-Yacc
|
|
|
d2f74d |
Group: System Environment/Libraries
|
|
|
d2f74d |
Requires: python3-setuptools
|
|
|
d2f74d |
|
|
|
d2f74d |
%description -n python3-ply
|
|
|
d2f74d |
PLY is a straightforward lex/yacc implementation. Here is a list of its
|
|
|
d2f74d |
essential features:
|
|
|
d2f74d |
* It is implemented entirely in Python.
|
|
|
d2f74d |
* It uses LR-parsing which is reasonably efficient and well suited for larger
|
|
|
d2f74d |
grammars.
|
|
|
d2f74d |
* PLY provides most of the standard lex/yacc features including support
|
|
|
d2f74d |
for empty productions, precedence rules, error recovery, and support
|
|
|
d2f74d |
for ambiguous grammars.
|
|
|
d2f74d |
* PLY is straightforward to use and provides very extensive error checking.
|
|
|
d2f74d |
* PLY doesn't try to do anything more or less than provide the basic lex/yacc
|
|
|
d2f74d |
functionality. In other words, it's not a large parsing framework or a
|
|
|
d2f74d |
component of some larger system.
|
|
|
d2f74d |
%endif # with_python3
|
|
|
d2f74d |
|
|
|
d2f74d |
%prep
|
|
|
d2f74d |
%setup -q -n ply-%{version}
|
|
|
d2f74d |
sed -i 's|/usr/local/bin/python|/usr/bin/python|g' example/yply/yply.py
|
|
|
d2f74d |
chmod -x example/yply/yply.py example/newclasscalc/calc.py example/classcalc/calc.py example/cleanup.sh
|
|
|
d2f74d |
|
|
|
d2f74d |
%if 0%{?with_python3}
|
|
|
d2f74d |
rm -rf %{py3dir}
|
|
|
d2f74d |
cp -a . %{py3dir}
|
|
|
d2f74d |
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'
|
|
|
d2f74d |
|
|
|
d2f74d |
# The README states: "You should not convert PLY using
|
|
|
d2f74d |
# 2to3--it is not necessary and may in fact break the implementation."
|
|
|
d2f74d |
#
|
|
|
d2f74d |
# However, one of the example files contains python 2 "print" syntax, which
|
|
|
d2f74d |
# lead to syntax errors during byte-compilation
|
|
|
d2f74d |
#
|
|
|
d2f74d |
# So we fix this file with 2to3:
|
|
|
d2f74d |
pushd %{py3dir}
|
|
|
d2f74d |
2to3 --write --nobackups ply/cpp.py
|
|
|
d2f74d |
popd
|
|
|
d2f74d |
%endif # with_python3
|
|
|
d2f74d |
|
|
|
d2f74d |
%build
|
|
|
d2f74d |
%{__python} setup.py build
|
|
|
d2f74d |
|
|
|
d2f74d |
%if 0%{?with_python3}
|
|
|
d2f74d |
pushd %{py3dir}
|
|
|
d2f74d |
%{__python3} setup.py build
|
|
|
d2f74d |
popd
|
|
|
d2f74d |
%endif # with_python3
|
|
|
d2f74d |
|
|
|
d2f74d |
%install
|
|
|
d2f74d |
rm -rf $RPM_BUILD_ROOT
|
|
|
d2f74d |
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
|
|
d2f74d |
|
|
|
d2f74d |
%if 0%{?with_python3}
|
|
|
d2f74d |
pushd %{py3dir}
|
|
|
d2f74d |
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
|
|
d2f74d |
popd
|
|
|
d2f74d |
%endif # with_python3
|
|
|
d2f74d |
|
|
|
d2f74d |
%clean
|
|
|
d2f74d |
rm -rf $RPM_BUILD_ROOT
|
|
|
d2f74d |
|
|
|
d2f74d |
%files
|
|
|
d2f74d |
%defattr(-,root,root,-)
|
|
|
d2f74d |
%doc CHANGES README example/
|
|
|
d2f74d |
%{python_sitelib}/ply/
|
|
|
d2f74d |
%{python_sitelib}/ply*.egg-info
|
|
|
d2f74d |
|
|
|
d2f74d |
%if 0%{?with_python3}
|
|
|
d2f74d |
%files -n python3-ply
|
|
|
d2f74d |
%defattr(-,root,root,-)
|
|
|
d2f74d |
%doc CHANGES README example/
|
|
|
d2f74d |
%{python3_sitelib}/ply/
|
|
|
d2f74d |
%{python3_sitelib}/ply*.egg-info
|
|
|
d2f74d |
%endif # with_python3
|
|
|
d2f74d |
|
|
|
d2f74d |
%changelog
|
|
|
d2f74d |
* Fri Jun 12 2015 Martin Kosek <mkosek@redhat.com> 3.4-10
|
|
|
d2f74d |
- Increase Release number to get a clean upgrade path from EPEL 7
|
|
|
d2f74d |
|
|
|
d2f74d |
* Mon Sep 8 2014 Petr Vobornik <pvoborni@redhat.com> 3.4-1
|
|
|
d2f74d |
- Initial package for RHEL 7
|