Skip to content

Commit a7672e9

Browse files
authored
Python 3.12 compatibility (#155)
* Replace obsolete dependencies * Replace dev-requirements.txt with requirements.txt and test-requirements.txt * Bump version * Fix tests
1 parent a978cd3 commit a7672e9

7 files changed

Lines changed: 23 additions & 11 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- checkout
1717
- run: python -m venv ~/venv
18-
- run: ~/venv/bin/pip install -r dev-requirements.txt
18+
- run: ~/venv/bin/pip install -r requirements.txt -r test-requirements.txt
1919
- run: ~/venv/bin/pip install .
2020
- run: ~/venv/bin/pytest -sv
2121

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build: false
1212

1313
install:
1414
- "%PYTHON%\\python.exe -m pip install --upgrade pip"
15-
- "%PYTHON%\\python.exe -m pip install -r dev-requirements.txt"
15+
- "%PYTHON%\\python.exe -m pip install -r requirements.txt -r test-requirements.txt"
1616
- "%PYTHON%\\python.exe -m pip install -e ."
1717

1818
test_script:

requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile --no-emit-index-url --output-file=requirements.txt --pre setup.py
6+
#
7+
pkginfo==1.10.0
8+
# via wagon (setup.py)
9+
wheel==0.43.0
10+
# via wagon (setup.py)

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def read(*parts):
2727

2828
setup(
2929
name='wagon',
30-
version='1.0.1',
30+
version='1.0.2',
3131
url='https://github.com/cloudify-cosmo/wagon',
3232
author='Cloudify',
3333
author_email='cosmo-admin@cloudify.co',
@@ -59,6 +59,8 @@ def read(*parts):
5959
'Programming Language :: Python :: 3.8',
6060
'Programming Language :: Python :: 3.9',
6161
'Programming Language :: Python :: 3.10',
62+
'Programming Language :: Python :: 3.11',
63+
'Programming Language :: Python :: 3.12',
6264
'Natural Language :: English',
6365
'Environment :: Console',
6466
'Intended Audience :: Developers',

tests/test_wagon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,13 @@ def test_install_package_in_missing_venv(self):
264264
assert 'virtualenv {0} does not exist'.format(non_existing_venv) \
265265
in str(ex.value)
266266

267-
@mock.patch('wagon.find_executable', return_value=False)
267+
@mock.patch('wagon.which', return_value=False)
268268
def test_assert_auditwheel_does_not_exist(self, _):
269269
with pytest.raises(wagon.WagonError) as ex:
270270
wagon._assert_auditwheel_exists()
271271
assert 'Could not find auditwheel.' in str(ex.value)
272272

273-
@mock.patch('wagon.find_executable', return_value=True)
273+
@mock.patch('wagon.which', return_value=True)
274274
def test_assert_auditwheel_exists(self, _):
275275
wagon._assert_auditwheel_exists()
276276

wagon.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
import argparse
2828
import tempfile
2929
import subprocess
30-
import pkg_resources
31-
import distutils.util
30+
import importlib.metadata
31+
import sysconfig
3232
import venv
3333
from io import StringIO
3434
from threading import Thread
3535
from contextlib import closing
36-
from distutils.spawn import find_executable
36+
from shutil import which
3737
from pkginfo import Wheel
3838

3939
try:
@@ -412,7 +412,7 @@ def _get_python_version():
412412

413413

414414
def get_platform():
415-
return distutils.util.get_platform().replace('.', '_').replace('-', '_')
415+
return sysconfig.get_platform().replace('.', '_').replace('-', '_')
416416

417417

418418
def _get_os_properties():
@@ -478,7 +478,7 @@ def _get_package_info_from_pypi(source):
478478

479479

480480
def _get_wagon_version():
481-
return pkg_resources.get_distribution('wagon').version
481+
return importlib.metadata.distribution('wagon').version
482482

483483

484484
def _set_python_versions(python_versions=None):
@@ -1079,7 +1079,7 @@ def _assert_linux_distribution_exists():
10791079

10801080

10811081
def _assert_auditwheel_exists():
1082-
if not find_executable('auditwheel'):
1082+
if not which('auditwheel'):
10831083
raise WagonError(
10841084
'Could not find auditwheel. '
10851085
'Please make sure auditwheel is installed and is in the PATH.\n'

0 commit comments

Comments
 (0)