File python-anymarkup.spec of Package python-anymarkup

#
# spec file for package python-anymarkup
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2020 SUSE Software Solutions Germany GmbH.
#
# 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.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif

Name:           python-anymarkup
Version:        0.8.1
Release:        0
Summary:        Parse or serialize any markup in Python
License:        BSD-3-Clause
Group:          Development/Languages/Python
URL:            https://github.com/bkabrda/anymarkup
Source0:        https://github.com/bkabrda/anymarkup/archive/v%{version}/anymarkup-%{version}.tar.gz
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Suggests:       python-click
BuildArch:      noarch
# SECTION test requirements
BuildRequires:  %{python_module PyYAML}
BuildRequires:  %{python_module anymarkup-core >= 0.8.0}
BuildRequires:  %{python_module click}
BuildRequires:  %{python_module configobj}
BuildRequires:  %{python_module json5}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module toml}
BuildRequires:  %{python_module xmltodict}
# /SECTION
Requires:       python-anymarkup-core
Requires:       python-PyYAML
Requires:       python-click
Requires:       python-configobj
Requires:       python-json5
Requires:       python-toml
Requires:       python-xmltodict

%if %{with libalternatives}
BuildRequires:  alts
Requires:       alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif

%python_subpackages

%description
Parse or serialize any markup. Currently supports ini, json, json5, toml,
xml and yaml.

%prep
%autosetup -p1 -n anymarkup-%{version}

%build
%pyproject_wheel

%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/anymarkup
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%check
donttest="test_no_arguments"
%pytest -k "not ($donttest)"

%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative anymarkup

%post
%python_install_alternative anymarkup

%postun
%python_uninstall_alternative anymarkup

%files %{python_files}
%doc README.rst
%license LICENSE
%python_alternative %{_bindir}/anymarkup
%{python_sitelib}/anymarkup
%{python_sitelib}/anymarkup*-info

%changelog
openSUSE Build Service is sponsored by