From ae61db7b746fff045783c87c4d279c66ed4c5018 Mon Sep 17 00:00:00 2001 From: shixuantong Date: Thu, 4 Aug 2022 11:39:57 +0800 Subject: [PATCH] Remove installation dependency on six --- ...emove-installation-dependency-on-six.patch | 35 +++++++++++++++++++ python-requests-file.spec | 9 +++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 backport-Remove-installation-dependency-on-six.patch diff --git a/backport-Remove-installation-dependency-on-six.patch b/backport-Remove-installation-dependency-on-six.patch new file mode 100644 index 0000000..9876308 --- /dev/null +++ b/backport-Remove-installation-dependency-on-six.patch @@ -0,0 +1,35 @@ +From f3d5f8f724767075854d3d657875e658bbff9a74 Mon Sep 17 00:00:00 2001 +From: shixuantong +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 diff --git a/python-requests-file.spec b/python-requests-file.spec index c8df3f5..b5cae9c 100644 --- a/python-requests-file.spec +++ b/python-requests-file.spec @@ -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 - 1.5.1-4 +- Remove installation dependency on six + * Fri Oct 30 2020 tianwei - 1.5.1-3 - remove python2