1c220b
%global modname ply
1c220b
1c220b
%if 0%{?fedora} || 0%{?rhel} >= 8
1c220b
%bcond_without python3
1c220b
%else
1c220b
%bcond_with python3
1c220b
%endif
1c220b
1c220b
%if 0%{?rhel} > 7
1c220b
# Disable python2 build by default
1c220b
%bcond_with python2
1c220b
%else
1c220b
%bcond_without python2
1c220b
%endif
1c220b
1c220b
Name:           python-%{modname}
1c220b
Summary:        Python Lex-Yacc
1c220b
Version:        3.9
1c220b
Release:        7%{?dist}
1c220b
License:        BSD
1c220b
URL:            http://www.dabeaz.com/ply/
1c220b
Source0:        http://www.dabeaz.com/ply/%{modname}-%{version}.tar.gz
1c220b
BuildArch:      noarch
1c220b
1c220b
%description
1c220b
PLY is a straightforward lex/yacc implementation. Here is a list of its 
1c220b
essential features:
1c220b
* It is implemented entirely in Python.
1c220b
* It uses LR-parsing which is reasonably efficient and well suited for larger 
1c220b
  grammars.
1c220b
* PLY provides most of the standard lex/yacc features including support 
1c220b
  for empty productions, precedence rules, error recovery, and support 
1c220b
  for ambiguous grammars.
1c220b
* PLY is straightforward to use and provides very extensive error checking.
1c220b
* PLY doesn't try to do anything more or less than provide the basic lex/yacc 
1c220b
  functionality. In other words, it's not a large parsing framework or a 
1c220b
  component of some larger system. 
1c220b
1c220b
%if %{with python2}
1c220b
%package -n python2-%{modname}
1c220b
Summary:        Python Lex-Yacc
1c220b
%{?python_provide:%python_provide python2-%{modname}}
1c220b
BuildRequires:  python2-devel
1c220b
BuildRequires:  python2-setuptools
1c220b
1c220b
%description -n python2-%{modname}
1c220b
PLY is a straightforward lex/yacc implementation. Here is a list of its 
1c220b
essential features:
1c220b
* It is implemented entirely in Python.
1c220b
* It uses LR-parsing which is reasonably efficient and well suited for larger 
1c220b
  grammars.
1c220b
* PLY provides most of the standard lex/yacc features including support 
1c220b
  for empty productions, precedence rules, error recovery, and support 
1c220b
  for ambiguous grammars.
1c220b
* PLY is straightforward to use and provides very extensive error checking.
1c220b
* PLY doesn't try to do anything more or less than provide the basic lex/yacc 
1c220b
  functionality. In other words, it's not a large parsing framework or a 
1c220b
  component of some larger system.
1c220b
1c220b
Python 2 version.
1c220b
%endif # with python2
1c220b
1c220b
%if %{with python3}
1c220b
%package -n python3-%{modname}
1c220b
Summary:        Python Lex-Yacc
1c220b
%{?python_provide:%python_provide python3-%{modname}}
1c220b
BuildRequires:  python3-devel
1c220b
BuildRequires:  python3-setuptools
1c220b
1c220b
%description -n python3-%{modname}
1c220b
PLY is a straightforward lex/yacc implementation. Here is a list of its 
1c220b
essential features:
1c220b
* It is implemented entirely in Python.
1c220b
* It uses LR-parsing which is reasonably efficient and well suited for larger 
1c220b
  grammars.
1c220b
* PLY provides most of the standard lex/yacc features including support 
1c220b
  for empty productions, precedence rules, error recovery, and support 
1c220b
  for ambiguous grammars.
1c220b
* PLY is straightforward to use and provides very extensive error checking.
1c220b
* PLY doesn't try to do anything more or less than provide the basic lex/yacc 
1c220b
  functionality. In other words, it's not a large parsing framework or a 
1c220b
  component of some larger system.
1c220b
1c220b
Python 3 version.
1c220b
%endif # with python3
1c220b
1c220b
%prep
1c220b
%autosetup -c
1c220b
%if %{with python2}
1c220b
cp -ai %{modname}-%{version} python2
1c220b
find python2/example/ -type f -exec chmod -x {} ';'
1c220b
find python2/example/ -type f -name '*.py' -exec sed -i \
1c220b
  -e '1{\@^#!/usr/bin/env python@d}' -e '1{\@^#!/usr/local/bin/python@d}' \
1c220b
  {} ';'
1c220b
rm -rf python2/*.egg-info
1c220b
%endif # with python2
1c220b
1c220b
%if %{with python3}
1c220b
cp -ai %{modname}-%{version} python3
1c220b
%endif # with python3
1c220b
1c220b
%build
1c220b
%if %{with python2}
1c220b
pushd python2
1c220b
  %py2_build
1c220b
popd
1c220b
%endif # with python2
1c220b
1c220b
%if 0%{?with_python3}
1c220b
pushd python3
1c220b
  %py3_build
1c220b
popd
1c220b
%endif # with python3
1c220b
1c220b
%install
1c220b
%if %{with python2}
1c220b
pushd python2
1c220b
  %py2_install
1c220b
popd
1c220b
%endif # with python2
1c220b
1c220b
%if %{with python3}
1c220b
pushd python3
1c220b
  %py3_install
1c220b
popd
1c220b
%endif # with python3
1c220b
1c220b
%check
1c220b
%if %{with python2}
1c220b
pushd python2/test
1c220b
  ./cleanup.sh
1c220b
  %{__python2} testlex.py
1c220b
  %{__python2} testyacc.py
1c220b
popd
1c220b
%endif # with python2
1c220b
1c220b
%if %{with python3}
1c220b
pushd python3/test
1c220b
  ./cleanup.sh
1c220b
  %{__python3} testlex.py
1c220b
  %{__python3} testyacc.py
1c220b
popd
1c220b
%endif # with python3
1c220b
1c220b
%if %{with python2}
1c220b
%files -n python2-%{modname}
1c220b
%doc python2/CHANGES
1c220b
%{python2_sitelib}/%{modname}/
1c220b
%{python2_sitelib}/%{modname}-%{version}-*.egg-info/
1c220b
%endif # with python2
1c220b
1c220b
%if %{with python3}
1c220b
%files -n python3-%{modname}
1c220b
%doc python3/CHANGES
1c220b
%{python3_sitelib}/%{modname}/
1c220b
%{python3_sitelib}/%{modname}-%{version}-*.egg-info/
1c220b
%endif # with python3
1c220b
1c220b
%changelog
1c220b
* Fri Jun 15 2018 Charalampos Stratakis <cstratak@redhat.com> - 3.9-7
1c220b
- Conditionalize the python2 subpackage
1c220b
1c220b
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.9-6
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
1c220b
1c220b
* Wed Sep 27 2017 Troy Dawson <tdawson@redhat.com> - 3.9-5
1c220b
- Cleanup spec file conditionals
1c220b
1c220b
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.9-4
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
1c220b
1c220b
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.9-3
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
1c220b
1c220b
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 3.9-2
1c220b
- Rebuild for Python 3.6
1c220b
1c220b
* Tue Nov 8 2016 Orion Poplawski <orion@cora.nwra.com> - 3.9-1
1c220b
- Update to 3.9
1c220b
1c220b
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.8-2
1c220b
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
1c220b
1c220b
* Sun Apr 10 2016 Igor Gnatenko <ignatenko@redhat.com> - 3.8-1
1c220b
- Update to 3.8
1c220b
- Follow new packaging guidelines
1c220b
- Run tests
1c220b
1c220b
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-4
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
1c220b
1c220b
* Tue Oct 13 2015 Robert Kuska <rkuska@redhat.com> - 3.6-3
1c220b
- Rebuilt for Python3.5 rebuild
1c220b
1c220b
* Tue Aug 18 2015 Stephen Gallagher <sgallagh@redhat.com> 3.6-2
1c220b
- Fixes for chromium and SlimIt
1c220b
- Resolves: rhbz#1242929
1c220b
- Resolves: rhbz#1254372
1c220b
1c220b
* Tue Jul 14 2015 Stephen Gallagher <sgallagh@redhat.com> 3.6-1
1c220b
- Update to latest ply 3.6 for Python 3 fixes
1c220b
1c220b
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-8
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
1c220b
1c220b
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-7
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
1c220b
1c220b
* Mon May 12 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 3.4-6
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
1c220b
1c220b
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-5
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
1c220b
1c220b
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-4
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
1c220b
1c220b
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 3.4-3
1c220b
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3
1c220b
1c220b
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4-2
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
1c220b
1c220b
* Mon Mar 19 2012 Tom Callaway <spot@fedoraproject.org> - 3.4-1
1c220b
- update to 3.4
1c220b
1c220b
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-6
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
1c220b
1c220b
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3-5
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
1c220b
1c220b
* Wed Aug 25 2010 Thomas Spura <tomspur@fedoraproject.org> - 3.3-4
1c220b
- update to most recent python packaging guidelines
1c220b
- rebuild with python3.2
1c220b
  http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html
1c220b
1c220b
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 3.3-3
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
1c220b
1c220b
* Sat Apr  3 2010 David Malcolm <dmalcolm@redhat.com> - 3.3-2
1c220b
- add python3-ply subpackage
1c220b
1c220b
* Mon Oct 19 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 3.3-1
1c220b
- update to 3.3
1c220b
1c220b
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2-2
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
1c220b
1c220b
* Wed Apr 22 2009 Tom "spot" Callaway <tcallawa@redhat.com> 3.2-1
1c220b
- update to 3.2, license change to BSD
1c220b
1c220b
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5-3
1c220b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
1c220b
1c220b
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.5-2
1c220b
- Rebuild for Python 2.6
1c220b
1c220b
* Fri Oct 17 2008 Tom "spot" Callaway <tcallawa@redhat.com> 2.5-1
1c220b
- update to 2.5
1c220b
1c220b
* Mon Mar 24 2008 Tom "spot" Callaway <tcallawa@redhat.com> 0.2.3-2
1c220b
- add example dir as doc
1c220b
1c220b
* Sat Mar 15 2008 Tom "spot" Callaway <tcallawa@redhat.com> 0.2.3-1
1c220b
- Initial package for Fedora