summaryrefslogtreecommitdiff
path: root/packages/python-google-compute-engine
diff options
context:
space:
mode:
authorRick Wright <rickw@google.com>2019-05-06 13:39:45 -0700
committerRick Wright <rickw@google.com>2019-05-06 13:39:45 -0700
commitc80cde14a79888e0fb4aba3c51298195c0742ab6 (patch)
treef55ed43dd8950b38d9decdbe1b1d756e9adff341 /packages/python-google-compute-engine
parent8e981a43af44be82bf5a57a94a0715c9cb79fb0d (diff)
parent730307675a93ab6da551412878f81d3bb61d2b1f (diff)
downloadgoogle-compute-image-packages-c80cde14a79888e0fb4aba3c51298195c0742ab6.tar.gz
Merge branch 'hostkeys' of https://github.com/wrigri/compute-image-packages into hostkeys
Diffstat (limited to 'packages/python-google-compute-engine')
-rw-r--r--packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py7
-rw-r--r--packages/python-google-compute-engine/google_compute_engine/compat.py2
-rw-r--r--packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec47
-rwxr-xr-xpackages/python-google-compute-engine/packaging/setup_rpm.sh13
-rwxr-xr-xpackages/python-google-compute-engine/setup.py6
5 files changed, 67 insertions, 8 deletions
diff --git a/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py b/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py
index 0c31052..93e55ae 100644
--- a/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py
+++ b/packages/python-google-compute-engine/google_compute_engine/boto/tests/compute_auth_test.py
@@ -15,11 +15,16 @@
"""Unittest for compute_auth.py module."""
-from google_compute_engine.boto import compute_auth
+import sys
+
from google_compute_engine.test_compat import mock
from google_compute_engine.test_compat import unittest
+if sys.version_info < (3, 0):
+ from google_compute_engine.boto import compute_auth
+
+@unittest.skipIf(sys.version_info > (3, 0), 'Skipping for python3.')
class ComputeAuthTest(unittest.TestCase):
def setUp(self):
diff --git a/packages/python-google-compute-engine/google_compute_engine/compat.py b/packages/python-google-compute-engine/google_compute_engine/compat.py
index eb69763..3d18c12 100644
--- a/packages/python-google-compute-engine/google_compute_engine/compat.py
+++ b/packages/python-google-compute-engine/google_compute_engine/compat.py
@@ -19,7 +19,7 @@ import logging
import subprocess
import sys
-if sys.version_info >= (3, 6):
+if sys.version_info >= (3, 7):
import distro
else:
import platform as distro
diff --git a/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec b/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec
new file mode 100644
index 0000000..6bf3291
--- /dev/null
+++ b/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec
@@ -0,0 +1,47 @@
+# Copyright 2019 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+Name: python3-google-compute-engine
+Version: %{_version}
+Release: 1%{?dist}
+Summary: Google Compute Engine python3 library
+License: ASL 2.0
+Url: https://github.com/GoogleCloudPlatform/compute-image-packages
+Source0: %{name}_%{version}.orig.tar.gz
+
+BuildArch: noarch
+BuildRequires: python36-devel python3-setuptools
+
+Requires: python3-setuptools
+
+%description
+Google Compute Engine python library for Python 3.x.
+
+%prep
+%autosetup
+
+%build
+%py3_build
+
+%install
+%py3_install
+
+%files
+%{python3_sitelib}/google_compute_engine/
+%{python3_sitelib}/google_compute_engine*.egg-info/
+%{_bindir}/google_accounts_daemon
+%{_bindir}/google_clock_skew_daemon
+%{_bindir}/google_instance_setup
+%{_bindir}/google_metadata_script_runner
+%{_bindir}/google_network_daemon
diff --git a/packages/python-google-compute-engine/packaging/setup_rpm.sh b/packages/python-google-compute-engine/packaging/setup_rpm.sh
index d1eccc3..a9514af 100755
--- a/packages/python-google-compute-engine/packaging/setup_rpm.sh
+++ b/packages/python-google-compute-engine/packaging/setup_rpm.sh
@@ -23,12 +23,17 @@ if [[ $(basename "$working_dir") != $NAME ]]; then
exit 1
fi
-# Build dependencies.
-sudo yum -y install python2-devel python-setuptools python-boto
-
-# RPM creation tools.
sudo yum -y install rpmdevtools
+# RHEL/CentOS 8 uses python3.
+if grep -q '^\(CentOS\|Red Hat\)[^0-9]*8\..' /etc/redhat-release; then
+ NAME="python3-google-compute-engine"
+ rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION}
+ sudo yum -y install python36-devel python3-setuptools python36-rpm-macros
+else
+ sudo yum -y install python2-devel python-setuptools python-boto
+fi
+
rm -rf /tmp/rpmpackage
mkdir -p ${rpm_working_dir}/{SOURCES,SPECS}
diff --git a/packages/python-google-compute-engine/setup.py b/packages/python-google-compute-engine/setup.py
index 59a61b3..53f970a 100755
--- a/packages/python-google-compute-engine/setup.py
+++ b/packages/python-google-compute-engine/setup.py
@@ -20,8 +20,10 @@ import sys
import setuptools
-install_requires = ['boto', 'setuptools']
-if sys.version_info >= (3, 6):
+install_requires = ['setuptools']
+if sys.version_info < (3, 0):
+ install_requires += ['boto']
+if sys.version_info >= (3, 7):
install_requires += ['distro']
setuptools.setup(