-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance setup.sh verbosity and checks (#154)
- Loading branch information
1 parent
a0000e1
commit 577bd22
Showing
1 changed file
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,49 @@ else | |
echo "GNU parallel is already installed." | ||
fi | ||
|
||
python3.10 -m venv venv | ||
echo 'export PYTHONPATH="$PWD/hydra:$PYTHONPATH"' >> venv/bin/activate | ||
# Check if python3.10 is installed | ||
if ! command -v python3.10 >/dev/null; then | ||
echo "python3.10 is not installed. Please install Python 3.10 and try again." | ||
case "$OSTYPE" in | ||
linux-gnu*) | ||
echo "On Debian/Ubuntu, you can install it with: sudo apt-get install python3.10" | ||
echo "On Fedora, you can install it with: sudo dnf install python3.10" | ||
;; | ||
darwin*) | ||
echo "On macOS, you can install it with Homebrew: brew install [email protected]" | ||
;; | ||
*) | ||
echo "Please refer to your operating system's documentation for installing Python 3.10." | ||
;; | ||
esac | ||
exit 1 | ||
fi | ||
|
||
# Check if venv module is available | ||
if ! python3.10 -m venv --help >/dev/null 2>&1; then | ||
echo "The venv module is not available in your Python 3.10 installation." | ||
case "$OSTYPE" in | ||
linux-gnu*) | ||
echo "On Debian/Ubuntu, you can install it with: sudo apt-get install python3.10-venv" | ||
echo "On Fedora, you can install it with: sudo dnf install python3.10-venv" | ||
;; | ||
darwin*) | ||
echo "On macOS, ensure your Python 3.10 installation includes the venv module." | ||
;; | ||
*) | ||
echo "Please refer to your operating system's documentation for installing the venv module." | ||
;; | ||
esac | ||
exit 1 | ||
fi | ||
|
||
# Create virtual environment | ||
if ! python3.10 -m venv venv; then | ||
echo "Failed to create virtual environment with python3.10" | ||
exit 1 | ||
fi | ||
|
||
echo 'export PYTHONPATH="$PWD/hydra:$PWD:$PYTHONPATH"' >> venv/bin/activate | ||
echo 'export PYTHONPYCACHEPREFIX="$PWD/venv/build/__pycache__"' >> venv/bin/activate | ||
echo "PROJECT_ROOT=$PWD" > .env | ||
echo "PYTHONPATH=$PWD/hydra" >> .env # For vscode python path when running in integrated terminal. | ||
|
@@ -60,6 +101,13 @@ maturin develop --release | |
cd ../../ | ||
|
||
echo "Generating input files for test_pairing.cairo..." | ||
python3.10 tests/gen_inputs.py | ||
source venv/bin/activate && python3.10 tests/gen_inputs.py | ||
|
||
echo "All done!" | ||
|
||
# Check Scarb version and print warning if it's not | ||
if ! scarb --version | grep -q "2.7.0"; then | ||
echo "Warning: Scarb is not installed or its version is not 2.7.0." | ||
echo "Got: $(scarb --version)" | ||
echo "Please install Scarb 2.7.0 before continuing. https://docs.swmansion.com/scarb/download.html" | ||
fi |