summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-04-14 07:29:10 +0000
committerCoprDistGit <infra@openeuler.org>2024-04-14 07:29:10 +0000
commit1b268dd6890d46e01faf7405ac7a874cf48bc218 (patch)
treed34b0fd4b511b0c5290cf9e17c30e4566f0faeb1
parent581482f2fdd8cd7f249d5cee2468f7f233d3c236 (diff)
automatic import of python-safetensors
-rw-r--r--python-safetensors.spec17
1 files changed, 14 insertions, 3 deletions
diff --git a/python-safetensors.spec b/python-safetensors.spec
index 6208d56..ad1dac9 100644
--- a/python-safetensors.spec
+++ b/python-safetensors.spec
@@ -13,9 +13,8 @@ License: Apache-2.0
URL: https://github.com/huggingface/safetensors
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/safetensors-%{version}.tar.gz
-BuildRequires: cmake
-BuildRequires: ninja-build
-BuildRequires: g++
+BuildRequires: rust
+BuildRequires: cargo
BuildRequires: python3-devel
BuildRequires: python3-setuptools
@@ -35,12 +34,24 @@ Summary: %{pkg_summary}
%{pkg_description}
%prep
+# 设置 cargo 镜像源
+mkdir -vp ${CARGO_HOME:-$HOME/.cargo}
+
+cat << EOF | tee -a ${CARGO_HOME:-$HOME/.cargo}/config
+[source.crates-io]
+replace-with = 'mirror'
+
+[source.mirror]
+registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
+EOF
%autosetup -p1 -n %{pypi_name}-%{pypi_version}
%build
+cd ./bindings/python
%pyproject_build
%install
+cd ./bindings/python
%pyproject_install
%files -n python3-%{pypi_name}