-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
8baller
committed
Nov 9, 2023
1 parent
881160f
commit f2934d9
Showing
4 changed files
with
81 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,7 @@ fmt: | |
lint: | ||
poetry run flake8 tests lyra | ||
|
||
all: fmt lint tests | ||
all: fmt lint tests | ||
|
||
test-docs: | ||
echo making docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
Installations for the necessary packages. | ||
""" | ||
|
||
import os | ||
from dataclasses import dataclass | ||
|
||
from rich.progress import track | ||
|
||
from rysk_client.src.utils import get_logger | ||
|
||
logger = get_logger() | ||
|
||
|
||
@dataclass | ||
class HostDependency: | ||
""" | ||
represents a host dependency | ||
""" | ||
|
||
name: str | ||
install_cmd: str | ||
|
||
def is_present(self) -> bool: | ||
""" | ||
silently check if the dependency is present on the host | ||
""" | ||
return os.popen(f"which {self.name}").read() != "" | ||
|
||
def install(self) -> None: | ||
""" | ||
install the dependency | ||
""" | ||
os.system(self.install_cmd) | ||
|
||
|
||
def install_dependencies() -> None: | ||
""" | ||
install the dependencies | ||
""" | ||
dependencies = [ | ||
( | ||
"rustc", | ||
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh", | ||
), | ||
( | ||
"anvil", | ||
"git clone https://github.com/foundry-rs/foundry && " | ||
+ "cd foundry && " | ||
+ "cargo install --path ./anvil --bins --locked --force && " | ||
+ "rm -rf ../foundry", | ||
), | ||
] | ||
logger.info(f"Installing {len(dependencies)} dependencies") | ||
for dependency in track(dependencies): | ||
dep = HostDependency(*dependency) | ||
if not dep.is_present(): | ||
logger.info(f"Installing {dep.name}") | ||
# dep.install() | ||
logger.info("Done!") | ||
|
||
|
||
if __name__ == "__main__": | ||
install_dependencies() |