Replace distutils.version with packaging.version

This commit is contained in:
Miguel Jacq 2025-02-03 17:36:20 +11:00
parent 818472e62c
commit 3bde77cd91
No known key found for this signature in database
GPG key ID: 59B3F0C24135C6A9
3 changed files with 8 additions and 5 deletions

View file

@ -27,13 +27,14 @@ import base64
import nacl.public
import os
import psutil
import re
import shlex
import subprocess
import tempfile
import time
import traceback
from distutils.version import LooseVersion as Version
from packaging.version import Version
class TorErrorAutomatic(Exception):
@ -658,7 +659,8 @@ class Onion(object):
# Does this version of Tor support next-gen ('v3') onions?
# Note, this is the version of Tor where this bug was fixed:
# https://trac.torproject.org/projects/tor/ticket/28619
self.supports_v3_onions = self.tor_version >= Version("0.3.5.7")
cleaned_tor_version = re.sub(r"\s*\(.*\)", "", self.tor_version)
self.supports_v3_onions = Version(cleaned_tor_version) >= Version("0.3.5.7")
# Now that we are connected to Tor, if we are using built-in bridges,
# update them with the latest copy available from the Tor API