Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated distutils for python 3.12 compatability #11893

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
pip install dredd_hooks
pip install 'PyYAML>=5.1'
pip install 'six>=1.13.0'
pip install packaging
- name: Install Node.js dependencies
run: yarn install --ignore-scripts
- name: Test with Dredd
Expand Down
6 changes: 3 additions & 3 deletions ext/pint/testsuite/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


import doctest
from distutils.version import StrictVersion
from packaging.utils import canonical_version
import re
import unittest

Expand All @@ -14,13 +14,13 @@
def requires_numpy18():
if not HAS_NUMPY:
return unittest.skip('Requires NumPy')
return unittest.skipUnless(StrictVersion(NUMPY_VER) >= StrictVersion('1.8'), 'Requires NumPy >= 1.8')
return unittest.skipUnless(canonical_version(NUMPY_VER) >= canonical_version('1.8'), 'Requires NumPy >= 1.8')


def requires_numpy_previous_than(version):
if not HAS_NUMPY:
return unittest.skip('Requires NumPy')
return unittest.skipUnless(StrictVersion(NUMPY_VER) < StrictVersion(version), 'Requires NumPy < %s' % version)
return unittest.skipUnless(canonical_version(NUMPY_VER) < canonical_version(version), 'Requires NumPy < %s' % version)


def requires_numpy():
Expand Down
6 changes: 3 additions & 3 deletions lib/pkg_resources/tests/test_pkg_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import subprocess
import stat
import distutils.dist
import distutils.command.install_egg_info
import setuptools.command.install_egg_info

try:
from unittest import mock
Expand Down Expand Up @@ -344,8 +344,8 @@ def create_foo_pkg(self, env, version):
"""
ld = "This package has unicode metadata! ❄"
attrs = dict(name='foo', version=version, long_description=ld)
dist = distutils.dist.Distribution(attrs)
iei_cmd = distutils.command.install_egg_info.install_egg_info(dist)
dist = setuptools.dist.Distribution(attrs)
iei_cmd = setuptools.command.install_egg_info.install_egg_info(dist)
iei_cmd.initialize_options()
iei_cmd.install_dir = env.paths['lib']
iei_cmd.finalize_options()
Expand Down
5 changes: 3 additions & 2 deletions medusa/updater/update_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
from __future__ import unicode_literals

import logging
from distutils.version import LooseVersion

from github import GithubException

from medusa import app
from medusa.logger.adapters.style import BraceAdapter

from packaging.version import Version

from requests.exceptions import RequestException


Expand Down Expand Up @@ -42,7 +43,7 @@ def newest_version(self):
def is_latest_version(self):
"""Compare the current installed version with the remote version."""
try:
if LooseVersion(self.newest_version) > LooseVersion(self.current_version):
if Version(self.newest_version) > Version(self.current_version):
return False
except (GithubException, RequestException) as error:
log.warning("Unable to contact GitHub, can't get latest version: {0!r}", error)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jsonrpclib-pelix==0.4.3.2
knowit==0.4.0
Mako==1.2.4
markdown2==2.4.13
packaging==24.2
profilehooks==1.12.0
PyGithub==1.45
PyJWT==2.7.0
Expand Down
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pycodestyle==2.8.0
flake8-docstrings==1.7.0
flake8-import-order==0.18.2
flake8-quotes==3.3.2
packaging
pep8-naming==0.13.2
pytest>=6.2.5
pytest-cov==4.1.0
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ deps =
pytest
-rtest_requirements.txt
commands =
python setup.py test -a "{posargs:tests} --cov=medusa --cov-report=xml"
pytest {posargs:tests} --cov=medusa --cov-report=xml

[testenv:lint]
deps =
pytest
-rtest_requirements.txt
commands =
python setup.py test -a "medusa --flake8"
pytest medusa --flake8
Loading