dsa-ou / m269-installer

Software installation script and instructions for M269
https://dsa-ou.github.io/m269-installer/
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Exit script if venv fails #28

Closed densnow closed 1 year ago

densnow commented 1 year ago

We have had a couple of reports where the Python virtual environment was not created successfully, but the script will continue. For example in install.ps1 if line 86 (. '$VENV\Scripts\Activate.ps1') fails, the script will continue, this means upgrading pip and possibly installing packages from requirements.txt into the global environment? Whatever the case, exiting with appropriate error message if the environment fails to be created could be something that is needed.

mwermelinger commented 1 year ago

Why would activation fail?

Anyhow, if you know how to check that activation failed, please do submit a PR. Thanks!

densnow commented 1 year ago

I am not sure exactly, but there is a thread on the m269-23j technical forum where someone was having issues with the script and this did occur (the output to the terminal was shared). I don't know whether this is all due to the "space in username" issue #27 or something else.

There have also been reports of the script not creating the environment for various reasons (maybe user skipping/missing certain instructions etc), so could be good to end the script if the environment is not created or activation fails.

Luckily it seems powershell uses the $? variable to store exit status from the last command so just a case of a if (-not $?) then do something.

I guess we should check if environment was created successfully, and also the activation?