%global pkgvers 0 %global scdate0 20210804 %global schash0 3a33d53ea4aca312c5ad650b4883d9bac608a32e %global branch0 r2.6 %global source0 https://github.com/keras-team/keras.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} Name: keras-2.6 Version: %(curl -s "https://raw.githubusercontent.com/keras-team/keras/%{schash0}/keras/tools/pip_package/setup.py" | grep "VERSION =" | cut -d"'" -f2 | sed 's|.[a-z,A-Z]||') Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: Keras: Deep Learning for humans License: BSD Patch0: keras-protobuf.patch URL: https://keras.io ExclusiveArch: x86_64 aarch64 ppc64le BuildRequires: bazel5 gcc-c++ git unzip python3-devel python3-setuptools BuildRequires: tensorflow-2.6 Requires: tensorflow-2.6 Provides: keras = %{version} %global debug_package %{nil} %global _lto_cflags %{nil} %undefine _hardened_build %undefine _annotated_build %description Keras is a deep learning API written in Python, running on top of the machine learning platform TensorFlow. %prep %setup -T -c keras -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} keras git -C keras fetch --depth 1 origin %{schash0} git -C keras reset --hard %{schash0} git -C keras log --format=fuller %patch0 -p1 -b .proto~ %build pushd keras # python3 tooling sed -i 's|python keras/tools|python3 keras/tools|' keras/tools/pip_package/build_pip_package.sh export TMP=/tmp export TEST_TMPDIR="%{_builddir}/%{name}" bazel build \ --subcommands \ --explain=build.log \ --show_result=2147483647 \ --local_ram_resources=32768 \ --jobs 16 \ --verbose_failures \ --incompatible_use_python_toolchains \ //keras/tools/pip_package:build_pip_package %install rm -rf %{buildroot} pushd keras export PYTHON_BIN_PATH=%{python3} bash ./bazel-bin/keras/tools/pip_package/build_pip_package %{buildroot}/%{python3_sitearch}/ unzip %{buildroot}/%{python3_sitearch}/*.whl -d %{buildroot}/%{python3_sitearch}/ rm -rf %{buildroot}/%{python3_sitearch}/*.whl rm -rf %{buildroot}/%{python3_sitearch}/*.data # fix chmod find %{buildroot}/%{python3_sitearch}/ -type f -exec chmod 644 {} \; popd %files %license keras/LICENSE %doc keras/README.md %doc keras/CONTRIBUTING.md %{python3_sitearch}/* %changelog * Wed Dec 04 2019 Balint Cristian - github upstream releases