Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install rust globally #331

Merged
merged 36 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a5b0c84
install rust globally
popenta Sep 13, 2023
7250ffa
try fix env
popenta Sep 13, 2023
69fba5e
code cleanup
popenta Sep 13, 2023
0bb5667
update version
popenta Sep 15, 2023
5295378
remove code related to old rust env
popenta Sep 15, 2023
2845d07
install rust for tests
popenta Sep 15, 2023
6906afa
remove explicit rust installation for workflow
popenta Sep 18, 2023
cad2cbd
Merge branch 'main' into globally-install-rust
popenta Sep 18, 2023
47c897e
add pytest flag for showing logs
popenta Sep 18, 2023
7ef887f
set flag for pytest logs
popenta Sep 18, 2023
6c22bac
remove pytest for testing purposes
popenta Sep 21, 2023
e9542fe
debugging
popenta Sep 21, 2023
67defe7
Merge branch 'main' into globally-install-rust
popenta Sep 21, 2023
45e9698
remove python 3.8 from GH action
popenta Sep 21, 2023
362cb9b
install sc-meta on GH action
popenta Sep 21, 2023
edb1c59
set rust toolchain to nightly
popenta Sep 21, 2023
0c9aaa9
remove default sc-meta installation when installing rust
popenta Sep 21, 2023
d7681dd
fix typo
popenta Sep 21, 2023
87df9d4
add new pytest marker
popenta Sep 22, 2023
84ce195
install sc-meta in GH workflow
popenta Sep 22, 2023
b3c6a0c
remove unnecessary prints
popenta Sep 22, 2023
3cbff95
bump version
popenta Sep 22, 2023
c597e34
started refactoring
popenta Sep 22, 2023
485bfaf
Install sc-meta when installing rust
popenta Sep 25, 2023
d5999e9
skip some tests on windows
popenta Sep 25, 2023
837b794
skip test on windows
popenta Sep 25, 2023
39f1b77
install wasm-opt and twiggy using cargo
popenta Sep 26, 2023
177d263
fix resolution
popenta Sep 27, 2023
648cb4c
Merge pull request #340 from multiversx/cargo-install-wasm-opt
popenta Sep 27, 2023
340e5e1
remove clang installation
popenta Sep 27, 2023
fc8609a
fix localnet and unit tests
popenta Sep 27, 2023
8eea743
fix workflow
popenta Sep 27, 2023
ad585ea
run GH actions using newer python version & wasm-opt fixes
popenta Sep 28, 2023
851bd30
fix test assert
popenta Sep 28, 2023
d2af8f5
fixes after review
popenta Sep 28, 2023
d8bb7a4
add link to mxpy cookbook
popenta Sep 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 6 additions & 30 deletions multiversx_sdk_cli/dependencies/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@
toolchain = "nightly"

args = [str(installer_path), "--verbose", "--default-toolchain", toolchain, "--profile",
"minimal", "--target", "wasm32-unknown-unknown", "--no-modify-path", "-y"]
output = myprocess.run_process(args, env=self.get_env_for_install())
"minimal", "--target", "wasm32-unknown-unknown", "-y"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

output = myprocess.run_process(args)

if output:
sc_meta_args = ["cargo", "install", "multiversx-sc-meta"]
myprocess.run_process(sc_meta_args, env=self.get_env_for_install())
myprocess.run_process(sc_meta_args)

def _get_installer_url(self) -> str:
if workstation.is_windows():
Expand Down Expand Up @@ -317,25 +317,8 @@
tools_folder = workstation.get_tools_folder()
return tools_folder / "vendor-rust"

def get_env(self):
directory = self.get_directory("")
resolution = self.get_resolution()

if resolution == DependencyResolution.Host:
return {
"PATH": os.environ.get("PATH", ""),
"RUSTUP_HOME": os.environ.get("RUSTUP_HOME", ""),
"CARGO_HOME": os.environ.get("CARGO_HOME", "")
}
if resolution == DependencyResolution.SDK:
return {
# At this moment, cc (build-essential) is sometimes required by the meta crate (e.g. for reports)
"PATH": f"{path.join(directory, 'bin')}:{os.environ['PATH']}",
"RUSTUP_HOME": str(directory),
"CARGO_HOME": str(directory)
}

raise errors.BadDependencyResolution(self.key, resolution)
def get_env(self) -> Dict[str, str]:
return dict(os.environ)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.


def _get_env_for_is_installed_in_sdk(self) -> Dict[str, str]:
directory = self.get_directory("")
Expand All @@ -347,14 +330,7 @@
}

def get_env_for_install(self):
directory = self.get_directory("")

env = {
# For installation, wget (or curl) and cc (build-essential) are also required.
"PATH": f"{path.join(directory, 'bin')}:{os.environ['PATH']}",
"RUSTUP_HOME": str(directory),
"CARGO_HOME": str(directory)
}
env: Dict[str, str] = {}

Check warning on line 333 in multiversx_sdk_cli/dependencies/modules.py

View workflow job for this annotation

GitHub Actions / runner / mypy

[mypy] reported by reviewdog 🐶 By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] Raw Output: /home/runner/work/mx-sdk-py-cli/mx-sdk-py-cli/multiversx_sdk_cli/dependencies/modules.py:333:9: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think get_env_for_install() isn't used anymore? Also, _get_env_for_is_installed_in_sdk() - can both be removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we can do the same as for get_env(), and keep the old calls to get_env_for_install(), but simply replace the implementation with return os.environ?


if workstation.is_windows():
env["RUSTUP_USE_HYPER"] = "1"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "multiversx-sdk-cli"
version = "8.1.0"
version = "8.2.0b1"
authors = [
{ name="MultiversX" },
]
Expand Down
Loading