From f701cdfa98aeb441638e594e246a4767ccdab479 Mon Sep 17 00:00:00 2001 From: Patrick McLean Date: Wed, 6 May 2020 19:59:18 -0700 Subject: [PATCH] dev-python/google-apitools-0.5.30_p20200507: Version bump. add py37, py38 Copyright: Sony Interactive Entertainment Inc. Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Patrick McLean --- dev-python/google-apitools/Manifest | 1 + .../files/google-apitools-0.5.30-abc.patch | 81 ++++++++++ .../files/google-apitools-0.5.30-py37.patch | 144 ++++++++++++++++++ .../google-apitools-0.5.30_p20200507.ebuild | 37 +++++ 4 files changed, 263 insertions(+) create mode 100644 dev-python/google-apitools/files/google-apitools-0.5.30-abc.patch create mode 100644 dev-python/google-apitools/files/google-apitools-0.5.30-py37.patch create mode 100644 dev-python/google-apitools/google-apitools-0.5.30_p20200507.ebuild diff --git a/dev-python/google-apitools/Manifest b/dev-python/google-apitools/Manifest index b04e1e87f7d0..7db71160bda5 100644 --- a/dev-python/google-apitools/Manifest +++ b/dev-python/google-apitools/Manifest @@ -1 +1,2 @@ DIST google-apitools-0.5.30.tar.gz 363524 BLAKE2B ed8477c85911f5855a449abe81b465635d3cc4e08d2915de5e882608e634f3dd9ffdda929bd8b25eb3daa5922851aa9304ffe07778cdf3a3aa629e215633515a SHA512 2dffffada829b9b962c64aab22b19cd227981819128c34f3e32515ee599297b3d5e8c97152d954110c2ef27c02737d3c30c785840b9f9767068688f62dc0b5c7 +DIST google-apitools-0.5.30_p20200507.tar.gz 365250 BLAKE2B 58d52016775b387b494d8b5897886f059fe74a360098f6527089039469d4d4e3c0d9ec63a12be1215741fd15a1a03e2204f54ace7c9eaf8bbdc8236c9c1fe576 SHA512 94879360c5de3d7405b7377b2baf0fa303c1b0bace56cf75d203b0a509ac028e1d3208a82ba08de7d17e4e26571c9b8601cb07e6897b658eeede9d06fd384fe3 diff --git a/dev-python/google-apitools/files/google-apitools-0.5.30-abc.patch b/dev-python/google-apitools/files/google-apitools-0.5.30-abc.patch new file mode 100644 index 000000000000..32f61a3d889a --- /dev/null +++ b/dev-python/google-apitools/files/google-apitools-0.5.30-abc.patch @@ -0,0 +1,81 @@ +commit cfefe5a8322b40c6e7bd3cc794fd644edcc3a6d6 +Author: Karthikeyan Singaravelan +Date: Mon Jan 27 20:21:15 2020 +0530 + + Import ABC from collections.abc instead of collections for Python 3.9 compatibility. (#286) + +diff --git a/apitools/base/py/extra_types.py b/apitools/base/py/extra_types.py +index 847dc91..e40a785 100644 +--- a/apitools/base/py/extra_types.py ++++ b/apitools/base/py/extra_types.py +@@ -16,7 +16,6 @@ + + """Extra types understood by apitools.""" + +-import collections + import datetime + import json + import numbers +@@ -30,6 +29,11 @@ from apitools.base.py import encoding_helper as encoding + from apitools.base.py import exceptions + from apitools.base.py import util + ++if six.PY3: ++ from collections.abc import Iterable ++else: ++ from collections import Iterable ++ + __all__ = [ + 'DateField', + 'DateTimeMessage', +@@ -129,7 +133,7 @@ def _PythonValueToJsonValue(py_value): + return JsonValue(double_value=float(py_value)) + if isinstance(py_value, dict): + return JsonValue(object_value=_PythonValueToJsonObject(py_value)) +- if isinstance(py_value, collections.Iterable): ++ if isinstance(py_value, Iterable): + return JsonValue(array_value=_PythonValueToJsonArray(py_value)) + raise exceptions.InvalidDataError( + 'Cannot convert "%s" to JsonValue' % py_value) +@@ -212,7 +216,7 @@ def _JsonProtoToPythonValue(json_proto): + def _PythonValueToJsonProto(py_value): + if isinstance(py_value, dict): + return _PythonValueToJsonObject(py_value) +- if (isinstance(py_value, collections.Iterable) and ++ if (isinstance(py_value, Iterable) and + not isinstance(py_value, six.string_types)): + return _PythonValueToJsonArray(py_value) + return _PythonValueToJsonValue(py_value) +diff --git a/apitools/base/py/util.py b/apitools/base/py/util.py +index ac1a44c..ad086e4 100644 +--- a/apitools/base/py/util.py ++++ b/apitools/base/py/util.py +@@ -16,7 +16,6 @@ + + """Assorted utilities shared between parts of apitools.""" + +-import collections + import os + import random + +@@ -30,6 +29,11 @@ from apitools.base.protorpclite import messages + from apitools.base.py import encoding_helper as encoding + from apitools.base.py import exceptions + ++if six.PY3: ++ from collections.abc import Iterable ++else: ++ from collections import Iterable ++ + __all__ = [ + 'DetectGae', + 'DetectGce', +@@ -78,7 +82,7 @@ def NormalizeScopes(scope_spec): + if isinstance(scope_spec, six.string_types): + scope_spec = six.ensure_str(scope_spec) + return set(scope_spec.split(' ')) +- elif isinstance(scope_spec, collections.Iterable): ++ elif isinstance(scope_spec, Iterable): + scope_spec = [six.ensure_str(x) for x in scope_spec] + return set(scope_spec) + raise exceptions.TypecheckError( diff --git a/dev-python/google-apitools/files/google-apitools-0.5.30-py37.patch b/dev-python/google-apitools/files/google-apitools-0.5.30-py37.patch new file mode 100644 index 000000000000..77f2c59b8296 --- /dev/null +++ b/dev-python/google-apitools/files/google-apitools-0.5.30-py37.patch @@ -0,0 +1,144 @@ +diff --git a/apitools/base/protorpclite/messages.py b/apitools/base/protorpclite/messages.py +index 0d564e9..5b2346a 100644 +--- a/apitools/base/protorpclite/messages.py ++++ b/apitools/base/protorpclite/messages.py +@@ -757,6 +757,7 @@ class Message(six.with_metaclass(_MessageClass, object)): + order.check_initialized() + + """ ++ __hash__ = None + + def __init__(self, **kwargs): + """Initialize internal messages state. +@@ -1079,9 +1080,9 @@ class FieldList(list): + if not field_instance.repeated: + raise FieldDefinitionError( + 'FieldList may only accept repeated fields') +- self.__field = field_instance +- self.__field.validate(sequence) +- list.__init__(self, sequence) ++ self._field = field_instance ++ self._field.validate(sequence) ++ super().__init__(sequence) + + def __getstate__(self): + """Enable pickling. +@@ -1098,10 +1099,10 @@ class FieldList(list): + None. + + """ +- message_class = self.__field.message_definition() ++ message_class = self._field.message_definition() + if message_class is None: +- return self.__field, None, None +- return None, message_class, self.__field.number ++ return self._field, None, None ++ return None, message_class, self._field.number + + def __setstate__(self, state): + """Enable unpickling. +@@ -1115,41 +1116,43 @@ class FieldList(list): + """ + field_instance, message_class, number = state + if field_instance is None: +- self.__field = message_class.field_by_number(number) ++ self._field = message_class.field_by_number(number) + else: +- self.__field = field_instance ++ self._field = field_instance + + @property + def field(self): + """Field that validates list.""" +- return self.__field ++ return self._field + + def __setslice__(self, i, j, sequence): + """Validate slice assignment to list.""" +- self.__field.validate(sequence) ++ self._field.validate(sequence) + list.__setslice__(self, i, j, sequence) + + def __setitem__(self, index, value): + """Validate item assignment to list.""" + if isinstance(index, slice): +- self.__field.validate(value) ++ self._field.validate(value) + else: +- self.__field.validate_element(value) ++ self._field.validate_element(value) + list.__setitem__(self, index, value) + + def append(self, value): + """Validate item appending to list.""" +- self.__field.validate_element(value) ++ if hasattr(self, '_field'): ++ self._field.validate_element(value) + return list.append(self, value) + + def extend(self, sequence): + """Validate extension of list.""" +- self.__field.validate(sequence) ++ if hasattr(self, '_field'): ++ self._field.validate(sequence) + return list.extend(self, sequence) + + def insert(self, index, value): + """Validate item insertion to list.""" +- self.__field.validate_element(value) ++ self._field.validate_element(value) + return list.insert(self, index, value) + + +diff --git a/apitools/base/protorpclite/messages_test.py b/apitools/base/protorpclite/messages_test.py +index 3ad75e4..1acdab3 100644 +--- a/apitools/base/protorpclite/messages_test.py ++++ b/apitools/base/protorpclite/messages_test.py +@@ -508,7 +508,8 @@ class FieldListTest(test_util.TestCase): + def testPickle(self): + """Testing pickling and unpickling of FieldList instances.""" + field_list = messages.FieldList(self.integer_field, [1, 2, 3, 4, 5]) +- unpickled = pickle.loads(pickle.dumps(field_list)) ++ pickled = pickle.dumps(field_list) ++ unpickled = pickle.loads(pickled) + self.assertEquals(field_list, unpickled) + self.assertIsInstance(unpickled.field, messages.IntegerField) + self.assertEquals(1, unpickled.field.number) +diff --git a/apitools/base/protorpclite/protojson_test.py b/apitools/base/protorpclite/protojson_test.py +index 7a8f875..69804f5 100644 +--- a/apitools/base/protorpclite/protojson_test.py ++++ b/apitools/base/protorpclite/protojson_test.py +@@ -440,7 +440,7 @@ class ProtojsonTest(test_util.TestCase, + """Test decoding improperly encoded base64 bytes value.""" + self.assertRaisesWithRegexpMatch( + messages.DecodeError, +- 'Base64 decoding error: Incorrect padding', ++ 'Base64 decoding error: (?:Incorrect padding|Invalid base64-encoded string: .*)', + protojson.decode_message, + test_util.OptionalMessage, + '{"bytes_value": "abcdefghijklmnopq"}') +diff --git a/apitools/base/py/batch_test.py b/apitools/base/py/batch_test.py +index 90cf4fb..e1384c5 100644 +--- a/apitools/base/py/batch_test.py ++++ b/apitools/base/py/batch_test.py +@@ -357,7 +357,7 @@ class BatchTest(unittest.TestCase): + self._DoTestConvertIdToHeader('blah', '<%s+blah>') + + def testConvertIdThatNeedsEscaping(self): +- self._DoTestConvertIdToHeader('~tilde1', '<%s+%%7Etilde1>') ++ self._DoTestConvertIdToHeader('#hash1', r'<%s+%%23hash1>') + + def _DoTestConvertHeaderToId(self, header, expected_id): + batch_request = batch.BatchHttpRequest('https://www.example.com') +diff --git a/apitools/gen/client_generation_test.py b/apitools/gen/client_generation_test.py +index 4e382dd..c26db39 100644 +--- a/apitools/gen/client_generation_test.py ++++ b/apitools/gen/client_generation_test.py +@@ -42,6 +42,7 @@ class ClientGenerationTest(unittest.TestCase): + self.gen_client_binary = 'gen_client' + + @test_utils.SkipOnWindows ++ @unittest.skip('needs network access') + def testGeneration(self): + for api in _API_LIST: + with test_utils.TempDir(change_to=True): diff --git a/dev-python/google-apitools/google-apitools-0.5.30_p20200507.ebuild b/dev-python/google-apitools/google-apitools-0.5.30_p20200507.ebuild new file mode 100644 index 000000000000..c81be54c3e20 --- /dev/null +++ b/dev-python/google-apitools/google-apitools-0.5.30_p20200507.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7,8} ) +DISTUTILS_USE_SETUPTOOLS=rdepend +inherit distutils-r1 + +COMMIT_HASH="02db277e2bbc5906c8787f64dc9a743fe3327f90" +DESCRIPTION="Python library to manipulate Google APIs" +HOMEPAGE="https://github.com/google/apitools" +SRC_URI="https://github.com/google/apitools/archive/${COMMIT_HASH}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${PN#google-}-${COMMIT_HASH}" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=dev-python/httplib2-0.8[${PYTHON_USEDEP}] + >=dev-python/fasteners-0.14[${PYTHON_USEDEP}] + >=dev-python/oauth2client-1.5.2[${PYTHON_USEDEP}] + >=dev-python/six-1.12.0[${PYTHON_USEDEP}] + >=dev-python/python-gflags-3.1.2[${PYTHON_USEDEP}] +" +DEPEND="${RDEPEND} + >=dev-python/setuptools-18.5[${PYTHON_USEDEP}] + test? ( >=dev-python/mock-1.0.1[${PYTHON_USEDEP}] )" + +PATCHES=( + "${FILESDIR}/google-apitools-0.5.30-py37.patch" +) + +distutils_enable_tests nose -- 2.26.2