aedi: add target's ability to validate minimum os versions

This commit is contained in:
alexey.lysiuk 2021-06-25 10:05:15 +03:00
parent 88dade9121
commit 2e58efc866

View file

@ -17,6 +17,7 @@
# #
import copy import copy
from distutils.version import StrictVersion
import os import os
from platform import machine from platform import machine
import re import re
@ -24,7 +25,7 @@ import shutil
import subprocess import subprocess
import typing import typing
from ..utility import CommandLineOptions, symlink_directory from ..utility import CommandLineOptions, symlink_directory, OS_VERSION_X86_64, OS_VERSION_ARM64
from ..state import BuildState from ..state import BuildState
@ -67,7 +68,15 @@ class BuildTarget(Target):
self.options = CommandLineOptions() self.options = CommandLineOptions()
self.multi_platform = True self.multi_platform = True
self.os_version = dict()
self.os_version['x86_64'] = OS_VERSION_X86_64
self.os_version['arm64'] = OS_VERSION_ARM64
def configure(self, state: BuildState): def configure(self, state: BuildState):
os_version = state.os_version()
if os_version and os_version < self.os_version[state.architecture()]:
raise RuntimeError('Minimum OS version requirement is not met')
os.makedirs(state.build_path, exist_ok=True) os.makedirs(state.build_path, exist_ok=True)
env = self.environment env = self.environment