diff --git a/python-simpleeval.spec b/python-simpleeval.spec index ee3850680f26ac489e516f978bb2aafb0df032c2..7b08b90da54fe7891562f88ca6d41fff3ab74cb0 100644 --- a/python-simpleeval.spec +++ b/python-simpleeval.spec @@ -1,11 +1,11 @@ %global _empty_manifest_terminate_build 0 Name: python-simpleeval -Version: 0.9.13 +Version: 1.0.3 Release: 1 Summary: A simple, safe single expression evaluator library. License: MIT License URL: https://github.com/danthedeckie/simpleeval -Source0: https://files.pythonhosted.org/packages/8f/fa/d2d5bbf9a03fe7b0956368ac5420cfcb072146be6e912a50747dc376133a/simpleeval-0.9.13.tar.gz +Source0: https://files.pythonhosted.org/packages/source/s/simpleeval/simpleeval-%{version}.tar.gz BuildArch: noarch %description @@ -18,7 +18,10 @@ eval() or other unsafe or needlessly complex linguistics. Summary: A simple, safe single expression evaluator library. Provides: python-simpleeval = %{version}-%{release} BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-wheel +BuildRequires: python3-build +BuildRequires: python3-hatchling %description -n python3-simpleeval An short, easy to use, safe and reasonably extensible expression evaluator. Designed for things like in a website where you want to allow the user to @@ -38,30 +41,45 @@ eval() or other unsafe or needlessly complex linguistics. %autosetup -n simpleeval-%{version} %build -%py3_build +%pyproject_build %install -%py3_install -install -d -m755 %{buildroot}/%{_pkgdocdir} +# Prevent Python from writing bytecode files during installation +export PYTHONDONTWRITEBYTECODE=1 +%pyproject_install + +# Remove __pycache__ directories (not needed in package, Python will regenerate them at runtime) +find %{buildroot} -type d -name __pycache__ -print0 | xargs -0 rm -rf 2>/dev/null || true +find %{buildroot} -name "*.pyc" -delete 2>/dev/null || true +find %{buildroot} -name "*.pyo" -delete 2>/dev/null || true + +# 不打包 tests +rm -rf %{buildroot}%{python3_sitelib}/tests || : + +# 安装文档到专用 doc 目录 +install -d -m755 %{buildroot}%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi -if [ -f README.rst ]; then cp -af README.rst %{buildroot}/%{_pkgdocdir}; fi -if [ -f README.md ]; then cp -af README.md %{buildroot}/%{_pkgdocdir}; fi -if [ -f README.txt ]; then cp -af README.txt %{buildroot}/%{_pkgdocdir}; fi + +# Remove __pycache__ directories before generating filelist (Python will regenerate them at runtime) +find %{buildroot} -type d -name __pycache__ -print0 | xargs -0 rm -rf 2>/dev/null || true +find %{buildroot} -name "*.pyc" -delete 2>/dev/null || true +find %{buildroot} -name "*.pyo" -delete 2>/dev/null || true + pushd %{buildroot} if [ -d usr/lib ]; then - find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst + find usr/lib -type f ! -path "*/__pycache__/*" -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then - find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst + find usr/lib64 -type f ! -path "*/__pycache__/*" -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then - find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst + find usr/bin -type f ! -path "*/__pycache__/*" -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then - find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst + find usr/sbin -type f ! -path "*/__pycache__/*" -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then @@ -71,13 +89,32 @@ popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . +# Final cleanup of __pycache__ before RPM checks for unpackaged files +# Use multiple methods to ensure complete removal +rm -rf %{buildroot}%{python3_sitelib}/simpleeval/__pycache__ 2>/dev/null || true +rm -rf %{buildroot}%{python3_sitelib}/__pycache__ 2>/dev/null || true +find %{buildroot} -type d -name __pycache__ -print0 | xargs -0 rm -rf 2>/dev/null || true +find %{buildroot} -name "*.pyc" -delete 2>/dev/null || true +find %{buildroot} -name "*.pyo" -delete 2>/dev/null || true +# Double check and remove any remaining __pycache__ directories +find %{buildroot} -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true + %files -n python3-simpleeval -f filelist.lst %dir %{python3_sitelib}/* +%exclude %{python3_sitelib}/simpleeval/__pycache__ +%exclude %{python3_sitelib}/simpleeval/__pycache__/* +%exclude %{python3_sitelib}/__pycache__ +%exclude %{python3_sitelib}/__pycache__/* %files help -f doclist.lst %{_docdir}/* %changelog +* Fri Nov 14 2025 zhao6777 - 1.0.3-1 +- Update to 1.0.3 +- Switch to %%pyproject_build and %%pyproject_install +- Remove __pycache__ directories and .pyc/.pyo files + * Mon Feb 27 2023 wangjunqi - 0.9.13-1 - Update package to version 0.9.13 diff --git a/simpleeval-0.9.13.tar.gz b/simpleeval-0.9.13.tar.gz deleted file mode 100644 index a6281565a021a02d0988329dc7f8cbe877a843f4..0000000000000000000000000000000000000000 Binary files a/simpleeval-0.9.13.tar.gz and /dev/null differ diff --git a/simpleeval-1.0.3.tar.gz b/simpleeval-1.0.3.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..decb13cacbd6a6ac66866de621072af2f98efc43 Binary files /dev/null and b/simpleeval-1.0.3.tar.gz differ