From 0c9aaa9a744829318e5a001d0f21ddb3f7adb1dc Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Thu, 21 Sep 2023 16:50:34 +0300 Subject: [PATCH] remove default sc-meta installation when installing rust --- .github/workflows/build.yml | 8 ++------ multiversx_sdk_cli/dependencies/modules.py | 5 +---- multiversx_sdk_cli/projects/project_rust.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32a3296a..79cf4040 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,12 +44,8 @@ jobs: - name: Setup test dependencies run: | python3 -m multiversx_sdk_cli.cli deps install testwallets - python3 -m multiversx_sdk_cli.cli deps install wasm-opt - rustup default nightly-2023-05-26 - cargo install multiversx-sc-meta - ls $HOME/.cargo/bin - echo $PATH - cat $HOME/.bashrc + python3 -m multiversx_sdk_cli.cli deps install wasm-op + python3 -m multiversx_sdk_cli.cli deps install rust --overwrite - name: Run unit tests run: | export PYTHONPATH=. diff --git a/multiversx_sdk_cli/dependencies/modules.py b/multiversx_sdk_cli/dependencies/modules.py index 4a67c6a0..d51a941b 100644 --- a/multiversx_sdk_cli/dependencies/modules.py +++ b/multiversx_sdk_cli/dependencies/modules.py @@ -270,11 +270,8 @@ def _do_install(self, tag: str) -> None: args = [str(installer_path), "--verbose", "--default-toolchain", toolchain, "--profile", "minimal", "--target", "wasm32-unknown-unknown", "-y"] - output = myprocess.run_process(args) - if output: - sc_meta_args = ["cargo", "install", "multiversx-sc-meta"] - myprocess.run_process(sc_meta_args) + myprocess.run_process(args) def _get_installer_url(self) -> str: if workstation.is_windows(): diff --git a/multiversx_sdk_cli/projects/project_rust.py b/multiversx_sdk_cli/projects/project_rust.py index 498dae16..58355de9 100644 --- a/multiversx_sdk_cli/projects/project_rust.py +++ b/multiversx_sdk_cli/projects/project_rust.py @@ -1,4 +1,5 @@ import logging +import shutil import subprocess from pathlib import Path from typing import Any, Dict, List, Set, cast @@ -53,7 +54,14 @@ def prepare_build_wasm_args(self, args: List[str]): self.get_output_folder() ]) + def check_if_sc_meta_is_installed(self): + which_sc_meta = shutil.which("sc-meta") + + if which_sc_meta is None: + raise errors.KnownError("'sc-meta' is not installed. Run 'cargo install multiversx-sc-meta' then try again.") + def run_meta(self): + self.check_if_sc_meta_is_installed() env = self.get_env() with_wasm_opt = not self.options.get("no-wasm-opt") @@ -123,6 +131,8 @@ def get_env(self): return dependencies.get_module_by_key("rust").get_env() def build_wasm_with_debug_symbols(self, build_options: Dict[str, Any]): + self.check_if_sc_meta_is_installed() + cwd = self.path env = self.get_env() target_dir: str = build_options.get("target-dir", "")