From 89880c647967f2bc306be04b37d96de3e7879689 Mon Sep 17 00:00:00 2001 From: tigro Date: Sat, 14 Dec 2024 22:29:51 +0300 Subject: [PATCH] import python-nihtest-1.5.0-5.el10 --- .gitignore | 1 + .python-nihtest.metadata | 1 + SOURCES/run_tests_using_cmake_and_ctest.patch | 55 +++++++ SPECS/python-nihtest.spec | 151 ++++++++++++++++++ 4 files changed, 208 insertions(+) create mode 100644 .gitignore create mode 100644 .python-nihtest.metadata create mode 100644 SOURCES/run_tests_using_cmake_and_ctest.patch create mode 100644 SPECS/python-nihtest.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..38f023d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/nihtest-1.5.0.tar.gz diff --git a/.python-nihtest.metadata b/.python-nihtest.metadata new file mode 100644 index 0000000..7effbfd --- /dev/null +++ b/.python-nihtest.metadata @@ -0,0 +1 @@ +0ac5914f111791ea0882c3f0ac728388184827cb SOURCES/nihtest-1.5.0.tar.gz diff --git a/SOURCES/run_tests_using_cmake_and_ctest.patch b/SOURCES/run_tests_using_cmake_and_ctest.patch new file mode 100644 index 0000000..567ccbb --- /dev/null +++ b/SOURCES/run_tests_using_cmake_and_ctest.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9451fb4..0c6996c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,27 +11,27 @@ enable_testing() + + find_package(Python3 REQUIRED COMPONENTS Interpreter) + +-set(VENV ${CMAKE_BINARY_DIR}/venv) ++#set(VENV ${CMAKE_BINARY_DIR}/venv) + if (WIN32) +- set(VENV_BIN_DIR ${VENV}/Scripts) +- set(VENV_PYTHON ${VENV_BIN_DIR}/python.exe) ++ #set(VENV_BIN_DIR ${VENV}/Scripts) ++ #set(VENV_PYTHON ${VENV_BIN_DIR}/python.exe) + else () # assume Linux +- set(VENV_BIN_DIR ${VENV}/bin) +- set(VENV_PYTHON ${VENV_BIN_DIR}/python) ++ #set(VENV_BIN_DIR ${VENV}/bin) ++ #set(VENV_PYTHON ${VENV_BIN_DIR}/python) + endif () + +-set(NIHTEST ${VENV_BIN_DIR}/nihtest) ++#set(NIHTEST ${VENV_BIN_DIR}/nihtest) + + file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/nihtest/*.py) + +-add_custom_command( +- OUTPUT ${NIHTEST} +- COMMAND ${Python3_EXECUTABLE} -m venv ${VENV} +- COMMAND ${VENV_BIN_DIR}/pip install -q --disable-pip-version-check ${CMAKE_SOURCE_DIR} +- DEPENDS ${SOURCES} +-) ++#add_custom_command( ++ #OUTPUT ${NIHTEST} ++ #COMMAND ${Python3_EXECUTABLE} -m venv ${VENV} ++ #COMMAND ${VENV_BIN_DIR}/pip install -q --disable-pip-version-check ${CMAKE_SOURCE_DIR} ++ #DEPENDS ${SOURCES} ++#) + +-add_custom_target(venv ALL DEPENDS ${NIHTEST}) ++#add_custom_target(venv ALL #DEPENDS ${NIHTEST}) + + # TODO: target for wheel + +diff --git a/tests/nihtest.conf.in b/tests/nihtest.conf.in +index 4204af3..dd3677e 100644 +--- a/tests/nihtest.conf.in ++++ b/tests/nihtest.conf.in +@@ -5,3 +5,5 @@ program-directories = @PROJECT_BINARY_DIR@ + @PROJECT_BINARY_DIR@/Release + @PROJECT_BINARY_DIR@/Debug + @VENV_BIN_DIR@ ++ ++[environment] diff --git a/SPECS/python-nihtest.spec b/SPECS/python-nihtest.spec new file mode 100644 index 0000000..6d1cf23 --- /dev/null +++ b/SPECS/python-nihtest.spec @@ -0,0 +1,151 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.6.5) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 5; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +%global pypi_name nihtest +%global forgeurl https://github.com/nih-at/nihtest + +%bcond_without tests + +Name: python-%{pypi_name} +Version: 1.5.0 +Release: %{autorelease} +Summary: A testing tool for command line utilities +%forgemeta +License: BSD-3-Clause +URL: %forgeurl +Source: %forgesource +Patch: run_tests_using_cmake_and_ctest.patch + +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: git-core +# For generating manpages +BuildRequires: make, mandoc +# For running tests using CMake +%if %{with tests} +BuildRequires: cmake, gcc +%endif + +%global _description %{expand: +This is nihtest, a testing tool for command line utilities. + +Tests are run in a sandbox directory to guarantee a clean separation of +the test. + +It checks that exit code, standard and error outputs are as expected +and compares the files in the sandbox after the run with the expected +results.} + +%description %_description + + +%package -n python3-%{pypi_name} +Summary: %{summary} +Provides: nihtest = %{?epoch:%{epoch}:}%{version}-%{release} + +%description -n python3-%{pypi_name} %_description + + +%prep +%autosetup -p1 -n %{pypi_name}-%{version} -S git + +# Work around issue with package discovery due to SPECPARTS dir +# https://github.com/rpm-software-management/rpm/issues/2532 +# Another option seems to be to remove that dir +echo -e '\n[tool.setuptools]\npackages = ["nihtest"]\n' >> pyproject.toml + + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + +# Generate man pages and docs +pushd manpages +make %{?_smp_mflags} +popd + + +%install +%pyproject_install +%pyproject_save_files %{pypi_name} + +mkdir -p %{buildroot}/%{_mandir}/man{1,5} +mv manpages/nihtest.man manpages/nihtest.1 +mv manpages/nihtest-case.man manpages/nihtest-case.5 +mv manpages/nihtest.conf.man manpages/nihtest.conf.5 +cp -a manpages/*.1 %{buildroot}/%{_mandir}/man1 +cp -a manpages/*.5 %{buildroot}/%{_mandir}/man5 + + +%check +%pyproject_check_import + +# Run tests using CMake +%if %{with tests} + # Solution for running tests provided by Benson Muite + touch check.sh + echo "PATH=%{buildroot}%{_bindir}:${PATH} PYTHONPATH=%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}:${PYTHONPATH} %{python3} %{buildroot}%{_bindir}/nihtest -v \$1 " >> check.sh + sed -i 's|${NIHTEST}|bash %{_builddir}/%{pypi_name}-%{version}/check.sh|g' tests/CMakeLists.txt + sed -i 's|ENVIRONMENT "PATH=${path}"|ENVIRONMENT "PYTHONPATH=%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}:$ENV{PYTHONPATH}"|g' tests/CMakeLists.txt + echo "PYTHONPATH=%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}" >> tests/nihtest.conf.in + %cmake + %cmake_build + %ctest +%endif + + +%files -n python3-%{pypi_name} -f %{pyproject_files} +%doc README.* +%doc manpages/*.html +%{_bindir}/%{pypi_name} +%{_mandir}/man1/%{pypi_name}.1* +%{_mandir}/man5/%{pypi_name}*.5* + + +%changelog +* Sat Dec 14 2024 Arkady L. Shane - 1.5.0-5 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Tue Oct 29 2024 Troy Dawson - 1.5.0-5 +- Bump release for October 2024 mass rebuild: + +* Mon Jun 24 2024 Troy Dawson - 1.5.0-4 +- Bump release for June 2024 mass rebuild + +* Fri Jan 26 2024 Fedora Release Engineering - 1.5.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 1.5.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Jan 18 2024 Packit - 1.5.0-1 +- [packit] 1.5.0 upstream release +- Resolves rhbz#2258952 + +* Wed Jan 03 2024 Packit - 1.4.0-1 +- [packit] 1.4.0 upstream release +- Resolves rhbz#2255699 + +* Tue Nov 14 2023 Sandro - 1.2.0-4 +- Add Packit config + +* Fri Jul 21 2023 Fedora Release Engineering - 1.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jul 19 2023 Sandro - 1.2.0-1 +- Update to 1.2.0 (RHBZ#2224038) + +* Mon Jul 10 2023 Sandro - 1.1.1-1 +- Initial release (RHBZ#2217257) +## END: Generated by rpmautospec