summaryrefslogtreecommitdiff
path: root/set_up_default_resources.py
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2023-06-09 11:58:26 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2023-06-09 12:02:11 +0100
commit36b5b13797bb2c87aa92bd3cfe255cb462fbdf5f (patch)
tree4c05261dead74dcd8a5a0b2bf2a5d0cc5fea429a /set_up_default_resources.py
parent4c431d77902dc3c47e92a4ad3a3a58ac3e4cc806 (diff)
downloadml-embedded-evaluation-kit-36b5b13797bb2c87aa92bd3cfe255cb462fbdf5f.tar.gz
MLECO-4065: Revising scripts to use Python3.923.05
Revising documentation and scripts to use Python3.9 explicitly to remove the need for installing it system-wide that might break a distro's desktop and pacakge manager utilities. Change-Id: I683b55dd0243d0a726dc94eba2431005d4897c8c Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
Diffstat (limited to 'set_up_default_resources.py')
-rwxr-xr-xset_up_default_resources.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/set_up_default_resources.py b/set_up_default_resources.py
index 740cfb8..dd702c7 100755
--- a/set_up_default_resources.py
+++ b/set_up_default_resources.py
@@ -23,6 +23,7 @@ import shutil
import subprocess
import sys
import urllib.request
+import venv
from argparse import ArgumentParser
from argparse import ArgumentTypeError
from collections import namedtuple
@@ -382,18 +383,16 @@ def set_up_resources(
metadata_dict = dict()
vela_version = "3.8.0"
- py3_major_version_minimum = 3 # Python >= 3.9 is required
- py3_minor_version_minimum = 9
+ py3_version_minimum = (3, 9)
# Is Python minimum requirement matched?
py3_version = sys.version_info
- if (
- py3_version.major < py3_major_version_minimum
- or py3_version.minor < py3_minor_version_minimum
- ):
+ if py3_version < py3_version_minimum:
raise Exception(
"ERROR: Python3.9+ is required, please see the documentation on how to update it."
)
+ else:
+ logging.info(f"Using Python version: {py3_version}")
setup_script_hash_verified = False
setup_script_hash = get_md5sum_for_file(Path(__file__).resolve())
@@ -433,15 +432,9 @@ def set_up_resources(
env_activate = str(env_path / "bin" / "activate")
if not env_path.is_dir():
- os.chdir(download_dir)
- # Create the virtual environment.
- command = f"python3 -m venv {env_dirname}"
- call_command(command)
- commands = ["pip install --upgrade pip", "pip install --upgrade setuptools"]
- for c in commands:
- command = f"{env_python} -m {c}"
- call_command(command)
- os.chdir(current_file_dir)
+ # Create the virtual environment using current interpreter's venv
+ # (not necessarily the system's Python3)
+ venv.create(env_dir=env_path, with_pip=True, upgrade_deps=True)
# 1.3 Install additional requirements first, if a valid file has been provided
if additional_requirements_file and os.path.isfile(additional_requirements_file):