Drop the dependency on six to make the package lighter

This commit is contained in:
Miro Hrončok 2020-10-02 11:44:11 +02:00
parent 8d87885d58
commit 2a2fb373ad
2 changed files with 59 additions and 4 deletions

51
39a70cce.patch Normal file
View File

@ -0,0 +1,51 @@
From 39a70cce69d9b08cc4d02b225114d556d5b59ada Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <hugovk@users.noreply.github.com>
Date: Wed, 19 Aug 2020 22:37:34 +0300
Subject: [PATCH] Remove dependency on six to make package lighter (#331)
---
packaging/requirements.py | 8 +++++++-
setup.py | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/packaging/requirements.py b/packaging/requirements.py
index 91f81ed..2226e98 100644
--- a/packaging/requirements.py
+++ b/packaging/requirements.py
@@ -5,16 +5,22 @@
import string
import re
+import sys
from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
from pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
from pyparsing import Literal as L # noqa
-from six.moves.urllib import parse as urlparse
from ._typing import TYPE_CHECKING
from .markers import MARKER_EXPR, Marker
from .specifiers import LegacySpecifier, Specifier, SpecifierSet
+if sys.version_info[0] >= 3:
+ from urllib import parse as urlparse # pragma: no cover
+else: # pragma: no cover
+ import urlparse
+
+
if TYPE_CHECKING: # pragma: no cover
from typing import List
diff --git a/setup.py b/setup.py
index f533a7d..a14d926 100644
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,7 @@
author=about["__author__"],
author_email=about["__email__"],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
- install_requires=["pyparsing>=2.0.2", "six"], # Needed to avoid issue #91
+ install_requires=["pyparsing>=2.0.2"], # Needed to avoid issue #91
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",

View File

@ -13,7 +13,7 @@
Name: python-%{pypi_name}
Version: 20.4
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Core utilities for Python packages
License: BSD or ASL 2.0
@ -21,10 +21,12 @@ URL: https://github.com/pypa/packaging
Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
# Remove dependency on six to make package lighter, backported from upstream
Patch1: %{url}/commit/39a70cce.patch
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-pyparsing
BuildRequires: python%{python3_pkgversion}-six
%if %{with tests}
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-pretend
@ -47,7 +49,6 @@ Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
Requires: python%{python3_pkgversion}-pyparsing
Requires: python%{python3_pkgversion}-six
%description -n python%{python3_pkgversion}-%{pypi_name}
python3-packaging provides core utilities for Python packages like utilities for
@ -62,7 +63,7 @@ Documentation for python-packaging
%endif
%prep
%autosetup -n %{pypi_name}-%{version}
%autosetup -p1 -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
@ -111,6 +112,9 @@ tests/
%endif
%changelog
* Fri Oct 02 2020 Miro Hrončok <mhroncok@redhat.com> - 20.4-3
- Drop the dependency on six to make the package lighter
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 20.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild