forked from M-Labs/artiq
1
0
Fork 0

fix Python 3.9 compatibility

This commit is contained in:
Sebastien Bourdeauducq 2021-11-19 18:18:24 +08:00
parent aa5f667ad8
commit 64877c0588
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
import argparse import argparse
import logging import logging
from distutils.version import LooseVersion from packaging import version
from misoc.integration.builder import builder_args, builder_argdict from misoc.integration.builder import builder_args, builder_argdict
from misoc.targets.kasli import soc_kasli_args, soc_kasli_argdict from misoc.targets.kasli import soc_kasli_args, soc_kasli_argdict
@ -150,7 +150,7 @@ def main():
description = jsondesc.load(args.description) description = jsondesc.load(args.description)
min_artiq_version = description.get("min_artiq_version", "0") min_artiq_version = description.get("min_artiq_version", "0")
if LooseVersion(artiq_version) < LooseVersion(min_artiq_version): if version.parse(artiq_version) < version.parse(min_artiq_version):
logger.warning("ARTIQ version mismatch: current %s < %s minimum", logger.warning("ARTIQ version mismatch: current %s < %s minimum",
artiq_version, min_artiq_version) artiq_version, min_artiq_version)

View File

@ -13,7 +13,7 @@ def get_version():
srcroot = os.path.dirname(os.path.abspath(__file__)) srcroot = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(srcroot, "MAJOR_VERSION"), "r") as f: with open(os.path.join(srcroot, "MAJOR_VERSION"), "r") as f:
version = f.read().strip() version = f.read().strip()
version += ".unknown" version += ".0"
if os.path.exists(os.path.join(srcroot, "BETA")): if os.path.exists(os.path.join(srcroot, "BETA")):
version += ".beta" version += ".beta"
return version return version