From 51aea6e9138c00b3b8e6797d03efcb716c9ac0576f7c6f2d760096292745f1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Wed, 11 Jun 2025 13:03:38 +0000 Subject: [PATCH] - Convert to pip-based build OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests-unixsocket?expand=0&rev=15 --- .gitattributes | 23 ++++++++++ .gitignore | 1 + python-requests-unixsocket.changes | 69 ++++++++++++++++++++++++++++ python-requests-unixsocket.spec | 72 ++++++++++++++++++++++++++++++ requests-unixsocket-0.3.0.tar.gz | 3 ++ requests232.patch | 25 +++++++++++ urllib3-2.patch | 45 +++++++++++++++++++ 7 files changed, 238 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-requests-unixsocket.changes create mode 100644 python-requests-unixsocket.spec create mode 100644 requests-unixsocket-0.3.0.tar.gz create mode 100644 requests232.patch create mode 100644 urllib3-2.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-requests-unixsocket.changes b/python-requests-unixsocket.changes new file mode 100644 index 0000000..20b4c89 --- /dev/null +++ b/python-requests-unixsocket.changes @@ -0,0 +1,69 @@ +------------------------------------------------------------------- +Wed Jun 11 13:03:20 UTC 2025 - Markéta Machová + +- Convert to pip-based build + +------------------------------------------------------------------- +Thu May 23 08:28:38 UTC 2024 - Markéta Machová + +- Add requests232.patch to fix compatibility with new requests +- The project appears unmaintained + * living fork: https://gitlab.com/thelabnyc/requests-unixsocket2 + * patching here for expediency reasons + +------------------------------------------------------------------- +Sat Jun 10 09:24:04 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Tue May 9 11:44:12 UTC 2023 - Daniel Garcia + +- Add urllib3-2.patch to make it compatible with urllib3 >= 2.0.0 + gh#msabramo/requests-unixsocket#69 + +------------------------------------------------------------------- +Mon Jan 10 22:30:46 UTC 2022 - Dirk Müller + +- update to 0.3.0: + * Remove urllib3 dep + * Update setup.cfg metadata - => \_ + * Remove Vagrantfile + * Remove .travis.yml + * Update tox to work + * README.rst: Update badge from Travis => GH + * Fix warning from waitress + * Add GitHub Actions tests + * Remove --pep8 option to pytest + * Bump waitress from 1.4.2 to 1.4.3 + * Bump py from 1.4.32 to 1.10.0 + * Bump waitress from 0.9.0 to 1.4.2 + * Allow UnixAdapter to accept max\_retries parameter + +------------------------------------------------------------------- +Wed Aug 28 08:48:45 UTC 2019 - Marketa Calabkova + +- update to version 0.2.0 + * Remove support for Python 2.6 + * Add support for Python 3.6 + * Add Python 3.7 + * Close socket on deletion + * Allow UnixAdapter to accept max_retries parameter + * Many other changes + +------------------------------------------------------------------- +Wed Mar 20 18:39:29 UTC 2019 - Jan Engelhardt + +- Make the descriptions say what it is, not what the user is to do. + +------------------------------------------------------------------- +Tue Mar 5 12:40:55 UTC 2019 - Tomáš Chvátal + +- Switch to singlespec to support all python variants +- Make sure we run tests + +------------------------------------------------------------------- +Fri Mar 11 08:27:38 UTC 2016 - tbechtold@suse.com + +- Initial packaging (version 0.1.5) + diff --git a/python-requests-unixsocket.spec b/python-requests-unixsocket.spec new file mode 100644 index 0000000..0491baa --- /dev/null +++ b/python-requests-unixsocket.spec @@ -0,0 +1,72 @@ +# +# spec file for package python-requests-unixsocket +# +# Copyright (c) 2025 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-requests-unixsocket +Version: 0.3.0 +Release: 0 +Summary: UNIX domain socket backend for python-requests +License: Apache-2.0 +Group: Development/Languages/Python +URL: https://github.com/msabramo/requests-unixsocket +Source: https://files.pythonhosted.org/packages/source/r/requests-unixsocket/requests-unixsocket-%{version}.tar.gz +# PATCH-FIX-UPSTREAM urllib3-2.patch -- gh#msabramo/requests-unixsocket#69 +Patch0: urllib3-2.patch +# PATCH-FIX-UPSTREAM https://github.com/msabramo/requests-unixsocket/pull/72 adapters: fix for requests 2.32.2+ +Patch1: requests232.patch +BuildRequires: %{python_module pbr} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-requests >= 1.1 +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests >= 1.1} +BuildRequires: %{python_module waitress} +# /SECTION +%python_subpackages + +%description +With this module, python-requests is enhanced by the ability to talk +HTTP via a UNIX domain socket. + +%prep +%autosetup -p1 -n requests-unixsocket-%{version} +# do not require additional test deps +sed -i -e '/addopts/d' pytest.ini + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest requests_unixsocket/tests + +%files %{python_files} +%doc AUTHORS ChangeLog README.rst +%license LICENSE +%{python_sitelib}/requests_unixsocket +%{python_sitelib}/requests_unixsocket-%{version}*-info + +%changelog diff --git a/requests-unixsocket-0.3.0.tar.gz b/requests-unixsocket-0.3.0.tar.gz new file mode 100644 index 0000000..ef09aa7 --- /dev/null +++ b/requests-unixsocket-0.3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28304283ea9357d45fff58ad5b11e47708cfbf5806817aa59b2a363228ee971e +size 14478 diff --git a/requests232.patch b/requests232.patch new file mode 100644 index 0000000..062346a --- /dev/null +++ b/requests232.patch @@ -0,0 +1,25 @@ +From 24811e26b049602bc70fdf6d91e39424200a95ad Mon Sep 17 00:00:00 2001 +From: Simon Deziel +Date: Wed, 22 May 2024 12:02:20 -0400 +Subject: [PATCH] adapters: fix for requests 2.32.2+ + +Signed-off-by: Simon Deziel +--- + requests_unixsocket/adapters.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/requests_unixsocket/adapters.py b/requests_unixsocket/adapters.py +index 83e1400..4ef7174 100644 +--- a/requests_unixsocket/adapters.py ++++ b/requests_unixsocket/adapters.py +@@ -63,6 +63,10 @@ def __init__(self, timeout=60, pool_connections=25, *args, **kwargs): + pool_connections, dispose_func=lambda p: p.close() + ) + ++ # Fix for requests 2.32.2+: https://github.com/psf/requests/pull/6710 ++ def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None): ++ return self.get_connection(request.url, proxies) ++ + def get_connection(self, url, proxies=None): + proxies = proxies or {} + proxy = proxies.get(urlparse(url.lower()).scheme) diff --git a/urllib3-2.patch b/urllib3-2.patch new file mode 100644 index 0000000..14e8adb --- /dev/null +++ b/urllib3-2.patch @@ -0,0 +1,45 @@ +From 5a614f60e7b3639758a6b77691b4e0c0d6827e94 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Roukala=20=28n=C3=A9=20Peres=29?= + +Date: Fri, 5 May 2023 09:23:41 +0300 +Subject: [PATCH] Inherit HTTPConnection through urllib3.connection, not + httplib + +By inheriting from `urllib3.connection.HTTPConnection` (that inherits +from `httplib.HTTPConnection` itself), we can adapt to the internal +changes in urllib3 2.0 that added a `request()` method that is +incompatible with httplib.HTTPConnection.request. + +This fixes the incompatibility between urllib3 2.0 and requests 1.26+, +which was the first version that stopped vendoring urllib3. + +Reference: https://github.com/docker/docker-py/issues/3113#issuecomment-1531570788 +--- + requests_unixsocket/adapters.py | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +Index: requests-unixsocket-0.3.0/requests_unixsocket/adapters.py +=================================================================== +--- requests-unixsocket-0.3.0.orig/requests_unixsocket/adapters.py ++++ requests-unixsocket-0.3.0/requests_unixsocket/adapters.py +@@ -4,11 +4,6 @@ from requests.adapters import HTTPAdapte + from requests.compat import urlparse, unquote + + try: +- import http.client as httplib +-except ImportError: +- import httplib +- +-try: + from requests.packages import urllib3 + except ImportError: + import urllib3 +@@ -16,7 +11,7 @@ except ImportError: + + # The following was adapted from some code from docker-py + # https://github.com/docker/docker-py/blob/master/docker/transport/unixconn.py +-class UnixHTTPConnection(httplib.HTTPConnection, object): ++class UnixHTTPConnection(urllib3.connection.HTTPConnection, object): + + def __init__(self, unix_socket_url, timeout=60): + """Create an HTTP connection to a unix domain socket