%global common_description %{expand: sh is a full-fledged subprocess replacement for Python that allows you to call any program as if it were a function. sh is not a collection of system commands implemented in Python.} %global python3_pkgversion 3.11 Name: python-sh Version: 2.0.6 Release: 2.ac8.py3.11%{?dist} Summary: Python subprocess replacement License: MIT URL: https://sh.readthedocs.io/ Source: %{pypi_source sh} BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel # Several tests run the python command. BuildRequires: python-unversioned-command %description %{common_description} %package -n python%{python3_pkgversion}-sh Summary: %{summary} %description -n python%{python3_pkgversion}-sh %{common_description} %prep %autosetup -p 1 -n sh-%{version} %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files sh %check for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s/(.*).mo$/\1%{python3_pkgversion}.mo/"<<<"$m"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s/(.*).([1-8]([^.]+)?)$/\1%{python3_pkgversion}.\2/"<<<"$m"); done for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s/(.*)$/\1%{python3_pkgversion}/"<<<"$b"); done # The tests expect sh.py and sh_test.py to be in the same directory. # https://github.com/amoffat/sh/blob/2.0.6/tests/Dockerfile#L47 # https://github.com/amoffat/sh/blob/2.0.6/tox.ini#L14 mv tests/sh_test.py . # https://github.com/amoffat/sh/commit/bfb2bc97635f694de3e5234dcec08d604f0d880f export SH_TESTS_RUNNING=1 # Normally we should run the tests with %%{py3_test_envvars}, but some tests # fail if we modify PYTHONPATH. # https://github.com/amoffat/sh/issues/692 # Run tests with both poll and select. # https://github.com/amoffat/sh/commit/e8737f82585bc39a3bc079c5fa7054c973148e3d SH_TESTS_USE_SELECT=0 %{python3} sh_test.py SH_TESTS_USE_SELECT=1 %{python3} sh_test.py %files -n python%{python3_pkgversion}-sh -f %{pyproject_files} %license LICENSE.txt %doc README.rst CHANGELOG.md MIGRATION.md %changelog * Thu Apr 04 2024 Ding-Yi Chen - 2.0.6-2.ac8.py3.11 - Cut corner packaging