File python-vagrant.spec of Package python-vagrant

#
# spec file
#
# Copyright (c) 2024 SUSE LLC
#
# 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/
#


%define appname vagrant
# no tests in OBS, nested virtualization for VirtualBox and internet access for image download from the Vagrant cloud are needed
%bcond_with test
%if %{with test}
%define psuffix -test
%else
%define psuffix %{nil}
%endif
Name:           python-%{appname}%{psuffix}
Version:        1.1.0
Release:        0
Summary:        Python bindings for Vagrant
License:        MIT
Group:          Development/Languages/Python
URL:            https://github.com/pycontribs/python-vagrant
Source0:        https://github.com/pycontribs/python-vagrant/archive/refs/tags/v%{version}.tar.gz#/%{appname}-%{version}-gh.tar.gz
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  %{pythons}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       vagrant
Provides:       python3-python-vagrant
BuildArch:      noarch
%if %{with test}
BuildRequires:  %{python_module cachetools}
BuildRequires:  %{python_module chardet}
BuildRequires:  %{python_module colorama}
BuildRequires:  %{python_module pyproject-api}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module tox}
BuildRequires:  %{python_module vagrant}
BuildRequires:  vagrant-vbguest
%endif
%python_subpackages

%description
Python bindings for interacting with Vagrant virtual machines.

%prep
%autosetup

%build
%if !%{with test}
%pyproject_wheel
%endif

%install
%if !%{with test}
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}/%{appname}
%endif

%if %{with test}
%check
mkdir /tmp/vagrant
export VAGRANT_HOME=/tmp/vagrant
%pytest tests/test_vagrant.py
rm -r /tmp/vagrant
%endif

%if !%{with test}
%files %{python_files}
%license LICENSE.txt
%doc CHANGELOG.md README.md
%{python_sitelib}/%{appname}
%{python_sitelib}/python_%{appname}-0.0.0.dist-info
%endif

%changelog
openSUSE Build Service is sponsored by