uv/crates/gourgeist/venv_checker.py
Charlie Marsh 7caf5f42b8
Copy over gourgeist crate (#61)
This PR copies over the `gourgeist` crate at commit
`e64c17a263dac6933702dc8d155425c053fe885a` with no modifications.

It won't pass CI, but modifications will intentionally be confined to
later PRs.
2023-10-08 14:37:09 -04:00

32 lines
1 KiB
Python

from pathlib import Path
from subprocess import check_output, check_call
def main():
project_root = Path(__file__).parent
venv_name = ".venv-rs"
venv_python = f"{venv_name}/bin/python"
venv_pip = f"{venv_name}/bin/pip"
command = f". {venv_name}/bin/activate && which python"
output = check_output(["bash"], input=command, text=True).strip()
assert output == str(project_root.joinpath(venv_python)), output
command = f". {venv_name}/bin/activate && wheel help"
output = check_output(["bash"], input=command, text=True).strip()
assert output.startswith("usage:"), output
output = (
check_output([venv_python, "imasnake.py"], text=True)
.strip()
.splitlines()
)
assert output[0] == str(project_root.joinpath(venv_python)), output
assert not output[2].startswith(str(project_root)), output
assert output[3] == str(project_root.joinpath(venv_name)), output
check_call([venv_pip, "install", "tqdm"])
if __name__ == "__main__":
main()