Skip to content

Commit

Permalink
Enhance setup.sh verbosity and checks (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime authored Aug 15, 2024
1 parent a0000e1 commit 577bd22
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions tools/make/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

0 comments on commit 577bd22

Please sign in to comment.