diff options
author | Alex Tawse <alex.tawse@arm.com> | 2023-08-21 15:01:03 +0100 |
---|---|---|
committer | Alex Tawse <alex.tawse@arm.com> | 2023-08-21 16:17:54 +0100 |
commit | f1b28b861e301122b85ad7dc3d8ccb0720fcb584 (patch) | |
tree | 06efaa69e49e9727e56bdc0d4363b23f681d47cf | |
parent | f5afd52405519015df94ccc64cd520cea7943e7c (diff) | |
download | ml-embedded-evaluation-kit-f1b28b861e301122b85ad7dc3d8ccb0720fcb584.tar.gz |
MLCE-1096: Making Python script Windows-compatible
Change-Id: Id52f6b182c5b8325c377f2924e0eeee57f3c4287
-rwxr-xr-x | set_up_default_resources.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/set_up_default_resources.py b/set_up_default_resources.py index dd702c7..b442432 100755 --- a/set_up_default_resources.py +++ b/set_up_default_resources.py @@ -428,13 +428,21 @@ def set_up_resources( # 1.2 Does the virtual environment exist? env_dirname = "env" env_path = download_dir / env_dirname - env_python = str(env_path / "bin" / "python3") - env_activate = str(env_path / "bin" / "activate") - if not env_path.is_dir(): + venv_builder = venv.EnvBuilder(with_pip=True, upgrade_deps=True) + venv_context = venv_builder.ensure_directories(env_dir=env_path) + + env_python = Path(venv_context.env_exe) + + if sys.platform == "win32": + env_activate = f"{venv_context.bin_path}/activate.bat" + else: + env_activate = f". {venv_context.bin_path}/activate" + + if not env_python.is_file(): # 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) + venv_builder.create(env_dir=env_path) # 1.3 Install additional requirements first, if a valid file has been provided if additional_requirements_file and os.path.isfile(additional_requirements_file): @@ -559,7 +567,7 @@ def set_up_resources( ) vela_command = ( - f". {env_activate} && vela {model} " + f"{env_activate} && vela {model} " + f"--accelerator-config={config.config_name} " + "--optimise Performance " + f"--config {config_file} " |