forked from pool/python-thriftpy2
osc copypac from project:openSUSE:Factory package:python-thriftpy revision:2
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-thriftpy2?expand=0&rev=1
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) <2014> <Eleme Inc.>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
9
python-thriftpy.changes
Normal file
9
python-thriftpy.changes
Normal file
@@ -0,0 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 17 14:12:57 UTC 2018 - mimi.vx@gmail.com
|
||||
|
||||
- add tornado_5.patch to build with tornado-5.x
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 22 19:14:34 UTC 2017 - toddrme2178@gmail.com
|
||||
|
||||
- Initial version
|
||||
67
python-thriftpy.spec
Normal file
67
python-thriftpy.spec
Normal file
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# spec file for package python-thriftpy
|
||||
#
|
||||
# Copyright (c) 2018 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/
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%bcond_without test
|
||||
Name: python-thriftpy
|
||||
Version: 0.3.9
|
||||
Release: 0
|
||||
Summary: Pure python implementation of Apache Thrift
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://thriftpy.readthedocs.org/
|
||||
Source: https://files.pythonhosted.org/packages/source/t/thriftpy/thriftpy-%{version}.tar.gz
|
||||
Source1: LICENSE
|
||||
Patch0: tornado_5.patch
|
||||
BuildRequires: %{python_module Cython}
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module ply >= 3.4}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-ply >= 3.4
|
||||
Recommends: python-tornado >= 4.0
|
||||
%if %{with test}
|
||||
BuildRequires: %{python_module pytest >= 2.8}
|
||||
BuildRequires: %{python_module tornado >= 4.0}
|
||||
%endif
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
ThriftPy is a pure python implementation of Apache Thrift in a
|
||||
pythonic way.
|
||||
|
||||
%prep
|
||||
%setup -q -n thriftpy-%{version}
|
||||
cp %{SOURCE1} .
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
export CFLAGS="%{optflags}"
|
||||
%python_build
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc CHANGES.rst README.rst
|
||||
%{python_sitearch}/*
|
||||
|
||||
%changelog
|
||||
3
thriftpy-0.3.9.tar.gz
Normal file
3
thriftpy-0.3.9.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:309e57d97b5bfa01601393ad4f245451e989d6206a59279e56866b264a99796d
|
||||
size 208164
|
||||
105
tornado_5.patch
Normal file
105
tornado_5.patch
Normal file
@@ -0,0 +1,105 @@
|
||||
Index: thriftpy-0.3.9/setup.py
|
||||
===================================================================
|
||||
--- thriftpy-0.3.9.orig/setup.py
|
||||
+++ thriftpy-0.3.9/setup.py
|
||||
@@ -18,7 +18,7 @@ install_requires = [
|
||||
]
|
||||
|
||||
tornado_requires = [
|
||||
- "tornado>=4.0,<5.0",
|
||||
+ "tornado>=4.0,<6.0",
|
||||
"toro==0.6"
|
||||
]
|
||||
|
||||
Index: thriftpy-0.3.9/thriftpy/tornado.py
|
||||
===================================================================
|
||||
--- thriftpy-0.3.9.orig/thriftpy/tornado.py
|
||||
+++ thriftpy-0.3.9/thriftpy/tornado.py
|
||||
@@ -18,7 +18,8 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from contextlib import contextmanager
|
||||
-from tornado import tcpserver, ioloop, iostream, gen
|
||||
+from tornado import tcpserver, iostream, gen
|
||||
+from tornado import version as tornado_version
|
||||
from io import BytesIO
|
||||
from datetime import timedelta
|
||||
|
||||
@@ -32,7 +33,11 @@ from .protocol.binary import TBinaryProt
|
||||
import logging
|
||||
import socket
|
||||
import struct
|
||||
-import toro
|
||||
+
|
||||
+try:
|
||||
+ from tornado.locks import Lock
|
||||
+except ImportError:
|
||||
+ from toro import Lock
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -47,12 +52,12 @@ class TTornadoStreamTransport(TTransport
|
||||
read_timeout=DEFAULT_READ_TIMEOUT):
|
||||
self.host = host
|
||||
self.port = port
|
||||
- self.io_loop = io_loop or ioloop.IOLoop.current()
|
||||
+ self.io_loop = io_loop
|
||||
self.read_timeout = read_timeout
|
||||
self.is_queuing_reads = False
|
||||
self.read_queue = []
|
||||
self.__wbuf = BytesIO()
|
||||
- self._read_lock = toro.Lock()
|
||||
+ self._read_lock = Lock()
|
||||
self.ssl_options = ssl_options
|
||||
|
||||
# servers provide a ready-to-go stream
|
||||
@@ -60,8 +65,12 @@ class TTornadoStreamTransport(TTransport
|
||||
if self.stream is not None:
|
||||
self._set_close_callback()
|
||||
|
||||
- def with_timeout(self, timeout, future):
|
||||
- return gen.with_timeout(timeout, future, self.io_loop)
|
||||
+ if tornado_version >= '5.0':
|
||||
+ def with_timeout(self, timeout, future):
|
||||
+ return gen.with_timeout(timeout, future)
|
||||
+ else:
|
||||
+ def with_timeout(self, timeout, future):
|
||||
+ return gen.with_timeout(timeout, future, self.io_loop)
|
||||
|
||||
@gen.coroutine
|
||||
def open(self, timeout=DEFAULT_CONNECT_TIMEOUT):
|
||||
@@ -157,12 +166,15 @@ class TTornadoServer(tcpserver.TCPServer
|
||||
else iprot_factory)
|
||||
self.transport_read_timeout = transport_read_timeout
|
||||
|
||||
+ # `io_loop` has been deprecated since tornado 4.1 and removed in 5.0
|
||||
+ self.__io_loop = getattr(self, 'io_loop', None)
|
||||
+
|
||||
@gen.coroutine
|
||||
def handle_stream(self, stream, address):
|
||||
host, port = address
|
||||
trans = TTornadoStreamTransport(
|
||||
host=host, port=port, stream=stream,
|
||||
- io_loop=self.io_loop, read_timeout=self.transport_read_timeout)
|
||||
+ io_loop=self.__io_loop, read_timeout=self.transport_read_timeout)
|
||||
try:
|
||||
oprot = self._oprot_factory.get_protocol(trans)
|
||||
iprot = self._iprot_factory.get_protocol(TMemoryBuffer())
|
||||
@@ -213,9 +225,14 @@ def make_server(
|
||||
io_loop=None, ssl_options=None,
|
||||
transport_read_timeout=TTornadoStreamTransport.DEFAULT_READ_TIMEOUT):
|
||||
processor = TProcessor(service, handler)
|
||||
- server = TTornadoServer(processor, iprot_factory=proto_factory,
|
||||
- transport_read_timeout=transport_read_timeout,
|
||||
- io_loop=io_loop, ssl_options=ssl_options)
|
||||
+ if tornado_version >= '5.0':
|
||||
+ server = TTornadoServer(processor, iprot_factory=proto_factory,
|
||||
+ transport_read_timeout=transport_read_timeout,
|
||||
+ ssl_options=ssl_options)
|
||||
+ else:
|
||||
+ server = TTornadoServer(processor, iprot_factory=proto_factory,
|
||||
+ transport_read_timeout=transport_read_timeout,
|
||||
+ io_loop=io_loop, ssl_options=ssl_options)
|
||||
return server
|
||||
|
||||
|
||||
Reference in New Issue
Block a user