File google-cloud-sdk.spec of Package google-cloud-sdk.openSUSE_Leap_42.2_Update

#
# spec file for package google-cloud-sdk
#
# Copyright (c) 2017 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 http://bugs.opensuse.org/
#


# Look at to pull the tarball
# cloud.google.com/sdk/

Name:           google-cloud-sdk
Version:        140.0.0
Release:        0
Summary:        Tools for Google Cloud Services
# Tarball from this location includes alpha and beta command line interfaces
License:        Apache-2.0
Group:          System/Management
Url:            https://console.cloud.google.com/storage/browser/cloud-sdk-release/for_packagers/linux/?authuser=0&pli=1
Source0:        %{name}-%{version}.tar.bz2
Source1:        setup.py
# The dependencies listed do not match with up stream naming and our
# packaging conventions
Patch1:         gcsdk-gsutil-hide-deps.patch
# No self updating possible, thus disable the check for new versions
Patch2:         gcsdk-gsutil-no-self-update-check.patch
# cloud-sdk uses the sokcs implementation, as a proxy to set up configuration
# options for httplib2. In python2 httplib2 supplies it's own socks
# implementation which happens to be compatible with the one one in thrid_party
# in python3 httplib2 depends on using an external socks implementation.
# On 2016-1012 the socks implementation used by openSUSE was PySocks version
# 1.5.6 which does not support PROXY_TYPE_HTTP_NO_TUNNEL
Patch3:         gcsdk-no-http-no-tunnel-proxt.patch
# API change in python-google-apitools
Patch4:         gcsdk-no-batch-limit.patch
# Lost in gsutil development, to be resubmitted upstream
Patch5:         gcsdk-gsutil-use-system-certs.patch
# Dependencies are inconsistent within the tarball
Patch6:         gcsdk-bq-hide-deps.patch
Requires:       kubernetes-client
Requires:       python
Requires:       python-Jinja2
Requires:       python-MarkupSafe
Requires:       python-PyYAML                    => 3.11
Requires:       python-Pygments                  => 1.5
Requires:       python-SocksiPy                  => 1.0
Requires:       python-antlr3_runtime            => 3.0.1
Requires:       python-argcomplete
Requires:       python-argparse                  => 1.2.1
Requires:       python-boto                      => 2.42.0
Requires:       python-chardet                   => 2.0.1
Requires:       python-crcmod                    => 1.7
Requires:       python-dnspython                 => 1.9.4
Requires:       python-docker-py
Requires:       python-dulwich                   => 0.10.2
Requires:       python-enum34
Requires:       python-fasteners                 => 0.14.1
Requires:       python-funcsigs                  => 1.0.2
Requires:       python-gcs-oauth2-boto-plugin    => 1.14
Requires:       python-gflags                    => 2.0
Requires:       python-google-api-python-client  => 0.1.3
Requires:       python-google-apitools           => 0.5.6
Requires:       python-httplib2                  => 0.9.2
Requires:       python-ipaddr                    => 2.1.11
Requires:       python-monotonic                 => 1.2
Requires:       python-oauth2                    => 1.5.170
Requires:       python-oauth2client              => 2.2.0
Requires:       python-oauth2client-gce
Requires:       python-portpicker
Requires:       python-pyasn1                    => 0.1.9
Requires:       python-pyasn1-modules
Requires:       python-python-dateutil           => 2.4.2
Requires:       python-python-gflags
Requires:       python-python-mimeparse
Requires:       python-requests                  => 2.10
Requires:       python-retry_decorator           => 1.0.0
Requires:       python-rsa                       => 3.1.2
Requires:       python-ruamel.yaml               => 0.11.11
Requires:       python-six                       => 1.9.0
Requires:       python-uritemplate
Requires:       python-urllib3                   => 1.15.1
Requires:       python-wcwidth
Requires:       python-websocket-client
Provides:       gcutils > 1.13.0
Provides:       gsutils > 3.42
Obsoletes:      gcutils <= 1.13.0
Obsoletes:      gsutils <= 3.42
BuildRequires:  python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%description
Google Cloud SDK contains tools and libraries that allow you to create and
manage resources on Google Cloud Platform, including App Engine, Compute
Engine, Cloud Storage, Cloud SQL, and BigQuery.

%prep
%setup -q
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
# The following python packages have independent upstream
mv lib/third_party/{containerregistry,fancy_urllib,gae_ext_runtime,pyu2f} lib
rm -rf lib/third_party
rm -rf lib/tools
cp %{SOURCE1} %{_builddir}/%{name}-%{version}

%build
# The top level lib dire does not become a Python package
rm lib/__init__.py
python setup.py build
pushd platform/gsutil
python setup.py build bdist
popd
pushd platform/bq
python setup.py build
popd

%install
# Leave it to Google to set silly permissions, fix it
find . -name "*.html" | xargs chmod -x 
find . -name "*.json" | xargs chmod -x
find . -name "*_test.py" | xargs chmod +x
install -d -m 755 %{buildroot}/%{_mandir}/man1
install -m 644 help/man/man1/* %{buildroot}/%{_mandir}/man1
# Remove shebang from files intended for import
#find lib/googlecloudsdk/third_party/appengine -type f | xargs grep -l '#!' | xargs sed -i 1d
# Install gcloud
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
install -d %{buildroot}/%{_bindir}
install -d %{buildroot}/%{_defaultdocdir}/%{name}
install -d %{buildroot}/%{_mandir}
install -d %{buildroot}/%{_sysconfdir}/bash_completion.d
cp completion.bash.inc %{buildroot}/%{_sysconfdir}/bash_completion.d/gcloud.sh
echo "#!/bin/sh" > %{buildroot}/%{_bindir}/gcloud
echo "python %{python_sitelib}/googlecloudsdk/gcloud_main.py \"\$@\"" >> %{buildroot}/%{_bindir}/gcloud
chmod +x %{buildroot}/%{_bindir}/gcloud
# Install gsutil
pushd platform/gsutil
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
popd
# Install bigquery
pushd platform/bq
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
popd

%files
%defattr(-,root,root,-)
%doc LICENSE README RELEASE_NOTES
%dir %{python_sitelib}/googlecloudsdk
%dir %{python_sitelib}/google_cloud_sdk-%{version}-py%{py_ver}.egg-info
%dir %{python_sitelib}/surface
%{_mandir}/man*/*
%{_bindir}/gcloud
%{python_sitelib}/googlecloudsdk/*
%{python_sitelib}/google_cloud_sdk-%{version}-py%{py_ver}.egg-info/*
%{python_sitelib}/surface/*
%config %{_sysconfdir}/bash_completion.d/gcloud.sh
# integrated gsutil
%dir %{python_sitelib}/gslib
%dir %{python_sitelib}/gsutil-4.22-py%{py_ver}.egg-info
%dir %{python_sitelib}/test
%{_bindir}/gsutil
%{python_sitelib}/gslib/*
%{python_sitelib}/gsutil-4.22-py%{py_ver}.egg-info/*
%{python_sitelib}/test/*
# integrated bq
%dir %{python_sitelib}/bigquery-2.0.24-py%{py_ver}.egg-info
%dir %{python_sitelib}/discovery
%{_bindir}/bq
%{python_sitelib}/bigquery_*
%{python_sitelib}/bigquery-2.0.24-py%{py_ver}.egg-info/*
%{python_sitelib}/bq.*
%{python_sitelib}/bq_*
%{python_sitelib}/discovery/*
%{python_sitelib}/table_formatter.*
# built in dependency on fancy_urllib, not available as stand alone code stream
%dir %{python_sitelib}/fancy_urllib
%{python_sitelib}/fancy_urllib/*
# built in dependency on gae_ext_runtime, not available as stand alone
# code stream
%dir %{python_sitelib}/gae_ext_runtime
%{python_sitelib}/gae_ext_runtime/*
# built in dependency on containerregistry, not available as stand alone
%dir %{python_sitelib}/containerregistry
%{python_sitelib}/containerregistry/*
# built in dependency on pyu2f, not available as stand alone
%dir %{python_sitelib}/pyu2f
%{python_sitelib}/pyu2f/*

%changelog
openSUSE Build Service is sponsored by