Sync from SUSE:ALP:Source:Standard:1.0 python-yarl revision 5e34555c73c3b88b72a5c31ec416baf6

This commit is contained in:
Adrian Schröter 2023-10-03 11:11:03 +02:00
commit f47c395caf
5 changed files with 501 additions and 0 deletions

23
.gitattributes vendored Normal file
View 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

View File

@ -0,0 +1,125 @@
From 5c977b52a33bf58f016e5968934c3fcb8b49b239 Mon Sep 17 00:00:00 2001
From: Martijn Pieters <mj@zopatista.com>
Date: Tue, 6 Jun 2023 17:38:47 +0100
Subject: [PATCH] Correct square bracket handling in URL netloc
- The human representation of usernames and passwords should percent-
encode square brackets.
- Clean up the test suite to remove tests that use invalid hostnames
(square brackets in a host name must only be used for IPv6 addresses).
- Rename the remaining test using IPvFuture address syntax to make this
explicit.
- Drop a test for IPv6 addresses with a zone id; zone id support is
controversial and expilictly excluded from the WHATWG URL standard.
Zone ids *without percent characters in their name* continue to work
as long as urllib.parse.urlsplit() accepts them but this is not
something that yarl.URL() needs to support explicitly.
---
CHANGES/876.bugfix.rst | 1 +
tests/test_url.py | 10 ++--------
tests/test_url_parsing.py | 28 ++--------------------------
yarl/_url.py | 4 ++--
4 files changed, 7 insertions(+), 36 deletions(-)
create mode 100644 CHANGES/876.bugfix.rst
--- /dev/null
+++ b/CHANGES/876.bugfix.rst
@@ -0,0 +1 @@
+Fixed the human representation of URLs with square brackets in usernames and passwords.
--- a/tests/test_url.py
+++ b/tests/test_url.py
@@ -235,12 +235,6 @@ def test_compressed_ipv6():
assert url.host == url.raw_host
-def test_ipv6_zone():
- url = URL("http://[fe80::822a:a8ff:fe49:470c%тест%42]:123")
- assert url.raw_host == "fe80::822a:a8ff:fe49:470c%тест%42"
- assert url.host == url.raw_host
-
-
def test_ipv4_zone():
# I'm unsure if it is correct.
url = URL("http://1.2.3.4%тест%42:123")
@@ -1629,8 +1623,8 @@ def test_human_repr_delimiters():
s = url.human_repr()
assert URL(s) == url
assert (
- s == "http:// !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40[\\]^_`{|}~"
- ": !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40[\\]^_`{|}~"
+ s == "http:// !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40%5B\\%5D^_`{|}~"
+ ": !\"%23$%25&'()*+,-.%2F%3A;<=>%3F%40%5B\\%5D^_`{|}~"
"@хост.домен:8080"
"/ !\"%23$%25&'()*+,-./:;<=>%3F@[\\]^_`{|}~"
"? !\"%23$%25%26'()*%2B,-./:%3B<%3D>?@[\\]^_`{|}~"
--- a/tests/test_url_parsing.py
+++ b/tests/test_url_parsing.py
@@ -178,14 +178,6 @@ class TestHost:
assert u.query_string == ""
assert u.fragment == ""
- def test_masked_ipv4(self):
- u = URL("//[127.0.0.1]/")
- assert u.scheme == ""
- assert u.host == "127.0.0.1"
- assert u.path == "/"
- assert u.query_string == ""
- assert u.fragment == ""
-
def test_ipv6(self):
u = URL("//[::1]/")
assert u.scheme == ""
@@ -194,15 +186,7 @@ class TestHost:
assert u.query_string == ""
assert u.fragment == ""
- def test_strange_ip(self):
- u = URL("//[-1]/")
- assert u.scheme == ""
- assert u.host == "-1"
- assert u.path == "/"
- assert u.query_string == ""
- assert u.fragment == ""
-
- def test_strange_ip_2(self):
+ def test_ipvfuture_address(self):
u = URL("//[v1.-1]/")
assert u.scheme == ""
assert u.host == "v1.-1"
@@ -210,14 +194,6 @@ class TestHost:
assert u.query_string == ""
assert u.fragment == ""
- def test_strange_ip_3(self):
- u = URL("//v1.[::1]/")
- assert u.scheme == ""
- assert u.host == "::1"
- assert u.path == "/"
- assert u.query_string == ""
- assert u.fragment == ""
-
class TestPort:
def test_canonical(self):
@@ -320,7 +296,7 @@ class TestUserInfo:
assert u.fragment == ""
def test_weird_user3(self):
- u = URL("//[some]@host")
+ u = URL("//%5Bsome%5D@host")
assert u.scheme == ""
assert u.user == "[some]"
assert u.password is None
--- a/yarl/_url.py
+++ b/yarl/_url.py
@@ -1117,8 +1117,8 @@ class URL:
def human_repr(self):
"""Return decoded human readable string for URL representation."""
- user = _human_quote(self.user, "#/:?@")
- password = _human_quote(self.password, "#/:?@")
+ user = _human_quote(self.user, "#/:?@[]")
+ password = _human_quote(self.password, "#/:?@[]")
host = self.host
if host:
host = self._encode_host(self.host, human=True)

282
python-yarl.changes Normal file
View File

@ -0,0 +1,282 @@
-------------------------------------------------------------------
Tue Jul 4 21:47:32 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Add 882-sq_bracket_in_URL_netloc.patch fixing handling of
square bracket handling in URL netloc (gh#aio-libs/yarl#876).
-------------------------------------------------------------------
Wed Apr 26 07:02:00 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Update to version 1.9.2
Fix regression with truediv and absolute URLs with empty paths
causing the raw path to lack the leading /. ((#854)_)
-------------------------------------------------------------------
Mon Apr 24 09:13:21 UTC 2023 - Adrian Schröter <adrian@suse.de>
- update to version 1.9.1
* Marked tests that fail on older Python patch releases
(< 3.7.10, < 3.8.8 and < 3.9.2) as expected to fail due to missing
a security fix for CVE-2021-23336. ((#850)_)
- Delete support-python-311.patch, not needed anymore
-------------------------------------------------------------------
Fri Apr 21 12:39:08 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:46:02 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Thu Mar 2 10:41:59 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Refreshed support-python-311.patch: with fix
of CVE-2023-24329 (bsc#1208471), the test
test_url_parsing.TestScheme.test_not_a_scheme2 fails on all
openSUSE/SLE Python interpreters.
-------------------------------------------------------------------
Mon Jan 9 04:17:48 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python-311.patch:
* Skip a test under Python 3.11.
-------------------------------------------------------------------
Wed Dec 7 22:47:59 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to version 1.8.2
* This is the first release that started shipping wheels for Python 3.11.
-------------------------------------------------------------------
Thu Aug 18 21:19:19 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 1.8.1
* Added URL.raw_suffix, URL.suffix, URL.raw_suffixes,
URL.suffixes, URL.with_suffix. (#613)
* Dropped Python 3.6 support. (#672)
- Drop tests_overcome_bpo42967.patch
-------------------------------------------------------------------
Tue Dec 7 15:57:39 UTC 2021 - pgajdos@suse.com
- version update to 1.7.2
- Changed call in ``with_port()`` to stop reencoding parts of the URL
that were already encoded. (`#623 <https://github.com/aio-libs/yarl/issues/623>`_)
- Add `__bytes__()` magic method so that `bytes(url)` will work and use optimal
ASCII encoding. (`#582 <https://github.com/aio-libs/yarl/issues/582>`_)
- Started shipping platform-specific arm64 wheels for Apple Silicon.
(`#622 <https://github.com/aio-libs/yarl/issues/622>`_)
- Started shipping platform-specific wheels with the ``musl`` tag targeting typical
Alpine Linux runtimes. (`#622 <https://github.com/aio-libs/yarl/issues/622>`_)
- Added support for Python 3.10. (`#622 <https://github.com/aio-libs/yarl/issues/622>`_)
- do not require pytest-runner for build, it is not needed
-------------------------------------------------------------------
Sat Mar 20 19:40:32 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Unset -Werror=return-type for python39
- Only install typing_extensions for Python < 3.8
-------------------------------------------------------------------
Tue Feb 23 17:02:42 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Add tests_overcome_bpo42967.patch to over effects of bpo#42967,
which forbade mixing amps and semicolons in query strings as
separators.
-------------------------------------------------------------------
Sat Dec 19 10:06:48 UTC 2020 - Dirk Müller <dmueller@suse.com>
- update to 1.6.3:
- No longer loose characters when decoding incorrect percent-sequences (like
``%e2%82%f8``). All non-decodable percent-sequences are now preserved.
- Provide generated ``.c`` files in TarBall distribution.
- ``human_repr()`` now always produces valid representation equivalent to the
original URL (if the original URL is valid).
- Fixed requoting a single percent followed by a percent-encoded character
in the Cython implementation.
- Fix ValueError when decoding ``%`` which is not followed by two hexadecimal
digits.
- Fix decoding ``%`` followed by a space and hexadecimal digit.
- Fix annotation of ``with_query()``/``update_query()`` methods for
``key=[val1, val2]`` case.
-------------------------------------------------------------------
Mon Sep 28 12:05:26 UTC 2020 - Dirk Mueller <dmueller@suse.com>
- update to 1.6.0:
- Allow for int and float subclasses in query, while still denying bool.
`#492 <https://github.com/aio-libs/yarl/issues/492>`_
- Do not requote arguments in ``URL.build()``, ``with_xxx()`` and in ``/`` operator.
`#502 <https://github.com/aio-libs/yarl/issues/502>`_
- Keep IPv6 brackets in ``origin()``.
`#504 <https://github.com/aio-libs/yarl/issues/504>`_
-------------------------------------------------------------------
Tue Jul 28 21:28:25 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- remove c source file from package (rpmlint error)
- needs typing-extensions
-------------------------------------------------------------------
Tue Jul 28 19:15:09 UTC 2020 - Ondřej Súkup <mimi.vx@gmail.com>
- update to 1.5.0
- fix tests
* Convert host to lowercase on URL building. #386
* Allow using mod operator (%) for updating query string (an alias for update_query() method)
* Allow use of sequences such as list and tuple in the values of a mapping
such as dict to represent that a key has many values:
url = URL("http://example.com")
assert url.with_query({"a": [1, 2]}) == URL("http://example.com/?a=1&a=2")
* Support URL.build() with scheme and path (creates a relative URL)
* Cache slow IDNA encode/decode calls
* Add @final / Final type hints
* Support URL authority/raw_authority properties and authority argument
of URL.build() method
* Hide the library implementation details, make the exposed public list very clean
* Fix tests with newer Python (3.7.6, 3.8.1 and 3.9.0+)
* Fix a bug where query component, passed in a form of mapping or sequence,
is unquoted in unexpected way
* Hide Query and QueryVariable type aliases in __init__.pyi, now they
are prefixed with underscore.
* Keep ipv6 brackets after updating port/user/password.
-------------------------------------------------------------------
Mon Feb 3 14:38:51 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- update to 1.4.2
* Workaround for missing str.isascii() in Python 3.6
* Distinguish an empty password in URL from a password not provided at all
* Fixed annotations for optional parameters of URL.build
* Use None as default value of user parameter of URL.build
* Enforce building C Accelerated modules when installing from source tarball,
use YARL_NO_EXTENSIONS environment variable for falling back to (slower)
Pure Python implementation
* Fix quoting of plus in path by pure python version
* Don't create a new URL if fragment is unchanged
* Included in error msg the path that produces starting slash forbidden error
* Skip slow IDNA encoding for ASCII-only strings
-------------------------------------------------------------------
Sun Mar 3 13:52:01 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>
- update to 1.3.0
* Fix annotations for query parameter
* An incoming query sequence can have int variables
* Add URL.explicit_port property
* Give a friendlier error when port cant be converted to int
* bool(URL()) now returns False
* Fix annotations for build
* Fix annotations for cached_property
* Accept str subclasses in URL constructor
* Forbid inheritance, replace __init__ with __new__
* Support PEP-561 (provide type hinting marker)
-------------------------------------------------------------------
Wed Aug 29 09:17:59 UTC 2018 - tchvatal@suse.com
- Raise multidict requirement to match up setup.py
-------------------------------------------------------------------
Sat Feb 24 18:28:57 UTC 2018 - arun@gmx.de
- update to version 1.1.1:
* Fix performance regression: dont encode enmpty netloc (#170)
-------------------------------------------------------------------
Sat Feb 10 18:01:42 UTC 2018 - arun@gmx.de
- update to version 1.1.0:
* Make pure Python quoter consistent with Cython version (#162)
- changes from version 1.0.0:
* Use fast path if quoted string does not need requoting (#154)
* Speed up quoting/unquoting by _Quoter and _Unquoter classes (#155)
* Drop yarl.quote and yarl.unquote public functions (#155)
* Add custom string writer, reuse static buffer if available (#157)
Code is 50-80 times faster than Pure Python version (was 4-5 times
faster)
* Dont recode IP zone (#144)
* Support encoded=True in yarl.URL.build() (#158)
* Fix updating query with multiple keys (#160)
-------------------------------------------------------------------
Thu Jan 11 23:59:33 UTC 2018 - arun@gmx.de
- update to version 0.18.0:
* Fallback to IDNA 2003 if domain name is not IDNA 2008 compatible
(#152)
-------------------------------------------------------------------
Thu Jan 4 17:17:54 UTC 2018 - arun@gmx.de
- specfile:
* update copyright year
* require python-idna
- update to version 0.17.0:
* Add idna requirement
* update to idna 2008 and test
* Update mypy from 0.550 to 0.560
* Better fix for #141
-------------------------------------------------------------------
Sat Dec 9 17:54:08 UTC 2017 - arun@gmx.de
- removed test conditional as requested in SR 555310
- enabled tests
- require pytest-runner
-------------------------------------------------------------------
Fri Dec 8 18:05:15 UTC 2017 - arun@gmx.de
- update to version 0.16.0:
* Fix raising TypeError by url.query_string() after
url.with_query({}) (empty mapping) #141
-------------------------------------------------------------------
Sun Nov 26 21:20:07 UTC 2017 - arun@gmx.de
- update to version 0.15.0:
* Add raw_path_qs attribute (#137)
-------------------------------------------------------------------
Wed Nov 15 00:33:36 UTC 2017 - arun@gmx.de
- update to version 0.14.2:
* Restore strict parameter as no-op in quote/unquote
- changes from version 0.14.1:
* Restore strict parameter as no-op for sake of compatibility with
aiohttp 2.2
-------------------------------------------------------------------
Sun Nov 12 16:59:38 UTC 2017 - arun@gmx.de
- update to version 0.14.0:
* Drop strict mode (#123)
* Fix “ValueError: Unallowed PCT %” when theres a “%” in the url
(#124)
-------------------------------------------------------------------
Tue Oct 31 02:41:59 UTC 2017 - arun@gmx.de
- update to version 0.13.0:
* Document encoded parameter (#102)
* Support relative urls like ?key=value (#100)
* Unsafe encoding for QS fixed. Encode ; char in value param (#104)
* Process passwords without user names (#95)
- changes from version 0.12.0:
* Properly support paths without leading slash in URL.with_path()
(#90)
* Enable type annotation checks
-------------------------------------------------------------------
Thu Jul 13 19:22:44 UTC 2017 - sean.marlow@suse.com
- Initial release v0.11.0.

68
python-yarl.spec Normal file
View File

@ -0,0 +1,68 @@
#
# spec file for package python-yarl
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-yarl
Version: 1.9.2
Release: 0
Summary: Yet another URL library
License: Apache-2.0
URL: https://github.com/aio-libs/yarl/
Source: https://files.pythonhosted.org/packages/source/y/yarl/yarl-%{version}.tar.gz
# PATCH-FIX-UPSTREAM 882-sq_bracket_in_URL_netloc.patch gh#aio-libs/yarl#876 mcepl@suse.com
# Correct square bracket handling in URL netloc
Patch0: 882-sq_bracket_in_URL_netloc.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module devel >= 3.7}
BuildRequires: %{python_module idna >= 2.0}
# test requirements
BuildRequires: %{python_module multidict >= 4.0}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-idna >= 2.0
Requires: python-multidict >= 4.0
%python_subpackages
%description
The module provides a URL class for url parsing and changing.
%prep
%autosetup -p1 -n yarl-%{version}
sed -i '/addopts/d' setup.cfg
%build
export CFLAGS="%{optflags} -Wno-return-type"
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%pytest_arch
%files %{python_files}
%license LICENSE
%doc CHANGES.rst README.rst
%{python_sitearch}/yarl
%{python_sitearch}/yarl-%{version}*-info
%changelog

BIN
yarl-1.9.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.