2017-07-24 18:55:24 +00:00
#
# spec file for package python-distro
#
2025-01-30 13:49:19 +00:00
# Copyright (c) 2025 SUSE LLC
2017-07-24 18:55:24 +00:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
2019-02-05 10:56:20 +00:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
2017-12-24 19:11:57 +00:00
#
2017-07-24 18:55:24 +00:00
2025-01-30 13:49:19 +00:00
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
2023-05-05 12:37:11 +00:00
%{?sle15_python_module_pythons}
2017-07-24 18:55:24 +00:00
%{!?license: %global license %doc }
%bcond_without test
Name : python-distro
2023-12-28 21:54:26 +00:00
Version : 1.9.0
2017-07-24 18:55:24 +00:00
Release : 0
Summary : Linux Distribution - a Linux OS platform information API
2017-12-24 19:11:57 +00:00
License : Apache-2.0
2025-01-30 13:49:19 +00:00
URL : https://github.com/python-distro/distro
2017-07-24 18:55:24 +00:00
Source : https://files.pythonhosted.org/packages/source/d/distro/distro-%{version} .tar.gz
2019-02-05 10:56:20 +00:00
Patch0 : assert_locale.patch
2023-01-03 14:04:35 +00:00
BuildRequires : %{python_module pip}
BuildRequires : %{python_module wheel}
2023-09-22 19:46:54 +00:00
BuildRequires : fdupes
2017-12-24 19:11:57 +00:00
BuildRequires : python-rpm-macros
2025-01-30 13:49:19 +00:00
%if %{with libalternatives}
Requires : alts
BuildRequires : alts
%else
2020-05-27 10:13:00 +00:00
Requires(post) : update-alternatives
2024-02-25 13:04:43 +00:00
Requires(postun) : update-alternatives
2025-01-30 13:49:19 +00:00
%endif
2018-06-13 17:21:24 +00:00
BuildArch : noarch
2017-12-01 17:38:49 +00:00
# SECTION test
%if %{with test}
BuildRequires : %{python_module pytest}
%endif
# /SECTION
2017-07-24 18:55:24 +00:00
%python_subpackages
%description
distro (for: Linux Distribution) provides information about the Linux distribution it runs on, such as a reliable machine-readable ID, or version information.
It is a renewed alternative implementation for Python's original platform.linux_distribution function, but it also provides much more functionality which isn' t necessarily Python bound like a command-line interface.
%prep
2024-02-25 13:04:43 +00:00
%autosetup -p1 -n distro-%{version}
2022-02-16 23:30:16 +00:00
# remove shebang. Has been added by upstream intentionally: https://github.com/python-distro/distro/commit/8032f16a1082ff72471c13ff665f3ad9c929f3b0
sed -i '1{/\/usr\/bin\/env python/d;}' src/distro/distro.py
2017-07-24 18:55:24 +00:00
%build
2023-01-03 14:04:35 +00:00
%pyproject_wheel
2017-07-24 18:55:24 +00:00
%install
2023-01-03 14:04:35 +00:00
%pyproject_install
2020-05-27 10:13:00 +00:00
%python_clone -a %{buildroot} %{_bindir} /distro
2023-09-22 19:46:54 +00:00
%python_expand %fdupes %{buildroot} %{$python_sitelib}/distro
2017-07-24 18:55:24 +00:00
%if %{with test}
2017-12-01 17:38:49 +00:00
%check
2021-11-29 16:28:16 +00:00
export LANG=C.UTF-8
2021-10-20 18:23:13 +00:00
%pytest
2017-07-24 18:55:24 +00:00
%endif
2025-01-30 13:49:19 +00:00
%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative distro
2020-05-27 10:13:00 +00:00
%post
%python_install_alternative distro
%postun
%python_uninstall_alternative distro
2017-07-24 18:55:24 +00:00
%files %{python_files}
2019-02-10 13:34:54 +00:00
%doc CHANGELOG.md README.md
2020-05-27 10:13:00 +00:00
%python_alternative %{_bindir} /distro
2023-09-22 19:46:54 +00:00
%{python_sitelib} /distro
2024-02-25 13:04:43 +00:00
%{python_sitelib} /distro-%{version} .dist-info
2017-07-24 18:55:24 +00:00
%%license LICENSE
%changelog