##// END OF EJS Templates
tests: use packaging from setuptools instead of deprecated distutils...
Mads Kiilerich -
r52638:e679697a default
parent child Browse files
Show More
@@ -1,4 +1,3 b''
1 import distutils.version
2 import os
1 import os
3 import re
2 import re
4 import socket
3 import socket
@@ -7,6 +6,11 b' import subprocess'
7 import sys
6 import sys
8 import tempfile
7 import tempfile
9
8
9 try:
10 from setuptools.extern.packaging.version import Version
11 except ImportError:
12 from distutils.version import StrictVersion as Version
13
10 tempprefix = 'hg-hghave-'
14 tempprefix = 'hg-hghave-'
11
15
12 checks = {
16 checks = {
@@ -1118,16 +1122,18 b' def has_black():'
1118 blackcmd = 'black --version'
1122 blackcmd = 'black --version'
1119 version_regex = b'black, (?:version )?([0-9a-b.]+)'
1123 version_regex = b'black, (?:version )?([0-9a-b.]+)'
1120 version = matchoutput(blackcmd, version_regex)
1124 version = matchoutput(blackcmd, version_regex)
1121 sv = distutils.version.StrictVersion
1125 if not version:
1122 return version and sv(_bytes2sys(version.group(1))) >= sv('23.3.0')
1126 return False
1127 return Version(_bytes2sys(version.group(1))) >= Version('23.3.0')
1123
1128
1124
1129
1125 @check('pytype', 'the pytype type checker')
1130 @check('pytype', 'the pytype type checker')
1126 def has_pytype():
1131 def has_pytype():
1127 pytypecmd = 'pytype --version'
1132 pytypecmd = 'pytype --version'
1128 version = matchoutput(pytypecmd, b'[0-9a-b.]+')
1133 version = matchoutput(pytypecmd, b'[0-9a-b.]+')
1129 sv = distutils.version.StrictVersion
1134 if not version:
1130 return version and sv(_bytes2sys(version.group(0))) >= sv('2019.10.17')
1135 return False
1136 return Version(_bytes2sys(version.group(0))) >= Version('2019.10.17')
1131
1137
1132
1138
1133 @check("rustfmt", "rustfmt tool at version nightly-2024-07-16")
1139 @check("rustfmt", "rustfmt tool at version nightly-2024-07-16")
General Comments 0
You need to be logged in to leave comments. Login now