blink-python3 #47

Merged
tombriden merged 8 commits from tombriden/hasufell-repository:blink-python3 into master 2021-03-23 11:43:09 +00:00
2 changed files with 77 additions and 3 deletions
Showing only changes of commit ef01d455f5 - Show all commits

View File

@ -0,0 +1,70 @@
Upstream: Yes
Source: https://github.com/AGProjects/python3-xcaplib/commit/066759cf355b152375767bee4c3858dc0b8087e4
From 066759cf355b152375767bee4c3858dc0b8087e4 Mon Sep 17 00:00:00 2001
From: Worawut Boonpeang <worawut@ag-projects.com>
Date: Fri, 4 Dec 2020 13:49:54 +0000
Subject: [PATCH] xcaplib (Python3) work with eventlib
---
xcaplib/green.py | 4 +++-
xcaplib/xcapclient.py | 10 ++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/xcaplib/green.py b/xcaplib/green.py
index 237d9d8..d01ee11 100644
--- a/xcaplib/green.py
+++ b/xcaplib/green.py
@@ -2,6 +2,8 @@
from eventlib.green import socket, ssl, httplib, urllib2
from xcaplib import httpclient
from xcaplib import client
+import urllib
+import http
class HTTPConnection(httplib.HTTPConnection):
@@ -22,7 +24,7 @@ def http_open(self, req):
class HTTPSHandler(urllib.request.HTTPSHandler):
def https_open(self, req):
- return self.do_open(HTTPSConnection, req)
+ return self.do_open(http.client.HTTPSConnection, req)
class HTTPClient(httpclient.HTTPClient):
diff --git a/xcaplib/xcapclient.py b/xcaplib/xcapclient.py
index cd409df..384c237 100755
--- a/xcaplib/xcapclient.py
+++ b/xcaplib/xcapclient.py
@@ -129,6 +129,8 @@ def setup_parser_request(parser):
parser.add_option('--etag', help="perform a conditional operation", metavar='ETAG')
parser.add_option('--add-header', dest='headers',
action='append', default=[], help=optparse.SUPPRESS_HELP)
+ parser.add_option("--eventlib", dest='eventlib_enable',
+ help="Enables non-blocking mode using eventlib library")
parser.add_option("-i", dest='input_filename',
help="source file for the PUT request; default is <stdin>")
parser.add_option("-o", dest='output_filename',
@@ -366,7 +368,11 @@ def update_options_from_config(options):
setattr(options, key, value)
def parse_args():
- argv = sys.argv[1:]
+ argv = None
+ if "--eventlib" in sys.argv[1:]:
+ argv = sys.argv[2:]
+ else:
+ argv = sys.argv[1:]
if not argv:
sys.exit('Type %s -h for help.' % sys.argv[0])
@@ -496,7 +502,7 @@ def get_exit_code(http_error):
return 3
def main():
- if sys.argv[0].endswith('-eventlib'):
+ if "--eventlib" in sys.argv[1:]:
from xcaplib.green import XCAPClient as client_class
else:
client_class = XCAPClient

View File

@ -1,11 +1,11 @@
# Copyright 2016 Julian Ospald <hasufell@posteo.de> # Copyright 2016 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
require setup-py [ import=distutils blacklist="3" ] require setup-py [ import=distutils blacklist="2" multibuild=false ]
require github [ user="AGProjects" pn="python3-xcaplib" tag="${PV}" ]
SUMMARY="Python library for managing XML documents on XCAP server" SUMMARY="Python library for managing XML documents on XCAP server"
HOMEPAGE="http://sipsimpleclient.org" HOMEPAGE="http://sipsimpleclient.org"
DOWNLOADS="http://download.ag-projects.com/XCAP/${PNV}.tar.gz"
LICENCES="GPL-2" LICENCES="GPL-2"
SLOT="0" SLOT="0"
@ -15,6 +15,10 @@ MYOPTIONS=""
DEPENDENCIES=" DEPENDENCIES="
run: run:
dev-python/lxml[python_abis:*(-)?] dev-python/lxml[python_abis:*(-)?]
dev-python/python-application[python_abis:*(-)?] dev-python/python-application[>=3.0.3][python_abis:*(-)?]
" "
DEFAULT_SRC_PREPARE_PATCHES=(
"${FILES}"/${PN}-work-with-eventlib.patch
)