File python-safetensors.spec of Package failed_python-safetensors

#
# spec file for package python-safetensors
#
# 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/
#

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15_python_module_pythons}
Name:           python-safetensors
Version:        0.4.3
Release:        0
Summary:        Safetensors is a simple format for storing tensors safely
License:        Apache-2.0
URL:            https://github.com/huggingface/safetensors
Source:         https://github.com/huggingface/safetensors/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module maturin}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  cargo-packaging
%python_subpackages

%description
This repository implements a new simple format for storing tensors safely (as
opposed to pickle) and that is still fast (zero-copy).

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

%build
# New: set PyO3 abi3 forward compatibility to allow building against Python
# versions newer than PyO3's maximum supported version. This suppresses
# the PyO3 version check and uses the stable ABI.
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
cd bindings/python
tar xzf %{S:1}
%pyproject_wheel

%install
# Ensure the same environment variable is present during install as well
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
cd bindings/python
%pyproject_install
%python_expand %fdupes %{buildroot}/%{$python_sitearch}/*

%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitearch}/safetensors*

%changelog
openSUSE Build Service is sponsored by