From 62fdee6cb658691cb54a6952bcb91bd33745956b Mon Sep 17 00:00:00 2001 From: Shawn Wang Date: Sun, 9 Apr 2023 15:02:20 +0800 Subject: [PATCH] Optimize the spec file Signed-off-by: Shawn Wang --- python-ply.spec | 87 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/python-ply.spec b/python-ply.spec index 2d3469b..f0506f9 100644 --- a/python-ply.spec +++ b/python-ply.spec @@ -1,69 +1,63 @@ -%define anolis_release 3 -%global modname ply - +%define anolis_release 4 %bcond_without tests +%global pypi_name ply -Name: python-%{modname} +Name: python-%{pypi_name} Summary: Python Lex-Yacc Version: 3.11 -Release: %{anolis_release}%{dist} +Release: %{anolis_release}%{dist} License: BSD -URL: http://www.dabeaz.com/ply/ -Source0: http://www.dabeaz.com/ply/%{modname}-%{version}.tar.gz +URL: http://www.dabeaz.com/%{pypi_name}/ +Source0: http://www.dabeaz.com/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch %description -PLY is a straightforward lex/yacc implementation. Here is a list of its -essential features: -* It is implemented entirely in Python. -* It uses LR-parsing which is reasonably efficient and well suited for larger - grammars. -* PLY provides most of the standard lex/yacc features including support - for empty productions, precedence rules, error recovery, and support - for ambiguous grammars. -* PLY is straightforward to use and provides very extensive error checking. -* PLY doesn't try to do anything more or less than provide the basic lex/yacc - functionality. In other words, it's not a large parsing framework or a - component of some larger system. - -%package -n python3-%{modname} +PLY is a zero-dependency Python implementation of the traditional parsing tools +lex and yacc. It uses the same LALR(1) parsing algorithm as yacc and has most +of its core features. It is compatible with all modern versions of Python. + +PLY was originally created in 2001 to support an Introduction to Compilers +course at the University of Chicago. As such, it has almost no features other +than the core LALR(1) parsing algorithm. This is by design--students should be +made to suffer. Well, at least a little bit. However, from a more practical +point of view, there is a lot flexibility in terms of how you decide to use it. +You can use PLY to build Abstract Syntax Trees (ASTs), simple one-pass compilers, +protocol decoders, or even a more advanced parsing framework. + +%package -n python%{python3_pkgversion}-%{pypi_name} Summary: Python Lex-Yacc -%{?python_provide:%python_provide python3-%{modname}} -BuildRequires: python3-devel - -%description -n python3-%{modname} -PLY is a straightforward lex/yacc implementation. Here is a list of its -essential features: -* It is implemented entirely in Python. -* It uses LR-parsing which is reasonably efficient and well suited for larger - grammars. -* PLY provides most of the standard lex/yacc features including support - for empty productions, precedence rules, error recovery, and support - for ambiguous grammars. -* PLY is straightforward to use and provides very extensive error checking. -* PLY doesn't try to do anything more or less than provide the basic lex/yacc - functionality. In other words, it's not a large parsing framework or a - component of some larger system. - -Python 3 version. +%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} +BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-six + +%description -n python%{python3_pkgversion}-%{pypi_name} +PLY is a zero-dependency Python implementation of the traditional parsing tools +lex and yacc. It uses the same LALR(1) parsing algorithm as yacc and has most +of its core features. It is compatible with all modern versions of Python. + +PLY was originally created in 2001 to support an Introduction to Compilers +course at the University of Chicago. As such, it has almost no features other +than the core LALR(1) parsing algorithm. This is by design--students should be +made to suffer. Well, at least a little bit. However, from a more practical +point of view, there is a lot flexibility in terms of how you decide to use it. +You can use PLY to build Abstract Syntax Trees (ASTs), simple one-pass compilers, +protocol decoders, or even a more advanced parsing framework. %package doc Summary: Documentation files for %{name} -Requires: python3-%{modname} = %{version}-%{release} +Requires: python%{python3_pkgversion}-%{pypi_name} = %{version}-%{release} BuildArch: noarch %description doc The %{name}-doc package contains documentation files for %{name}. %prep -%setup -n %{modname}-%{version} +%setup -n %{pypi_name}-%{version} find example/ -type f -executable -exec chmod -x {} ';' find example/ -type f -name '*.py' -exec sed -i \ -e '1{\@^#!/usr/bin/env python@d}' -e '1{\@^#!/usr/local/bin/python@d}' \ {} ';' rm -rf *.egg-info -# extract license block from beginning of README.md grep -B1000 "POSSIBILITY OF SUCH DAMAGE" README.md > LICENSE %generate_buildrequires @@ -74,6 +68,7 @@ grep -B1000 "POSSIBILITY OF SUCH DAMAGE" README.md > LICENSE %install %pyproject_install +%pyproject_save_files %{pypi_name} %if %{with tests} %check @@ -81,18 +76,20 @@ pushd test ./cleanup.sh %{__python3} testlex.py %{__python3} testyacc.py + %{__python3} testcpp.py popd %endif -%files -n python3-%{modname} +%files -n python%{python3_pkgversion}-%{pypi_name} -f %{pyproject_files} %license LICENSE -%{python3_sitelib}/%{modname}/ -%{python3_sitelib}/%{modname}-%{version}.dist-info/ %files doc %doc CHANGES README.md %changelog +* Sun Apr 09 2023 Shawn Wang - 3.11-4 +- Optimize the spec file + * Mon Feb 27 2023 mgb01105731 - 3.11-3 - optimise dependency -- Gitee