Skip to content

Commit

Permalink
Resolve DeprecationWarning: distutils
Browse files Browse the repository at this point in the history
distutils will be deprecated in python 3.12 [1]
This commit replaces distutils.StrictVersion with
the Version class from the packaging egg.

[1] https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated
  • Loading branch information
retornam committed Jun 1, 2023
1 parent 677f2b2 commit 89a3315
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
dist/
forcediphttpsadapter.egg-info/*
4 changes: 2 additions & 2 deletions forcediphttpsadapter/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
# if it's <2.7.9 decide to use the old "http://$IP/ technique. If Python is
# >2.7.9 and the adapter doesn't work, unfortunately, there's nothing that can
# be done :(
from distutils.version import StrictVersion
from packaging.version import Version
from socket import error as SocketError, timeout as SocketTimeout

import requests
Expand All @@ -89,7 +89,7 @@
# Requests older than 2.4.0's VerifiedHHTPSConnection is broken and doesn't
# properly use _new_conn. On these versions, use UnverifiedHTTPSConnection
# instead.
if StrictVersion(requests.__version__) < StrictVersion('2.4.0'):
if Version(requests.__version__) < Version('2.4.0'):
from requests.packages.urllib3.connection import (
UnverifiedHTTPSConnection as HTTPSConnection
)
Expand Down
20 changes: 8 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from setuptools import setup, find_packages


PACKAGE_NAME = 'forcediphttpsadapter'
PACKAGE_VERSION = '1.0.2'
AUTHOR = 'Roadmaster'
EMAIL = 'daniel@tomechangosubanana.com'
URL = 'https://github.com/Roadmaster/forcediphttpsadapter'
PACKAGE_NAME = "forcediphttpsadapter"
PACKAGE_VERSION = "1.0.2"
AUTHOR = "Roadmaster"
EMAIL = "daniel@tomechangosubanana.com"
URL = "https://github.com/Roadmaster/forcediphttpsadapter"


setup(
Expand All @@ -24,19 +24,15 @@
url=URL,
# classifiers=CLASSIFIERS,
# platforms=PLATFORMS,
provides=['adapters'],
install_requires=['requests'],
provides=["adapters"],
install_requires=["packaging", "requests"],
# dependency_links=dependency_links,

packages=find_packages(),
# include_package_data=True,
# package_data=package_data,

download_url='{}/archive/master.zip'.format(URL),
download_url="{}/archive/master.zip".format(URL),
# keywords=KEYWORDS,
# scripts=scripts,

# entry_points={},

zip_safe=False,
)

0 comments on commit 89a3315

Please sign in to comment.