vendor a part of distutils, to be removed from stdlib in py3.12
distutils (a module in the python standard library that we use) got deprecated in python 3.10, and is planned to be removed from the stdlib in python 3.12. see9d38120e33/Lib/distutils/__init__.py (L16)We only use it in the Qt update_checker (for signed version notifications), to compare version numbers. That is, we only use a very small part of it (only `distutils.version.StrictVersion`). ``` .../electrum/electrum/gui/qt/update_checker.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.version import StrictVersion ``` Migration advice in PEP-632 suggests ( https://peps.python.org/pep-0632/#migration-advice ): > `distutils.version` — use the `packaging` package Note that `packaging` is a 3rd party package, i.e. it would be a new dependency. Also, it does not provide an identical replacement for `distutils.version.StrictVersion`. Care needs to be taken when changing the semantics of version numbers... E.g. `packaging.parse` and `packaging.Version` are less strict than what we currently use. We have to be careful that old code recognises new electrum version numbers as both valid and numerically greater than their version. I think the easiest approach is for us to vendor this small part of distutils. Re directory structure, this is based on `pip`:bab5bfce50/src/pip/_vendor(although the approach here is much more naive ofc)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from PyQt5.QtCore import Qt, QThread, pyqtSignal
|
||||
from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QLabel, QProgressBar,
|
||||
@@ -17,6 +16,7 @@ from electrum.i18n import _
|
||||
from electrum.util import make_aiohttp_session
|
||||
from electrum.logging import Logger
|
||||
from electrum.network import Network
|
||||
from electrum._vendor.distutils.version import StrictVersion
|
||||
|
||||
|
||||
class UpdateCheck(QDialog, Logger):
|
||||
|
||||
Reference in New Issue
Block a user