summaryrefslogtreecommitdiff
path: root/torchtext.spec
blob: b2be746468ac51fc65ff73aea31a24ead3b066ea (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
%global _empty_manifest_terminate_build 0
%global _unpackaged_files_terminate_build 0

# set global to speedup the spec editing
%global pkg_name torchtext
%global version 0.17.2
%global pkg_summary torchtext is used to process text data
%global pkg_desc %{pkg_summary}
%global pkg_license BSD-3-Clause

Name:           %{pkg_name}
Version:        %{version}        
Release:        1
Summary:        %{pkg_summary}
License:        %{pkg_license}

# the url and source
URL:            https://pytorch.org/text/stable/index.html
Source0:        https://github.com/pytorch/text/archive/refs/tags/v%{version}.tar.gz#/text-%{version}.tar.gz

Source1:        https://github.com/google/double-conversion/archive/refs/tags/v3.3.0.tar.gz#/double-conversion-3.3.0.tar.gz
Source2:        https://github.com/google/re2/archive/refs/tags/2024-04-01.tar.gz#/re2-2024-04-01.tar.gz
Source3:        https://github.com/google/sentencepiece/archive/refs/tags/v0.2.0.tar.gz#/sentencepiece-0.2.0.tar.gz
Source4:        https://github.com/JuliaStrings/utf8proc/archive/refs/tags/v2.9.0.tar.gz#/utf8proc-2.9.0.tar.gz

# patch
Patch0:		001-fix-submodule.patch

# build requires
BuildRequires:  g++
BuildRequires:  cmake
BuildRequires:  ninja-build

# manual add third party lib
BuildRequires:  re2-devel
BuildRequires:  sentencepiece-devel
BuildRequires:  utf8proc-devel
BuildRequires:  double-conversion-devel

BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
BuildRequires:	python3-wheel
BuildRequires:  python3-hatchling
BuildRequires:	python3-setuptools_scm
BuildRequires:  python3-pytorch

%description
%{pkg_summary}

# sub pkg section 1
%package -n python3-%{pkg_name}
Summary: %{pkg_summary}

%description -n python3-%{pkg_name}
%{pkg_desc}

# pkg section: help optional
# %package -n help
# Summary: docs for the transformers
# Provides: python3-transformers-doc
# %description -n help
# description for the doc of the python3-transformers


# the name here should match the name of tar.gz file
%prep
%autosetup -p1 -n text-%{version}
tar -xvf %{_sourcedir}/re2-2024-04-1.tar.gz -C text-%{version}/third_party
tar -xvf %{_sourcedir}/sentencepiece-0.2.0.tar.gz -C text-%{version}/third_party
tar -xvf %{_sourcedir}/utf8proc-2.9.0.tar.gz -C text-%{version}/third_party
tar -xvf %{_sourcedir}/double-conversion-3.3.0.tar.gz -C text-%{version}/third_party
cd text-%{version}
ls -lh

%build
%pyproject_build

%install
%pyproject_install

%files -n python3-%{pkg_name}
%doc README*
%license LICENSE*
%{python3_sitelib}/python_%{pkg_name}/*


%changelog
* Mon Apr 15 2024 youser<1328699220@qq.com>
- pkg init