Changeset - a5d15a7511a9
[Not reviewed]
stable
0 2 0
Mads Kiilerich (mads) - 20 months ago 2024-07-19 23:19:34
mads@kiilerich.com
Grafted from: da382b9e9631
lib: use packaging.version.Version instead of dropped distutils.version.StrictVersion

distutils is dropped in Python 3.12 . Migrate to packaging as described on
https://github.com/pypa/packaging/issues/520 .
2 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/utils2.py
Show inline comments
 
@@ -38,10 +38,10 @@ import string
 
import sys
 
import time
 
import urllib.parse
 
from distutils.version import StrictVersion
 

	
 
import bcrypt
 
import urlobject
 
from packaging.version import Version
 
from sqlalchemy.engine import url as sa_url
 
from sqlalchemy.exc import ArgumentError
 
from tg import tmpl_context
 
@@ -494,7 +494,7 @@ def check_password(password, hashed):
 
    return False
 

	
 

	
 
git_req_ver = StrictVersion('1.7.4')
 
git_req_ver = Version('1.7.4')
 

	
 
def check_git_version():
 
    """
 
@@ -525,7 +525,7 @@ def check_git_version():
 
    output = safe_str(stdout).strip()
 
    m = re.search(r"\d+.\d+.\d+", output)
 
    if m:
 
        ver = StrictVersion(m.group(0))
 
        ver = Version(m.group(0))
 
        log.debug('Git executable: "%s", version %s (parsed from: "%s")',
 
                  settings.GIT_EXECUTABLE_PATH, ver, output)
 
        if ver < git_req_ver:
 
@@ -538,7 +538,7 @@ def check_git_version():
 
            log.error("Terminating ...")
 
            sys.exit(1)
 
    else:
 
        ver = StrictVersion('0.0.0')
 
        ver = Version('0.0.0')
 
        log.warning('Error finding version number in "%s --version" stdout:\n%s',
 
                    settings.GIT_EXECUTABLE_PATH, output)
 

	
scripts/deps.py
Show inline comments
 
@@ -128,6 +128,7 @@ psycopg2
 
docs
 
setup
 
conftest
 
packaging
 
'''.split())
 

	
 
normal_modules = set('''
0 comments (0 inline, 0 general)