File python-tensorboard.spec of Package python-tensorboard
#
# spec file for package python-tensorboard
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define pipName tensorboard
%define pipArchiveName %{pipName}
%define skip_python2 1
Name: python-%{pipName}
Version: 2.1.0
Release: 0
URL: https://github.com/tensorflow/tensorboard
Summary: Python: TensorBoard lets you watch Tensors Flow
License: Apache-2.0
Group: Development/Languages/Python
Requires: python-absl-py >= 0.4
Requires: python-grpcio >= 1.24.3
Requires: python-google-auth < 2, python-google-auth >= 1.6.3
Requires: python-google-auth-oauthlib < 0.5, python-google-auth-oauthlib >= 0.4.1
Requires: python-Markdown >= 2.6.8
Requires: python-numpy >= 1.12.0
Requires: python-protobuf >= 3.6.0
Requires: python-requests < 3, python-requests >= 2.21.0
Requires: python-setuptools >= 41.0.0
Requires: python-six >= 1.10.0
Requires: python-Werkzeug >= 0.11.15
%ifpython2
Requires: python-futures >= 3.1.1
Requires: python-wheel
%endif
%ifpython3
Requires: python-wheel >= 0.26
%endif
Requires(post): update-alternatives
Requires(postun): update-alternatives
Source: %{pipArchiveName}-%{version}-py3-none-any.whl
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python2-pip
BuildRequires: python3-pip
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%python_subpackages
%description
TensorBoard lets you watch Tensors Flow
Author: Google Inc. (packages@tensorflow.org)
%prep
# nothing
%build
mkdir simple
cat >simple/index.html <<EOF
<html><head><title>Simple Index</title><meta name='api-version' value='2' /></head><body>
<a href='%{pipName}/'>%{pipName}</a><br />
</body></html>
EOF
mkdir simple/%{pipName}
cp -v %{S:0} simple/%{pipName}
archive=$(basename %{S:0})
cat >simple/%{pipName}/index.html <<EOF
<a href='$archive'>$archive</a><br />
EOF
%install
pip3 install --no-deps --index-url=file://$(pwd)/simple/ --root %{buildroot} %{pipName}
# clean out spurious exec permissions
chmod -x %{buildroot}%{python3_sitelib}/%{pipName}/webfiles.zip
find %{buildroot}/usr/lib* -name \*.py | while read file; do
if grep -qs '^#! *%{_bindir}/env' $file; then
echo "Removing #!/usr/bin/env from $file"
orig=$file.orig
ln $file $orig
sed -i 's|^#! *%{_bindir}/env .*$||g' $file
touch --reference $orig $file
rm -f $orig
fi
done
%{python_clone %{buildroot}%{_bindir}/tensorboard}
%prepare_alternative tensorboard
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%post
%python_install_alternative %{_bindir}/tensorboard
%postun
%python_uninstall_alternative tensorboard
%files %{python_files}
%defattr(-,root,root)
%{python_sitelib}
%{_bindir}/tensorboard
%{_bindir}/tensorboard-%{python_version}
%ghost %{_sysconfdir}/alternatives/tensorboard
%changelog