mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 02:01:16 +00:00
fw/version: Introduce required version for devlib
To ensure that a compatible version of devlib is installed on the system keep track of the version of devlib that is required by WA and provide a more useful error message if this is not satisfied.
This commit is contained in:
parent
bedd3bf062
commit
adb3ffa6aa
6
setup.py
6
setup.py
@ -29,7 +29,8 @@ except ImportError:
|
||||
wa_dir = os.path.join(os.path.dirname(__file__), 'wa')
|
||||
|
||||
sys.path.insert(0, os.path.join(wa_dir, 'framework'))
|
||||
from version import get_wa_version, get_wa_version_with_commit
|
||||
from version import (get_wa_version, get_wa_version_with_commit,
|
||||
format_version, required_devlib_version)
|
||||
|
||||
# happens if falling back to distutils
|
||||
warnings.filterwarnings('ignore', "Unknown distribution option: 'install_requires'")
|
||||
@ -83,7 +84,7 @@ params = dict(
|
||||
'colorama', # Printing with colors
|
||||
'pyYAML', # YAML-formatted agenda parsing
|
||||
'requests', # Fetch assets over HTTP
|
||||
'devlib>=1.1.dev1', # Interacting with devices
|
||||
'devlib>={}'.format(format_version(required_devlib_version)), # Interacting with devices
|
||||
'louie-latest', # callbacks dispatch
|
||||
'wrapt', # better decorators
|
||||
'pandas>=0.23.0', # Data analysis and manipulation
|
||||
@ -123,7 +124,6 @@ class sdist(orig_sdist):
|
||||
orig_sdist.initialize_options(self)
|
||||
self.strip_commit = False
|
||||
|
||||
|
||||
def run(self):
|
||||
if self.strip_commit:
|
||||
self.distribution.get_version = get_wa_version
|
||||
|
@ -21,14 +21,19 @@ import os
|
||||
import warnings
|
||||
|
||||
import devlib
|
||||
try:
|
||||
from devlib.utils.version import version as installed_devlib_version
|
||||
except ImportError:
|
||||
installed_devlib_version = None
|
||||
|
||||
from wa.framework import pluginloader
|
||||
from wa.framework.command import init_argument_parser
|
||||
from wa.framework.configuration import settings
|
||||
from wa.framework.configuration.execution import ConfigManager
|
||||
from wa.framework.host import init_user_directory, init_config
|
||||
from wa.framework.exception import ConfigError
|
||||
from wa.framework.version import get_wa_version_with_commit
|
||||
from wa.framework.exception import ConfigError, HostError
|
||||
from wa.framework.version import (get_wa_version_with_commit, format_version,
|
||||
required_devlib_version)
|
||||
from wa.utils import log
|
||||
from wa.utils.doc import format_body
|
||||
|
||||
@ -64,6 +69,13 @@ def split_joined_options(argv):
|
||||
return output
|
||||
|
||||
|
||||
# Instead of presenting an obscure error due to a version mismatch explicitly warn the user.
|
||||
def check_devlib_version():
|
||||
if not installed_devlib_version or installed_devlib_version < required_devlib_version:
|
||||
msg = 'WA requires Devlib version >={}. Please update the currently installed version {}'
|
||||
raise HostError(msg.format(format_version(required_devlib_version), devlib.__version__))
|
||||
|
||||
|
||||
def main():
|
||||
if not os.path.exists(settings.user_directory):
|
||||
init_user_directory()
|
||||
@ -102,6 +114,7 @@ def main():
|
||||
logger.debug('Version: {}'.format(get_wa_version_with_commit()))
|
||||
logger.debug('devlib version: {}'.format(devlib.__full_version__))
|
||||
logger.debug('Command Line: {}'.format(' '.join(sys.argv)))
|
||||
check_devlib_version()
|
||||
|
||||
# each command will add its own subparser
|
||||
subparsers = parser.add_subparsers(dest='command')
|
||||
|
@ -23,13 +23,19 @@ VersionTuple = namedtuple('Version', ['major', 'minor', 'revision', 'dev'])
|
||||
|
||||
version = VersionTuple(3, 1, 1, 'dev1')
|
||||
|
||||
required_devlib_version = VersionTuple(1, 1, 0, 'dev1')
|
||||
|
||||
|
||||
def format_version(v):
|
||||
version_string = '{}.{}.{}'.format(
|
||||
v.major, v.minor, v.revision)
|
||||
if v.dev:
|
||||
version_string += '.{}'.format(v.dev)
|
||||
return version_string
|
||||
|
||||
|
||||
def get_wa_version():
|
||||
version_string = '{}.{}.{}'.format(
|
||||
version.major, version.minor, version.revision)
|
||||
if version.dev:
|
||||
version_string += '.{}'.format(version.dev)
|
||||
return version_string
|
||||
return format_version(version)
|
||||
|
||||
|
||||
def get_wa_version_with_commit():
|
||||
|
Loading…
x
Reference in New Issue
Block a user