[packages/python-Paste] - added more python3 fixes (how was it built from python3.10?); requires six 1.13 for six.moves.coll
qboosh
qboosh at pld-linux.org
Sat Oct 28 10:17:38 CEST 2023
commit 0850d5882bcda6a957348a4451c6da5895e450ac
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Oct 28 10:19:41 2023 +0200
- added more python3 fixes (how was it built from python3.10?); requires six 1.13 for six.moves.collections_abc
- use python2 based Sphinx here (python3 module will be built from python3-Paste.spec in the future)
- release 7
python-Paste-py3.7.patch | 310 +++++++++++++++++++++++++++++++++++++++++++++++
python-Paste.spec | 15 +--
2 files changed, 316 insertions(+), 9 deletions(-)
---
diff --git a/python-Paste.spec b/python-Paste.spec
index 1a753f4..bceb65e 100644
--- a/python-Paste.spec
+++ b/python-Paste.spec
@@ -8,23 +8,22 @@
Summary: Tools for using a Web Server Gateway Interface stack
Summary(pl.UTF-8): Narzędzia do używania stosu Web Server Gateway Interface
Name: python-Paste
+# keep 2.x here for python2 support
Version: 2.0.3
-Release: 6
+Release: 7
Group: Libraries/Python
License: MIT
#Source0Download: https://pypi.org/simple/paste/
Source0: https://files.pythonhosted.org/packages/source/P/Paste/Paste-%{version}.tar.gz
# Source0-md5: 1231e14eae62fa7ed76e9130b04bc61e
Patch0: %{name}-py3.7.patch
-# dead
-#URL: http://pythonpaste.org/
URL: https://pypi.org/project/Paste/
%if %{with python2}
BuildRequires: python-devel >= 1:2.6
BuildRequires: python-setuptools >= 0.6-0.a9.1
%if %{with tests}
BuildRequires: python-nose >= 0.11
-BuildRequires: python-six >= 1.4.0
+BuildRequires: python-six >= 1.13.0
%endif
%endif
%if %{with python3}
@@ -32,11 +31,11 @@ BuildRequires: python3-devel >= 1:3.4
BuildRequires: python3-setuptools >= 0.6-0.a9.1
%if %{with tests}
BuildRequires: python3-nose >= 0.11
-BuildRequires: python3-six >= 1.4.0
+BuildRequires: python3-six >= 1.13.0
%endif
%endif
%if %{with doc}
-BuildRequires: sphinx-pdg
+BuildRequires: sphinx-pdg-2
%endif
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.714
@@ -104,9 +103,7 @@ Dokumentacja API modułu Pythona Paste.
%endif
%if %{with doc}
-# no Makefile docs
-cd docs
-sphinx-build -b html . _build/html
+sphinx-build-2 -b html docs docs/_build/html
%endif
%install
diff --git a/python-Paste-py3.7.patch b/python-Paste-py3.7.patch
index ecc04af..9e668aa 100644
--- a/python-Paste-py3.7.patch
+++ b/python-Paste-py3.7.patch
@@ -15,3 +15,313 @@
def _auth_to_kv_pairs(auth_string):
""" split a digest auth string into key, value pairs """
+--- Paste-2.0.3/paste/util/template.py.orig 2016-03-08 02:03:34.000000000 +0100
++++ Paste-2.0.3/paste/util/template.py 2023-10-27 22:22:01.397599869 +0200
+@@ -33,9 +33,13 @@ If there are syntax errors ``TemplateErr
+ import re
+ import six
+ import sys
+-import cgi
+ from six.moves.urllib.parse import quote
+ from paste.util.looper import looper
++try:
++ from cgi import escape
++except ImportError:
++ from html import escape
++
+
+ __all__ = ['TemplateError', 'Template', 'sub', 'HTMLTemplate',
+ 'sub_html', 'html', 'bunch']
+@@ -326,7 +329,7 @@ def html_quote(value):
+ value = unicode(value)
+ else:
+ value = str(value)
+- value = cgi.escape(value, 1)
++ value = escape(value, 1)
+ if six.PY2 and isinstance(value, unicode):
+ value = value.encode('ascii', 'xmlcharrefreplace')
+ return value
+--- Paste-2.0.3/paste/request.py.orig 2016-03-08 02:03:34.000000000 +0100
++++ Paste-2.0.3/paste/request.py 2023-10-28 08:14:20.878399308 +0200
+@@ -18,6 +18,7 @@ environment to solve common requirements
+
+ """
+ import cgi
++import six
+ from six.moves.urllib import parse as urlparse
+ from six.moves.urllib.parse import quote, parse_qsl
+ try:
+@@ -30,8 +31,7 @@ except ImportError:
+ try:
+ from UserDict import DictMixin
+ except ImportError:
+- from collections import MutableMapping as DictMixin
+-import six
++ from six.moves.collections_abc import MutableMapping as DictMixin
+
+ from paste.util.multidict import MultiDict
+
+--- Paste-2.0.3/paste/exceptions/formatter.py.orig 2016-03-08 02:03:34.000000000 +0100
++++ Paste-2.0.3/paste/exceptions/formatter.py 2023-10-28 08:16:57.180885879 +0200
+@@ -7,13 +7,16 @@ Formatters for the exception data that c
+ # @@: TODO:
+ # Use this: http://www.zope.org/Members/tino/VisualTraceback/VisualTracebackNews
+
+-import cgi
+ import six
+ import re
++try:
++ from cgi import escape
++except ImportError:
++ from html import escape
+ from paste.util import PySourceColor
+
+ def html_quote(s):
+- return cgi.escape(str(s), True)
++ return escape(str(s), True)
+
+ class AbstractFormatter(object):
+
+@@ -463,7 +466,7 @@ def format_html(exc_data, include_hidden
+ <div id="text_version" class="hidden-data">
+ <textarea style="width: 100%%" rows=10 cols=60>%s</textarea>
+ </div>
+- """ % (short_er, long_er, cgi.escape(text_er))
++ """ % (short_er, long_er, escape(text_er))
+
+ def format_text(exc_data, **ops):
+ return TextFormatter(**ops).format_collected_data(exc_data)
+--- Paste-2.0.3/paste/util/quoting.py.orig 2015-04-28 01:16:19.000000000 +0200
++++ Paste-2.0.3/paste/util/quoting.py 2023-10-28 08:18:52.143596405 +0200
+@@ -1,9 +1,12 @@
+ # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
+ # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
+
+-import cgi
+ import six
+ import re
++try:
++ from cgi import escape
++except ImportError:
++ from html import escape
+ from six.moves import html_entities
+ from six.moves.urllib.parse import quote, unquote
+
+@@ -22,17 +25,17 @@ def html_quote(v, encoding=None):
+ if v is None:
+ return ''
+ elif isinstance(v, six.binary_type):
+- return cgi.escape(v, 1)
++ return escape(v, 1)
+ elif isinstance(v, six.text_type):
+ if six.PY3:
+- return cgi.escape(v, 1)
++ return escape(v, 1)
+ else:
+- return cgi.escape(v.encode(encoding), 1)
++ return escape(v.encode(encoding), 1)
+ else:
+ if six.PY3:
+- return cgi.escape(six.text_type(v), 1)
++ return escape(six.text_type(v), 1)
+ else:
+- return cgi.escape(six.text_type(v).encode(encoding), 1)
++ return escape(six.text_type(v).encode(encoding), 1)
+
+ _unquote_re = re.compile(r'&([a-zA-Z]+);')
+ def _entity_subber(match, name2c=html_entities.name2codepoint):
+--- Paste-2.0.3/paste/util/multidict.py.orig 2015-04-23 22:48:37.000000000 +0200
++++ Paste-2.0.3/paste/util/multidict.py 2023-10-28 08:23:33.885403412 +0200
+@@ -7,7 +7,7 @@ import sys
+
+ try:
+ # Python 3
+- from collections import MutableMapping as DictMixin
++ from six.moves.collections_abc import MutableMapping as DictMixin
+ except ImportError:
+ # Python 2
+ from UserDict import DictMixin
+--- Paste-2.0.3/paste/url.py.orig 2015-05-11 16:42:49.000000000 +0200
++++ Paste-2.0.3/paste/url.py 2023-10-28 08:50:48.319882254 +0200
+@@ -5,9 +5,12 @@
+ This module implements a class for handling URLs.
+ """
+ from six.moves.urllib.parse import parse_qsl, quote, unquote, urlencode
+-import cgi
+ from paste import request
+ import six
++try:
++ from cgi import escape
++except ImportError:
++ from html import escape
+
+ # Imported lazily from FormEncode:
+ variabledecode = None
+@@ -17,7 +20,7 @@ __all__ = ["URL", "Image"]
+ def html_quote(v):
+ if v is None:
+ return ''
+- return cgi.escape(str(v), 1)
++ return escape(str(v), 1)
+
+ def url_quote(v):
+ if v is None:
+--- Paste-2.0.3/paste/auth/cookie.py.orig 2015-04-23 22:48:37.000000000 +0200
++++ Paste-2.0.3/paste/auth/cookie.py 2023-10-28 09:21:39.966517690 +0200
+@@ -41,13 +41,17 @@ corresponding to a database session id)
+
+ """
+
+-import hmac, base64, random, six, time, warnings
++import hmac, random, six, time, warnings
+ try:
+ from hashlib import sha1
+ except ImportError:
+ # NOTE: We have to use the callable with hashlib (hashlib.sha1),
+ # otherwise hmac only accepts the sha module object itself
+ import sha as sha1
++try:
++ from base64 import decodestring, encodestring
++except ImportError:
++ from base64 import decodebytes as decodestring, encodebytes as encodestring
+ from paste.request import get_cookies
+
+ def make_time(value):
+@@ -144,7 +148,7 @@ class AuthCookieSigner(object):
+ if six.PY3:
+ content = content.encode('utf8')
+ timestamp = timestamp.encode('utf8')
+- cookie = base64.encodestring(
++ cookie = encodestring(
+ hmac.new(self.secret, content, sha1).digest() +
+ timestamp +
+ content)
+@@ -159,7 +163,7 @@ class AuthCookieSigner(object):
+ Authenticate the cooke using the signature, verify that it
+ has not expired; and return the cookie's content
+ """
+- decode = base64.decodestring(
++ decode = decodestring(
+ cookie.replace("_", "/").replace("~", "="))
+ signature = decode[:_signature_size]
+ expires = decode[_signature_size:_header_size]
+--- Paste-2.0.3/paste/evalexception/middleware.py.orig 2015-04-23 22:48:37.000000000 +0200
++++ Paste-2.0.3/paste/evalexception/middleware.py 2023-10-28 09:22:12.119676834 +0200
+@@ -29,7 +29,6 @@ from __future__ import print_function
+
+ import sys
+ import os
+-import cgi
+ import traceback
+ import six
+ from six.moves import cStringIO as StringIO
+@@ -45,6 +44,10 @@ from paste import registry
+ from paste import request
+ from paste import response
+ from paste.evalexception import evalcontext
++try:
++ from cgi import escape
++except ImportError:
++ from html import escape
+
+ limit = 200
+
+@@ -54,7 +57,7 @@ def html_quote(v):
+ """
+ if v is None:
+ return ''
+- return cgi.escape(str(v), 1)
++ return escape(str(v), 1)
+
+ def preserve_whitespace(v, quote=True):
+ """
+@@ -527,7 +530,7 @@ def format_eval_html(exc_data, base_path
+ <div id="text_version" class="hidden-data">
+ <textarea style="width: 100%%" rows=10 cols=60>%s</textarea>
+ </div>
+- """ % (short_er, full_traceback_html, cgi.escape(text_er))
++ """ % (short_er, full_traceback_html, escape(text_er))
+
+ def make_repost_button(environ):
+ url = request.construct_url(environ)
+--- Paste-2.0.3/paste/urlmap.py.orig 2023-10-28 09:23:23.535956606 +0200
++++ Paste-2.0.3/paste/urlmap.py 2023-10-28 09:26:49.788172575 +0200
+@@ -6,10 +6,13 @@ Map URL prefixes to WSGI applications.
+
+ import re
+ import os
+-import cgi
++try:
++ from cgi import escape
++except ImportError:
++ from html import escape
+ try:
+ # Python 3
+- from collections import MutableMapping as DictMixin
++ from six.moves.collections_abc import MutableMapping as DictMixin
+ except ImportError:
+ # Python 2
+ from UserDict import DictMixin
+@@ -114,12 +117,12 @@ class URLMap(DictMixin):
+ ',\n '.join(map(repr, matches)))
+ else:
+ extra = ''
+- extra += '\nSCRIPT_NAME: %r' % cgi.escape(environ.get('SCRIPT_NAME'))
+- extra += '\nPATH_INFO: %r' % cgi.escape(environ.get('PATH_INFO'))
+- extra += '\nHTTP_HOST: %r' % cgi.escape(environ.get('HTTP_HOST'))
++ extra += '\nSCRIPT_NAME: %r' % escape(environ.get('SCRIPT_NAME'))
++ extra += '\nPATH_INFO: %r' % escape(environ.get('PATH_INFO'))
++ extra += '\nHTTP_HOST: %r' % escape(environ.get('HTTP_HOST'))
+ app = httpexceptions.HTTPNotFound(
+ environ['PATH_INFO'],
+- comment=cgi.escape(extra)).wsgi_application
++ comment=escape(extra)).wsgi_application
+ return app(environ, start_response)
+
+ def normalize_url(self, url, trim=True):
+--- Paste-2.0.3/setup.py.orig 2016-03-09 01:28:08.000000000 +0100
++++ Paste-2.0.3/setup.py 2023-10-28 09:57:23.521571722 +0200
+@@ -57,7 +57,7 @@ setup(name="Paste",
+ namespace_packages=['paste'],
+ zip_safe=False,
+ test_suite='nose.collector',
+- install_requires=['six>=1.4.0'],
++ install_requires=['six>=1.13.0'],
+ tests_require=['nose>=0.11'],
+ extras_require={
+ 'subprocess': [],
+--- Paste-2.0.3/paste/url.py.orig 2023-10-28 09:27:48.294522286 +0200
++++ Paste-2.0.3/paste/url.py 2023-10-28 09:56:10.121969362 +0200
+@@ -276,8 +276,8 @@ class URL(URLResource):
+ 'http://localhost/view'
+ >>> u['//foo'].param(content='view').html
+ '<a href="http://localhost/view/foo">view</a>'
+- >>> u.param(confirm='Really?', content='goto').html
+- '<a href="http://localhost/view" onclick="return confirm(\'Really?\')">goto</a>'
++ >>> u.param(confirm='Really?', content='goto').html # doctest:+ELLIPSIS
++ '<a href="http://localhost/view" onclick="return confirm(...Really?...)">goto</a>'
+ >>> u(title='See "it"', content='goto').html
+ '<a href="http://localhost/view?title=See+%22it%22">goto</a>'
+ >>> u('another', var='fuggetaboutit', content='goto').html
+@@ -375,8 +375,8 @@ class Button(URLResource):
+ >>> u = URL('/')
+ >>> u = u / 'delete'
+ >>> b = u.button['confirm=Sure?'](id=5, content='del')
+- >>> str(b)
+- '<button onclick="if (confirm(\'Sure?\')) {location.href=\'/delete?id=5\'}; return false">del</button>'
++ >>> str(b) # doctest:+ELLIPSIS
++ '<button onclick="if (confirm(...Sure?...)) {location.href=.../delete?id=5...}; return false">del</button>'
+ """
+
+ default_params = {'tag': 'button'}
+@@ -419,8 +419,8 @@ class JSPopup(URLResource):
+ >>> u = URL('/')
+ >>> u = u / 'view'
+ >>> j = u.js_popup(content='view')
+- >>> j.html
+- '<a href="/view" onclick="window.open(\'/view\', \'_blank\'); return false" target="_blank">view</a>'
++ >>> j.html # doctest:+ELLIPSIS
++ '<a href="/view" onclick="window.open(.../view..., ..._blank...); return false" target="_blank">view</a>'
+ """
+
+ default_params = {'tag': 'a', 'target': '_blank'}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-Paste.git/commitdiff/0850d5882bcda6a957348a4451c6da5895e450ac
More information about the pld-cvs-commit
mailing list