Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-thriftpy2 for
openSUSE:Factory checked in at 2021-10-26 20:14:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-thriftpy2 (Old)
and /work/SRC/openSUSE:Factory/.python-thriftpy2.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-thriftpy2"
Tue Oct 26 20:14:24 2021 rev:6 rq:927531 version:0.4.14
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-thriftpy2/python-thriftpy2.changes
2020-03-26 23:35:09.850815987 +0100
+++
/work/SRC/openSUSE:Factory/.python-thriftpy2.new.1890/python-thriftpy2.changes
2021-10-26 20:15:12.518057821 +0200
@@ -1,0 +2,14 @@
+Tue Oct 26 11:02:14 UTC 2021 - Matej Cepl <[email protected]>
+
+- Update to 0.4.14:
+ - revert support Apache JSON protocol and binary type, via
+ 2-#157.
+ - Support Apache JSON protocol and binary type, via 2-#139.
+ - Fix HTTP_URI typo in http.py, via 2-#148.
+ - Support custom headers for HTTP, via 2-#149.
+ - Support raising TApplicationException in user handlers, via
+ 2-#154.
+ - Support include files with dot in name, via 2-#125.
+- Add new SSL certificates in new_certs.tar.xz
+
+-------------------------------------------------------------------
Old:
----
v0.4.11.tar.gz
New:
----
new_certs.tar.xz
v0.4.14.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-thriftpy2.spec ++++++
--- /var/tmp/diff_new_pack.7sQX9Q/_old 2021-10-26 20:15:13.078058116 +0200
+++ /var/tmp/diff_new_pack.7sQX9Q/_new 2021-10-26 20:15:13.078058116 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-thriftpy2
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,18 +18,20 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-thriftpy2
-Version: 0.4.11
+Version: 0.4.14
Release: 0
Summary: Pure python implementation of Apache Thrift
License: MIT
Group: Development/Languages/Python
URL: https://github.com/Thriftpy/thriftpy2
-Source:
https://github.com/Thriftpy/thriftpy2/archive/v%{version}.tar.gz
+Source0:
https://github.com/Thriftpy/thriftpy2/archive/v%{version}.tar.gz
+Source1: new_certs.tar.xz
BuildRequires: %{python_module Cython >= 0.28.4}
BuildRequires: %{python_module dbm}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module ply >= 3.4}
BuildRequires: %{python_module pytest >= 2.8}
+BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module tornado >= 5.0}
BuildRequires: fdupes
@@ -45,7 +47,9 @@
pythonic way.
%prep
-%setup -q -n thriftpy2-%{version}
+%autosetup -p1 -n thriftpy2-%{version}
+
+tar xv -C tests/ssl -f %{SOURCE1}
%build
export CFLAGS="%{optflags}"
++++++ v0.4.11.tar.gz -> v0.4.14.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/.travis.yml
new/thriftpy2-0.4.14/.travis.yml
--- old/thriftpy2-0.4.11/.travis.yml 2020-03-17 04:48:19.000000000 +0100
+++ new/thriftpy2-0.4.14/.travis.yml 2021-01-21 10:41:13.000000000 +0100
@@ -15,6 +15,10 @@
script: tox -e coverage
- python: 3.7
script: tox -e py37
+ - python: 3.8
+ script: tox -e py38
+ - python: 3.9
+ script: tox -e py39
before_install:
- sudo apt-get install -y python-dev gcc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/CHANGES.rst
new/thriftpy2-0.4.14/CHANGES.rst
--- old/thriftpy2-0.4.11/CHANGES.rst 2020-03-17 04:48:19.000000000 +0100
+++ new/thriftpy2-0.4.14/CHANGES.rst 2021-01-21 10:41:13.000000000 +0100
@@ -3,6 +3,41 @@
0.4.x
~~~~~
+Version 0.4.14
+-------------
+
+Released on Jan 21, 2021.
+
+- revert support Apache JSON protocol and binary type, via `2-#157`_.
+
+.. _2-#157: https://github.com/Thriftpy/thriftpy2/pull/157
+
+Version 0.4.13
+-------------
+
+Released on Jan 19, 2021.
+
+- Support Apache JSON protocol and binary type, via `2-#139`_.
+- Fix HTTP_URI typo in http.py, via `2-#148`_.
+- Support custom headers for HTTP, via `2-#149`_.
+- Support raising TApplicationException in user handlers, via `2-#154`_.
+
+.. _2-#139: https://github.com/Thriftpy/thriftpy2/pull/139
+.. _2-#148: https://github.com/Thriftpy/thriftpy2/pull/148
+.. _2-#149: https://github.com/Thriftpy/thriftpy2/pull/149
+.. _2-#154: https://github.com/Thriftpy/thriftpy2/pull/154
+
+
+Version 0.4.12
+-------------
+
+Released on Oct 13, 2020.
+
+- Support include files with dot in name, via `2-#125`_.
+
+.. _2-#125: https://github.com/Thriftpy/thriftpy2/pull/125
+
+
Version 0.4.11
-------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/Makefile
new/thriftpy2-0.4.14/Makefile
--- old/thriftpy2-0.4.11/Makefile 2020-03-17 04:48:19.000000000 +0100
+++ new/thriftpy2-0.4.14/Makefile 2021-01-21 10:41:13.000000000 +0100
@@ -8,7 +8,7 @@
python setup.py build_ext
build: build_ext
- python setup.py sdist
+ python setup.py sdist bdist_wheel
pre_release: build
twine upload --verbose --repository-url https://test.pypi.org/legacy/
dist/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/tests/addressbook.thrift
new/thriftpy2-0.4.14/tests/addressbook.thrift
--- old/thriftpy2-0.4.11/tests/addressbook.thrift 2020-03-17
04:48:19.000000000 +0100
+++ new/thriftpy2-0.4.14/tests/addressbook.thrift 2021-01-21
10:41:13.000000000 +0100
@@ -43,4 +43,5 @@
map<PhoneType, string> get_phones(1: string name);
bool sleep(1: i32 ms);
void close(1: i32 ms);
+ void raises(1: string msg);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/thriftpy2-0.4.11/tests/parser-cases/issue_121.include.thrift
new/thriftpy2-0.4.14/tests/parser-cases/issue_121.include.thrift
--- old/thriftpy2-0.4.11/tests/parser-cases/issue_121.include.thrift
1970-01-01 01:00:00.000000000 +0100
+++ new/thriftpy2-0.4.14/tests/parser-cases/issue_121.include.thrift
2021-01-21 10:41:13.000000000 +0100
@@ -0,0 +1,3 @@
+struct A {
+ 1: string value
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/tests/parser-cases/issue_121.thrift
new/thriftpy2-0.4.14/tests/parser-cases/issue_121.thrift
--- old/thriftpy2-0.4.11/tests/parser-cases/issue_121.thrift 1970-01-01
01:00:00.000000000 +0100
+++ new/thriftpy2-0.4.14/tests/parser-cases/issue_121.thrift 2021-01-21
10:41:13.000000000 +0100
@@ -0,0 +1,5 @@
+include "./issue_121.include.thrift"
+
+struct B {
+ 1: issue_121.include.A a
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/tests/test_http.py
new/thriftpy2-0.4.14/tests/test_http.py
--- old/thriftpy2-0.4.11/tests/test_http.py 2020-03-17 04:48:19.000000000
+0100
+++ new/thriftpy2-0.4.14/tests/test_http.py 2021-01-21 10:41:13.000000000
+0100
@@ -6,15 +6,16 @@
import multiprocessing
import socket
import time
+import uuid
import pytest
import thriftpy2
-thriftpy2.install_import_hook() # noqa
-from thriftpy2.http import make_server, make_client, client_context # noqa
-from thriftpy2.thrift import TApplicationException
+thriftpy2.install_import_hook() # noqa
+from thriftpy2.http import make_server, make_client, client_context,
THttpHeaderFactory # noqa
+from thriftpy2.thrift import TApplicationException # noqa
addressbook = thriftpy2.load(os.path.join(os.path.dirname(__file__),
"addressbook.thrift"))
@@ -66,6 +67,11 @@
return True
+class CustomHeaderFactory(THttpHeaderFactory):
+ def get_headers(self):
+ return {"X-REQUEST-ID": str(uuid.uuid4())}
+
+
@pytest.fixture(scope="module")
def server(request):
server = make_server(addressbook.AddressBookService, Dispatcher(),
@@ -116,6 +122,40 @@
url="http://127.0.0.1:6080", timeout=timeout)
+def client_without_url(timeout=3000):
+ return make_client(addressbook.AddressBookService, host="127.0.0.1",
+ port=6080, path="foo", timeout=timeout)
+
+
+def client_context_with_header_factory(timeout=3000):
+ return client_context(addressbook.AddressBookService,
+ url="http://127.0.0.1:6080",
+ timeout=timeout,
+ http_header_factory=THttpHeaderFactory())
+
+
+def client_context_with_custom_header_factory(timeout=3000):
+ return client_context(addressbook.AddressBookService,
+ url="http://127.0.0.1:6080",
+ timeout=timeout,
+ http_header_factory=CustomHeaderFactory())
+
+
+def client_with_header_factory(timeout=3000):
+ return make_client(addressbook.AddressBookService,
+ url="http://127.0.0.1:6080",
+ timeout=timeout,
+ http_header_factory=THttpHeaderFactory(
+ {"X-REQUEST-ID": str(uuid.uuid4())}))
+
+
+def client_with_custom_header_factory(timeout=3000):
+ return make_client(addressbook.AddressBookService,
+ url="http://127.0.0.1:6080",
+ timeout=timeout,
+ http_header_factory=CustomHeaderFactory())
+
+
def test_client_context(server):
with client() as c1, client_context_with_url() as c2:
assert c1.hello("world") == c2.hello("world")
@@ -128,6 +168,33 @@
c2.close()
+def test_clients_without_url(server):
+ c = client_without_url()
+ assert c.hello("world") == "hello world"
+
+
+def test_client_context_with_header_factory(server):
+ with client_context_with_header_factory() as c:
+ assert c.hello("world") == "hello world"
+
+
+def test_client_context_custom_with_header_factory(server):
+ with client_context_with_custom_header_factory() as c:
+ assert c.hello("world") == "hello world"
+
+
+def test_client_with_header_factory(server):
+ c = client_with_header_factory()
+ assert c.hello("world") == "hello world"
+ c.close()
+
+
+def test_client_with_custom_header_factory(server):
+ c = client_with_custom_header_factory()
+ assert c.hello("world") == "hello world"
+ c.close()
+
+
def test_void_api(server):
with client() as c:
assert c.ping() is None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/tests/test_parser.py
new/thriftpy2-0.4.14/tests/test_parser.py
--- old/thriftpy2-0.4.11/tests/test_parser.py 2020-03-17 04:48:19.000000000
+0100
+++ new/thriftpy2-0.4.14/tests/test_parser.py 2021-01-21 10:41:13.000000000
+0100
@@ -298,3 +298,7 @@
2: (15, 'field2', (15, (12, thrift.A)), False),
3: (15, 'field3', (15, (15, (12, thrift.A))), False)
}
+
+
+def test_issue_121():
+ load('parser-cases/issue_121.thrift')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/tests/test_rpc.py
new/thriftpy2-0.4.14/tests/test_rpc.py
--- old/thriftpy2-0.4.11/tests/test_rpc.py 2020-03-17 04:48:19.000000000
+0100
+++ new/thriftpy2-0.4.14/tests/test_rpc.py 2021-01-21 10:41:13.000000000
+0100
@@ -74,6 +74,9 @@
def close(self, ms):
return
+ def raises(self, msg):
+ raise TApplicationException(message=msg)
+
@pytest.fixture(scope="module")
def server(request):
@@ -273,3 +276,14 @@
def test_close_method():
with client() as c:
c.tclose(1)
+
+
+def test_raises_method():
+ with client() as c:
+ try:
+ c.raises("foobarbaz")
+ except TApplicationException as e:
+ assert e.type == 0
+ assert e.message == "foobarbaz"
+ else:
+ raise ValueError("TApplicationException not raised")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/thriftpy2/__init__.py
new/thriftpy2-0.4.14/thriftpy2/__init__.py
--- old/thriftpy2-0.4.11/thriftpy2/__init__.py 2020-03-17 04:48:19.000000000
+0100
+++ new/thriftpy2-0.4.14/thriftpy2/__init__.py 2021-01-21 10:41:13.000000000
+0100
@@ -5,7 +5,7 @@
from .hook import install_import_hook, remove_import_hook
from .parser import load, load_module, load_fp
-__version__ = '0.4.11'
+__version__ = '0.4.14'
__python__ = sys.version_info
__all__ = ["install_import_hook", "remove_import_hook", "load", "load_module",
"load_fp"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/thriftpy2/http.py
new/thriftpy2-0.4.14/thriftpy2/http.py
--- old/thriftpy2-0.4.11/thriftpy2/http.py 2020-03-17 04:48:19.000000000
+0100
+++ new/thriftpy2-0.4.14/thriftpy2/http.py 2021-01-21 10:41:13.000000000
+0100
@@ -60,7 +60,7 @@
from thriftpy2.transport import TBufferedTransportFactory
-HTTP_URI = '{scheme}://{host}:{port}{path}'
+HTTP_URI = '{scheme}://{host}:{port}/{path}'
DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000 # 30 seconds
@@ -99,6 +99,22 @@
self.handler = handler
+class THttpHeaderFactory(object):
+ """Default header factory return no custom headers
+ """
+ def __init__(self, headers=None):
+ """Initialize a header factory
+ @param headers(dict) a dictionary of static headers the factory
generates
+ """
+ if headers:
+ self.__headers = headers
+ else:
+ self.__headers = dict()
+
+ def get_headers(self):
+ return self.__headers
+
+
class THttpServer(TServer):
"""A simple HTTP-based Thrift server
This class is not very performant, but it is useful (for example) for
@@ -159,7 +175,7 @@
"""Http implementation of TTransport base.
"""
- def __init__(self, uri, timeout=None, ssl_context_factory=None):
+ def __init__(self, uri, timeout=None, ssl_context_factory=None,
http_header_factory=None):
"""Initialize a HTTP Socket.
@param uri(str) The http_scheme:://host:port/path to connect to.
@@ -178,7 +194,7 @@
self.path += '?%s' % parsed.query
self.__wbuf = BytesIO()
self.__http = None
- self.__custom_headers = None
+ self._http_header_factory = http_header_factory or THttpHeaderFactory()
self.__timeout = None
if timeout:
self.setTimeout(timeout)
@@ -207,7 +223,7 @@
self.__timeout = ms / 1000.0 if (ms and ms > 0) else None
def setCustomHeaders(self, headers):
- self.__custom_headers = headers
+ self._http_header_factory = THttpHeaderFactory(headers)
def read(self, sz):
content = self.response.read(sz)
@@ -235,9 +251,9 @@
self.__http.putheader('Host', self.host)
self.__http.putheader('Content-Type', 'application/x-thrift')
self.__http.putheader('Content-Length', str(len(data)))
-
- if (not self.__custom_headers or
- 'User-Agent' not in self.__custom_headers):
+ custom_headers = self._http_header_factory.get_headers()
+ if (not custom_headers or
+ 'User-Agent' not in custom_headers):
user_agent = 'Python/THttpClient'
script = os.path.basename(sys.argv[0])
if script:
@@ -245,8 +261,8 @@
user_agent, urllib.parse.quote(script))
self.__http.putheader('User-Agent', user_agent)
- if self.__custom_headers:
- for key, val in self.__custom_headers.items():
+ if custom_headers:
+ for key, val in self._http_header_factory.get_headers().items():
self.__http.putheader(key, val)
self.__http.endheaders()
@@ -282,6 +298,7 @@
proto_factory=TBinaryProtocolFactory(),
trans_factory=TBufferedTransportFactory(),
ssl_context_factory=None,
+ http_header_factory=None,
timeout=DEFAULT_HTTP_CLIENT_TIMEOUT_MS, url=''):
if url:
parsed_url = urllib.parse.urlparse(url)
@@ -290,7 +307,7 @@
scheme = parsed_url.scheme or scheme
path = parsed_url.path or path
uri = HTTP_URI.format(scheme=scheme, host=host, port=port, path=path)
- http_socket = THttpClient(uri, timeout, ssl_context_factory)
+ http_socket = THttpClient(uri, timeout, ssl_context_factory,
http_header_factory)
transport = trans_factory.get_transport(http_socket)
iprot = proto_factory.get_protocol(transport)
transport.open()
@@ -302,6 +319,7 @@
proto_factory=TBinaryProtocolFactory(),
trans_factory=TBufferedTransportFactory(),
ssl_context_factory=None,
+ http_header_factory=None,
timeout=DEFAULT_HTTP_CLIENT_TIMEOUT_MS, url=''):
if url:
parsed_url = urllib.parse.urlparse(url)
@@ -310,7 +328,7 @@
scheme = parsed_url.scheme or scheme
path = parsed_url.path or path
uri = HTTP_URI.format(scheme=scheme, host=host, port=port, path=path)
- http_socket = THttpClient(uri, timeout, ssl_context_factory)
+ http_socket = THttpClient(uri, timeout, ssl_context_factory,
http_header_factory)
transport = trans_factory.get_transport(http_socket)
try:
iprot = proto_factory.get_protocol(transport)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/thriftpy2/parser/parser.py
new/thriftpy2-0.4.14/thriftpy2/parser/parser.py
--- old/thriftpy2-0.4.11/thriftpy2/parser/parser.py 2020-03-17
04:48:19.000000000 +0100
+++ new/thriftpy2-0.4.14/thriftpy2/parser/parser.py 2021-01-21
10:41:13.000000000 +0100
@@ -391,14 +391,26 @@
'''ref_type : IDENTIFIER'''
ref_type = thrift_stack[-1]
- for index, name in enumerate(p[1].split('.')):
- ref_type = getattr(ref_type, name, None)
- if ref_type is None:
- if index != len(p[1].split('.')) - 1:
- raise ThriftParserError('No type found: %r, at line %d' %
- (p[1], p.lineno(1)))
- p[0] = incomplete_type.set_info((p[1], p.lineno(1)))
- return
+ for attr in dir(ref_type):
+ if attr in {'__doc__', '__loader__', '__name__', '__package__',
+ '__spec__', '__thrift_file__', '__thrift_meta__'}:
+ continue
+ if p[1].startswith(attr + '.'):
+ name = p[1][len(attr)+1:]
+ included_ref_type = getattr(ref_type, attr)
+ resolved_ref_type = getattr(included_ref_type, name, None)
+ if resolved_ref_type is not None:
+ ref_type = resolved_ref_type
+ break
+ else:
+ for index, name in enumerate(p[1].split('.')):
+ ref_type = getattr(ref_type, name, None)
+ if ref_type is None:
+ if index != len(p[1].split('.')) - 1:
+ raise ThriftParserError('No type found: %r, at line %d' %
+ (p[1], p.lineno(1)))
+ p[0] = incomplete_type.set_info((p[1], p.lineno(1)))
+ return
if hasattr(ref_type, '_ttype'):
p[0] = getattr(ref_type, '_ttype'), ref_type
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/thriftpy2/thrift.py
new/thriftpy2-0.4.14/thriftpy2/thrift.py
--- old/thriftpy2-0.4.11/thriftpy2/thrift.py 2020-03-17 04:48:19.000000000
+0100
+++ new/thriftpy2-0.4.14/thriftpy2/thrift.py 2021-01-21 10:41:13.000000000
+0100
@@ -319,6 +319,8 @@
try:
result.success = call()
+ except TApplicationException as e:
+ return self.send_exception(oprot, api, e, seqid)
except Exception as e:
# raise if api don't have throws
if not self.handle_exception(e, result):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/thriftpy2-0.4.11/tox.ini new/thriftpy2-0.4.14/tox.ini
--- old/thriftpy2-0.4.11/tox.ini 2020-03-17 04:48:19.000000000 +0100
+++ new/thriftpy2-0.4.14/tox.ini 2021-01-21 10:41:13.000000000 +0100
@@ -1,5 +1,5 @@
[tox]
-envlist = flake8, py27, py34, py35, py36, py37, pypy, coverage
+envlist = flake8, py27, py34, py35, py36, py37, py38, py39 pypy, coverage
[testenv]
passenv = *
@@ -15,7 +15,7 @@
pytest-cov
tornado>=4.0,<6.0
cython
- py35,py36,py37,coverage: pytest_asyncio
+ py35,py36,py37,py38,py39,coverage: pytest_asyncio
[testenv:flake8]
deps = flake8