chia-blockchain/activated.py
dustinface 43d679dba3
pre-commit: Fix a venv activation issue on linux (#12822)
* pre-commit: Fix a venv activation issue on linux

I ended up with the same issue as in https://github.com/Chia-Network/chia-blockchain/pull/12235 and using `.` instead of `source` (Which is supposed to be the same?) fixed it.

* Make it all `sh`
2022-08-09 18:27:11 -05:00

29 lines
594 B
Python
Executable File

#!/usr/bin/env python3
import os
import pathlib
import subprocess
import sys
here = pathlib.Path(__file__).parent
def main(*args: str) -> int:
if len(args) == 0:
print("Parameters required")
return 1
if sys.platform == "win32":
script = "activated.ps1"
command = ["powershell", os.fspath(here.joinpath(script)), *args]
else:
script = "activated.sh"
command = ["sh", os.fspath(here.joinpath(script)), *args]
completed_process = subprocess.run(command)
return completed_process.returncode
sys.exit(main(*sys.argv[1:]))