Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Dec 5, 2023
1 parent 210082e commit 913c4bf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mxpy-up.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ def install_mxpy(exact_version: str, from_branch: str, verbose: bool):
st = os.stat(shortcut_path)
os.chmod(shortcut_path, st.st_mode | stat.S_IEXEC)

update_shortcut_path = sdk_path / "mxpy-update"

try:
update_shortcut_path.unlink()
logger.debug(f"Removed existing shortcut: {update_shortcut_path}")
except FileNotFoundError:
logger.debug(f"Shortcut does not exist yet: {update_shortcut_path}")
pass

update_shortcut_content = get_mxpy_update_shortcut_content()
update_shortcut_path.write_text(update_shortcut_content)

st = os.stat(update_shortcut_path)
os.chmod(update_shortcut_path, st.st_mode | stat.S_IEXEC)

logger.info("You have successfully installed mxpy.")


Expand All @@ -206,6 +221,19 @@ def get_mxpy_shortcut_content():
"""


def get_mxpy_update_shortcut_content():
# operating_system = get_operating_system()

# if operating_system == "windows":
# return f"""#!/bin/sh
# . "{venv_path / 'Scripts' / 'activate'}" && python3 -m multiversx_sdk_cli.cli "$@" && deactivate
# """

return f"""#!/bin/sh
wget -O ~/mxpy-up.py https://raw.githubusercontent.com/multiversx/mx-sdk-py-cli/main/mxpy-up.py && python3 mxpy-up.py "$@"
"""


def run_in_venv(args: List[str], venv_path: Path, verbose: bool):
env = os.environ.copy()

Expand Down

0 comments on commit 913c4bf

Please sign in to comment.