Remove installation dependency on six
This commit is contained in:
parent
e4bfb7b3e5
commit
ae61db7b74
35
backport-Remove-installation-dependency-on-six.patch
Normal file
35
backport-Remove-installation-dependency-on-six.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From f3d5f8f724767075854d3d657875e658bbff9a74 Mon Sep 17 00:00:00 2001
|
||||
From: shixuantong <shixuantong@huawei.com>
|
||||
Date: Sat, 9 Apr 2022 23:15:27 +0800
|
||||
Subject: [PATCH] Remove installation dependency on six
|
||||
|
||||
The python2 life cycle is over and we can give up support for python2. Therefore, we no longer need to rely on the six module.
|
||||
---
|
||||
requests_file.py | 6 ++++--
|
||||
requirements.txt | 1 -
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/requests_file.py b/requests_file.py
|
||||
index 7464e55..d9bf5b8 100644
|
||||
--- a/requests_file.py
|
||||
+++ b/requests_file.py
|
||||
@@ -6,8 +6,10 @@
|
||||
import stat
|
||||
import locale
|
||||
import io
|
||||
-
|
||||
-from six import BytesIO
|
||||
+try:
|
||||
+ from io import BytesIO
|
||||
+except ImportError:
|
||||
+ from StringIO import StringIO as BytesIO
|
||||
|
||||
|
||||
class FileAdapter(BaseAdapter):
|
||||
diff --git a/requirements.txt b/requirements.txt
|
||||
index 0f255c9..5a687fa 100644
|
||||
--- a/requirements.txt
|
||||
+++ b/requirements.txt
|
||||
@@ -1,2 +1 @@
|
||||
requests>=1.0.0
|
||||
-six
|
||||
@ -2,12 +2,14 @@
|
||||
|
||||
Name: python-%{_name}
|
||||
Version: 1.5.1
|
||||
Release: 3
|
||||
Release: 4
|
||||
Summary: A transport adapter for use with the Requests Python library
|
||||
License: ASL 2.0
|
||||
URL: https://github.com/dashea/requests-file
|
||||
Source0: https://github.com/dashea/%{_name}/archive/%{version}.tar.gz
|
||||
|
||||
Patch6000: backport-Remove-installation-dependency-on-six.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
@ -18,7 +20,7 @@ to allow local filesystem access via file:// URLs.
|
||||
Summary: python3 version of %{summary}
|
||||
BuildRequires: python3-devel python3-setuptools python3-pytest
|
||||
BuildRequires: python3-requests python3-six
|
||||
Requires: python3-requests python3-six
|
||||
Requires: python3-requests
|
||||
%{?python_provide:%python_provide python3-%{_name}}
|
||||
|
||||
%description -n python3-%{_name}
|
||||
@ -45,6 +47,9 @@ export PYTHONPATH=%{buildroot}%{python3_sitelib}
|
||||
%{python3_sitelib}/*info*
|
||||
|
||||
%changelog
|
||||
* Thu Aug 04 2022 shixuantong <shixuantong@h-partners.com> - 1.5.1-4
|
||||
- Remove installation dependency on six
|
||||
|
||||
* Fri Oct 30 2020 tianwei <tianwei12@huawei.com> - 1.5.1-3
|
||||
- remove python2
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user