Sync from SUSE:SLFO:Main python-yarl revision a59bafc1534c670ca825ccd3df516e32

This commit is contained in:
Adrian Schröter 2024-12-13 12:40:03 +01:00
parent 7d3e0e0296
commit ca91ed40aa
6 changed files with 164 additions and 141 deletions

View File

@ -1,125 +0,0 @@
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)

View File

@ -1,3 +1,124 @@
-------------------------------------------------------------------
Wed Oct 9 07:39:46 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 1.14.0
* Switched to using the :mod:`propcache <propcache.api>`
package for property caching
* Started testing with Hypothesis
* Improved performance of :py:meth:`~yarl.URL.is_default_port`
when no explicit port is set
* Improved performance of converting :class:`~yarl.URL` to
a string when no explicit port is set
* Improved performance of the :py:meth:`~yarl.URL.origin` method
* Improved performance of encoding hosts
- from version 1.13.1
* Improved performance of calling :py:meth:`~yarl.URL.build`
with ``authority``
- from version 1.13.0
* Started rejecting ASCII hostnames with invalid characters. For
host strings that look like authority strings, the exception
message includes advice on what to do instead
* Fixed IPv6 addresses missing brackets when the :class:`~yarl.URL`
was converted to a string
* Added :attr:`~yarl.URL.host_subcomponent` which returns
the :rfc:`3986#section-3.2.2` host subcomponent
- Update BuildRequires from requirements/test.txt
-------------------------------------------------------------------
Wed Sep 25 11:36:24 UTC 2024 - Nico Krapp <nico.krapp@suse.com>
- update to 1.12.1
- update to 1.12.0
* Added attr `~yarl.URL.path_safe` to be able to fetch the
path without %2F and %25 decoded
* Restore decoding %2F (/) in URL.path
* Improved performance of processing paths
-------------------------------------------------------------------
Tue Sep 3 06:46:22 UTC 2024 - Adrian Schröter <adrian@suse.de>
- updaze to 1.9.7:
* Removed support :rfc:3986#section-3.2.3 port normalization
when the scheme is not one of http, https, wss, or ws
* Joining URLs with empty segments has been changed
to match :rfc:3986
-------------------------------------------------------------------
Tue Mar 12 10:35:11 UTC 2024 - Bernhard Wiedemann <bwiedemann@suse.com>
- restore correct reproducible.patch
-------------------------------------------------------------------
Tue Jan 16 22:10:35 UTC 2024 - Dirk Müller <dmueller@suse.com>
- restore reproducible.patch to not add a random tmp path
(boo#1062303)
-------------------------------------------------------------------
Sun Jan 14 15:08:48 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 1.9.4:
* Started raising :py:exc:`TypeError` when a string value is
passed into :py:meth:`~yarl.URL.build` as the port argument
-- by :user:`commonism`. Previously the empty string as port
would create malformed URLs when rendered as string
representations.
* Started raising :py:exc:`TypeError` when a string value is
passed into :py:meth:`~yarl.URL.build` as the port argument
* Previously the empty string as port would create malformed
URLs when rendered as string representations. (:issue:`883`)
* The leading -- has been dropped from the PEP 517 in-tree
build backend config setting names. --pure-python is now just
pure-python -- by :user:`webknjaz`. The usage now looks as
follows: $ python -m build \ --config-setting=pure-
python=true \ --config-setting=with-cython-tracing=true
(:issue:`963`)
* The leading -- has been dropped from the PEP 517 in-tree
build backend config setting names. --pure-python is now just
pure-python -- by :user:`webknjaz`.
* It is now possible to request line tracing in Cython builds
using the with-cython-tracing PEP 517 config setting --
:user:`webknjaz`. This can be used in CI and development
environment to measure coverage on Cython modules, but is not
normally useful to the end-users or downstream packagers.
Here's a usage example: $ python -Im pip install . --config-
settings=with-cython-tracing=true For editable installs,
this setting is on by default. Otherwise, it's off unless
requested explicitly. (:issue:`962`)
- drop reproducible.patch (upstream)
-------------------------------------------------------------------
Tue Dec 12 03:44:58 UTC 2023 - Bernhard Wiedemann <bwiedemann@suse.de>
- Add reproducible.patch to not add a random tmp path
into the package (boo#1062303)
-------------------------------------------------------------------
Mon Nov 27 20:14:14 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 1.9.3:
* Stopped dropping trailing slashes in
:py:meth:`~yarl.URL.joinpath`
* Started accepting string subclasses in ``__truediv__()``
operations (``URL / segment``)
* Fixed the human representation of URLs with square brackets
in usernames and passwords
* Updated type hints to include ``URL.missing_port()``,
``URL.__bytes__()`` and the ``encoding`` argument to
:py:meth:`~yarl.URL.joinpath`
* Integrated Cython 3 to enable building *yarl* under Python
3.12
* Declared modern ``setuptools.build_meta`` as the :pep:`517`
build backend in :file:`pyproject.toml` explicitly
* Converted most of the packaging setup into a declarative
:file:`setup.cfg`
* Declared Python 3.12 supported officially in the distribution
package metadata
* A regression test for no-host URLs was added per :issue:`821`
* and :rfc:`3986`
* MyST is now integrated in Sphinx
- drop 882-sq_bracket_in_URL_netloc.patch (upstream)
-------------------------------------------------------------------
Tue Jul 4 21:47:32 UTC 2023 - Matej Cepl <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-yarl
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -18,27 +18,32 @@
%{?sle15_python_module_pythons}
Name: python-yarl
Version: 1.9.2
Version: 1.14.0
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
Patch1: reproducible.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module devel >= 3.7}
BuildRequires: %{python_module expandvars}
BuildRequires: %{python_module idna >= 2.0}
# test requirements
BuildRequires: %{python_module multidict >= 4.0}
BuildRequires: %{python_module covdefaults}
BuildRequires: %{python_module hypothesis >= 6.0}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module propcache >= 0.2.0}
BuildRequires: %{python_module pytest-cov}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-idna >= 2.0
Requires: python-multidict >= 4.0
Requires: python-propcache >= 0.2.0
%python_subpackages
%description
@ -63,6 +68,6 @@ export CFLAGS="%{optflags} -Wno-return-type"
%license LICENSE
%doc CHANGES.rst README.rst
%{python_sitearch}/yarl
%{python_sitearch}/yarl-%{version}*-info
%{python_sitearch}/yarl-%{version}.dist-info
%changelog

22
reproducible.patch Normal file
View File

@ -0,0 +1,22 @@
Date: 2023-12-12
Author: Bernhard M. Wiedemann <bwiedemann suse de>
Make package build reproducible
For this we avoid the use of a random tmp path
that gets embedded into
/usr/lib64/python3.10/site-packages/yarl/_quoting_c.cpython-310-x86_64-linux-gnu.so
diff --git a/packaging/pep517_backend/_backend.py b/packaging/pep517_backend/_backend.py
index 9a28ace..3e7db07 100644
--- a/packaging/pep517_backend/_backend.py
+++ b/packaging/pep517_backend/_backend.py
@@ -286,7 +286,7 @@ def build_wheel(
"""
with maybe_prebuild_c_extensions(
line_trace_cython_when_unset=False,
- build_inplace=False,
+ build_inplace=True,
config_settings=config_settings,
):
return _setuptools_build_wheel(

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

Binary file not shown.

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

Binary file not shown.