Skip to content

Commit

Permalink
feat(fw): eest utils - replace HOME env var for solc-select install.
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-tb committed Mar 4, 2024
1 parent 5652f31 commit 9949d8d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/entry_points/eest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import click
import colorlog

# Required for forks <= Constantinople
SOLC_PRE_CONSTANTINOPLE = "0.8.22"


def setup_logger():
"""
Expand Down Expand Up @@ -53,7 +56,8 @@ def init():
solc-select use latest --always-install
```
"""
venv_create = [sys.executable, "-m", "venv", "./venv/"]
venv_create = [sys.executable, "-m", "venv", os.path.join(".", "venv")]

logger.info(f"Creating a virtual environment: `{' '.join(venv_create)}`")
subprocess.run(venv_create, check=True)

Expand All @@ -68,13 +72,11 @@ def init():
subprocess.run(pip_install, check=True)

solc_select_path = os.path.join(".", "venv", "bin", "solc-select")
# solc-select uses $HOME to store the solc binaries, so temporarily change it to the venv
original_home = os.environ.get("HOME")
os.environ["HOME"] = "./venv"
os.environ["VIRTUAL_ENV"] = os.environ.get("VIRTUAL_ENV")

# Required for forks <= Constantinople, see important note:
# Required for forks <= Constantinople, see important note within release note:
# https://github.com/ethereum/solidity/releases/tag/v0.8.22
solc_install_0_8_22 = [solc_select_path, "install", "0.8.22"]
solc_install_0_8_22 = [solc_select_path, "install", SOLC_PRE_CONSTANTINOPLE]
logger.info(f"Installing solc 0.8.22 within venv: `{' '.join(solc_install_0_8_22)}`")
subprocess.run(solc_install_0_8_22, check=True)

Expand All @@ -84,9 +86,6 @@ def init():
)
subprocess.run(solc_install_latest, check=True)

# Revert the $HOME environment variable
os.environ["HOME"] = original_home


@eest.command()
def clean():
Expand Down

0 comments on commit 9949d8d

Please sign in to comment.