summaryrefslogtreecommitdiff
path: root/python-safetensors.spec
blob: c900bbf64092af0b71be56523bae9320d33ca34a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%global pypi_name safetensors
%global pypi_version 0.4.2
%global pkg_summary Simple, safe way to store and distribute tensors
%global pkg_description %{expand:
%{pkg_summary}}
%global debug_package %{nil}

Name:           python-%{pypi_name}
Version:        %{pypi_version}
Release:        1
Summary:        %{pkg_summary}

License:        Apache-2.0
URL:            https://github.com/huggingface/safetensors
Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz#/safetensors-%{version}.tar.gz

BuildRequires: rust
BuildRequires: cargo

BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-setuptools_scm
BuildRequires: python3-pbr
BuildRequires: python3-pip
BuildRequires: python3-wheel
BuildRequires: python3-hatchling
BuildRequires: python3-maturin

%description
%{pkg_description}

%package -n     python3-%{pypi_name}
Summary:        %{pkg_summary}

%description -n python3-%{pypi_name}
%{pkg_description}

%prep
# 设置 cargo 镜像源
mkdir -vp ${CARGO_HOME:-$HOME/.cargo}

cat << EOF | tee -a ${CARGO_HOME:-$HOME/.cargo}/config
[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true
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}
%license LICENSE
%doc README.md
%{python3_sitearch}/%{pypi_name}*

%changelog
* Sun Mar 31 2024 YunShu
- add safetensors 0.4.2