%global python3_pkgversion 3.11 Name: python-expandvars Version: 0.12.0 Release: 2.ac12.py3.11%{?dist} Summary: Expand system variables Unix style # SPDX License: MIT URL: https://github.com/sayanarijit/expandvars Source: %{pypi_source expandvars} BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel # Most of the dependencies in the “test” extra and almost everything tox.ini # pertain to linting and coverage analysis. Rather than working around all of # these, it is simpler to BR and invoke pytest manually. # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters BuildRequires: %{py3_dist pytest} %global common_description %{expand: This module is inspired by GNU bash’s variable expansion features. It can be used as an alternative to Python’s os.path.expandvars function. A good use case is reading config files with the flexibility of reading values from environment variables using advanced features like returning a default value if some variable is not defined.} %description %{common_description} %package -n python%{python3_pkgversion}-expandvars Summary: %{summary} %description -n python%{python3_pkgversion}-expandvars %{common_description} %prep %autosetup -n expandvars-%{version} # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters sed -r -i "s/--cov[^[:blank:]'\"]*[[:blank:]]*//g" pyproject.toml %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files expandvars %check %pytest for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done %files -n python%{python3_pkgversion}-expandvars -f %{pyproject_files} %doc README.md %changelog * Tue Apr 16 2024 Ding-Yi Chen - 0.12.0-2.ac12.py3.11 - Cut corner packaging