Skip to content

Commit

Permalink
Merge pull request #913 from Webperf-se/cockroacher-patch-1
Browse files Browse the repository at this point in the history
Updated dependency tool to allow python versions 3.10-3.13
  • Loading branch information
cockroacher authored Jan 29, 2025
2 parents e6ae518 + 4a6f9a2 commit 7731c0d
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions helpers/dependency_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,29 @@ def test_cmd(command):
process.kill()
return result, 'Not found.'


def check_python():
result, error = test_cmd('python -V')
# if python_error is not None or python_error != b'':
# print('\t- Python:', 'ERROR:', python_error)
# return
if result is None:
print('\t- Python:', 'ERROR: Unknown return')
return

version = None
regex = r"Python (?P<version>[0-9\.]+)"
matches = re.finditer(
regex, result, re.MULTILINE)
regex = r"Python (?P<major>[0-9]+)\.(?P<minor>[0-9]+)"
matches = re.finditer(regex, result, re.MULTILINE)
for _, match in enumerate(matches, start=1):
version = match.group('version')
version = packaging.version.Version(f"{match.group('major')}.{match.group('minor')}")

if version is None:
print('\t- Python:', 'ERROR: Unable to get version')
return

version = packaging.version.Version(version)
repo_version = packaging.version.Version("3.13")
if version.major is not repo_version.major:
print('\t- Python:', 'WARNING: wrong major version')
return
# Define acceptable versions, only considering major and minor
acceptable_versions = {packaging.version.Version('3.10'), packaging.version.Version('3.11'),
packaging.version.Version('3.12'), packaging.version.Version('3.13')}

if version.minor is not repo_version.minor:
print('\t- Python:', 'WARNING: wrong minor version')
if version not in acceptable_versions:
print('\t- Python:', 'WARNING: version not in supported range (3.10-3.13)')
return

print('\t- Python:', 'OK')
Expand Down

0 comments on commit 7731c0d

Please sign in to comment.