diff --git a/tvm/environment_manager/infrastructure/environment_manager_git_repository.py b/tvm/environment_manager/infrastructure/environment_manager_git_repository.py index 28250b6..0fd21aa 100644 --- a/tvm/environment_manager/infrastructure/environment_manager_git_repository.py +++ b/tvm/environment_manager/infrastructure/environment_manager_git_repository.py @@ -33,14 +33,9 @@ def project_creator(self, version: str) -> None: "tutor_root": f"{self.PROJECT_PATH}", "tutor_plugins_root": f"{self.PROJECT_PATH}/plugins", } - context = { - "version": data.get("version", None), - "tvm": f"{TVM_PATH}", - } self.create_config_json(data) self.create_active_script(data) - self.create_tutor_switcher(context) self.create_project(version) def current_version(self) -> ProjectName: @@ -57,18 +52,13 @@ def create_config_json(self, data: dict) -> None: def create_active_script(self, context: dict) -> None: """Create active script file.""" + context.update({ + "tvm_path": TVM_PATH + }) activate_script = f"{self.TVM_ENVIRONMENT}/bin/activate" with open(activate_script, "w", encoding="utf-8") as activate_file: activate_file.write(TVM_ACTIVATE_SCRIPT.render(**context)) - def create_tutor_switcher(self, context: dict) -> None: - """Create tutor switcher file.""" - tutor_file = f"{self.TVM_ENVIRONMENT}/bin/tutor" - with open(tutor_file, "w", encoding="utf-8") as switcher_file: - switcher_file.write(TUTOR_SWITCHER_TEMPLATE.render(**context)) - # set execute permissions - os.chmod(tutor_file, stat.S_IRWXU | stat.S_IRWXG | stat.S_IROTH | stat.S_IXOTH) - def create_project(self, project: str) -> None: """Duplicate the version directory and rename it.""" if not os.path.exists(f"{TVM_PATH}/{project}"): @@ -86,7 +76,7 @@ def setup_version_virtualenv(version=None) -> None: """Create virtualenv and install tutor cloned.""" # Create virtualenv subprocess.run( - f"cd {TVM_PATH}/{version}; virtualenv venv", + f"cd {TVM_PATH}/{version}; virtualenv --prompt {version} venv", shell=True, check=True, executable="/bin/bash", diff --git a/tvm/templates/tvm_activate.py b/tvm/templates/tvm_activate.py index e0080dc..bc6c154 100644 --- a/tvm/templates/tvm_activate.py +++ b/tvm/templates/tvm_activate.py @@ -54,7 +54,7 @@ TVM_PROJECT_ENV="{{ tutor_root }}" export TVM_PROJECT_ENV _TVM_OLD_VIRTUAL_PATH="$PATH" -PATH="$TVM_PROJECT_ENV/.tvm/bin:$PATH" +PATH="{{tvm_path}}/{{version}}/venv/bin:$PATH" export PATH if ! [ -z "${TUTOR_ROOT+_}" ] ; then _TVM_OLD_TUTOR_ROOT="$TUTOR_ROOT"