17
0

4 Commits

3 changed files with 48 additions and 3 deletions

3
_multibuild Normal file
View File

@@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Aug 25 14:26:40 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to libalternatives on SLE-16-based and newer systems
-------------------------------------------------------------------
Wed Feb 5 12:20:58 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>
- Use multibuild for tests
-------------------------------------------------------------------
Sat Mar 16 14:23:15 UTC 2024 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-userpath
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,8 +16,21 @@
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name: python-userpath
Name: python-userpath%{psuffix}
Version: 1.9.2
Release: 0
Summary: Tool for adding locations to the user PATH
@@ -30,12 +43,20 @@ BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-click
BuildArch: noarch
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%endif
%if %{with test}
# SECTION test requirements
BuildRequires: %{python_module click}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module userpath = %{version}}
%endif
# /SECTION
%python_subpackages
@@ -47,28 +68,39 @@ with no elevated privileges required.
%autosetup -p1 -n userpath-%{version}
%build
%if !%{with test}
%pyproject_wheel
%endif
%install
%if !%{with test}
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/userpath
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%check
%if %{with test}
export LC_ALL=C.UTF-8
%pytest
%endif
%if !%{with test}
%post
%python_install_alternative userpath
%postun
%python_uninstall_alternative userpath
%pre
%python_libalternatives_reset_alternative userpath
%files %{python_files}
%doc README.md
%license LICENSE.txt
%python_alternative %{_bindir}/userpath
%{python_sitelib}/userpath
%{python_sitelib}/userpath-%{version}*-info
%endif
%changelog