Skip to content

Commit

Permalink
Remove any trace of distutils use as it is going to be removed in pyt…
Browse files Browse the repository at this point in the history
…hon 3.12 (fixes #51532)
  • Loading branch information
rouault authored and nyalldawson committed Jan 30, 2023
1 parent 4cd5b52 commit e7e02c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
7 changes: 5 additions & 2 deletions cmake/FindSIP.py
Expand Up @@ -37,8 +37,11 @@
print("sip_version_num:%d" % sipbuild.version.SIP_VERSION)
print("sip_version_str:%s" % sipbuild.version.SIP_VERSION_STR)

from distutils.sysconfig import get_python_lib
python_modules_dir = get_python_lib(plat_specific=1)
import sysconfig
if "deb_system" in sysconfig.get_scheme_names():
python_modules_dir = sysconfig.get_path("purelib", "deb_system")
else:
python_modules_dir = sysconfig.get_path("purelib")
print("default_sip_dir:%s" % python_modules_dir)
except ImportError: # Code for SIP v4
import sipconfig
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgslayertreeview.py
Expand Up @@ -14,7 +14,7 @@

import os

from distutils.version import StrictVersion
from packaging.version import Version

from qgis.core import (
QgsLayerTreeModel,
Expand All @@ -37,7 +37,7 @@
USE_MODEL_TESTER = False


if StrictVersion(PYQT_VERSION_STR) >= StrictVersion('5.11'):
if Version(PYQT_VERSION_STR) >= Version('5.11'):
from qgis.PyQt.QtTest import QAbstractItemModelTester
USE_MODEL_TESTER = True

Expand Down
1 change: 0 additions & 1 deletion tests/src/python/test_qgsrasterattributetablemodel.py
Expand Up @@ -18,7 +18,6 @@
import qgis # NOQA

import os
from distutils.version import StrictVersion
from qgis.PyQt.QtCore import QVariant, QModelIndex
from qgis.PyQt.QtGui import QColor
from qgis.PyQt.Qt import Qt, PYQT_VERSION_STR
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgssymbollayer.py
Expand Up @@ -29,7 +29,7 @@
from osgeo import ogr
import os

from distutils.version import StrictVersion
from packaging.version import Version
from qgis.PyQt.Qt import PYQT_VERSION_STR
from qgis.PyQt.QtCore import Qt, QObject, QDir, QFile, QIODevice, QPointF, QSize, QTemporaryDir
from qgis.PyQt.QtXml import QDomDocument
Expand Down Expand Up @@ -89,7 +89,7 @@

TEST_DATA_DIR = unitTestDataPath()

if StrictVersion(PYQT_VERSION_STR) < StrictVersion('5.7'):
if Version(PYQT_VERSION_STR) < Version('5.7'):
from qgis.PyQt.QtCore import pyqtWrapperType
EXPECTED_TYPE = pyqtWrapperType
else:
Expand Down

0 comments on commit e7e02c7

Please sign in to comment.