%global pkgvers 0
%global scdate0 20250218
%global schash0 f15fd3a23312f704d1f82b740ba7d7b09c6dcbd8
%global branch0 main
%global source0 https://github.com/pytorch/data.git

%global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}}

Name:           pytorch-data
Version:        %(curl -s "https://raw.githubusercontent.com/pytorch/data/%{schash0}/version.txt" | sed 's|.[a-z,A-Z]||')
Release:        %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist}
Summary:        TorchData
License:        BSD
BuildArch:      noarch

URL:            https://github.com/pytorch/data

BuildRequires:  git python3-devel python3-setuptools
BuildRequires:  pytorch-python3 python3-typing-extensions python3-requests

%global vcu_maj 12
%global vcu_min 6

BuildRequires:  libcurand-%{vcu_maj}-%{vcu_min}
BuildRequires:  libcublas-%{vcu_maj}-%{vcu_min}
BuildRequires:  cuda-nvtx-%{vcu_maj}-%{vcu_min}
BuildRequires:  cuda-cupti-%{vcu_maj}-%{vcu_min}
BuildRequires:  nvidia-driver-cuda-libs

%description
TorchData is a prototype library of common modular data
loading primitives for easily constructing flexible and
performant data pipelines.

%package        python3
Summary:        TorchData
Provides:       pytorch-data
Requires:       pytorch-python3 python3-urllib3 python3-requests

%description    python3
TorchData is a prototype library of common modular data
loading primitives for easily constructing flexible and
performant data pipelines.


%prep
%setup -T -c -n %{name}
git clone --depth 1 -n -b %{branch0} %{source0} .
git fetch --depth 1 origin %{schash0}
git reset --hard %{schash0}
git log --format=fuller


%build
mkdir -p build
export LD_LIBRARY_PATH=/usr/local/cuda-%{vcu_maj}.%{vcu_min}/lib64/
%py3_build


%install
export LD_LIBRARY_PATH=/usr/local/cuda-%{vcu_maj}.%{vcu_min}/lib64/
%py3_install
sed -i 's|[!<=>].*||g' %{buildroot}%{python3_sitelib}/*.egg-info/requires.txt


%files python3
%doc README.md
%license LICENSE
%{python3_sitelib}/*


%changelog
* Thu Mar 24 2016 Balint Cristian <cristian.balint@gmail.com>
- github update releases