-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspectrix.sh
executable file
·37 lines (30 loc) · 1.25 KB
/
spectrix.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Check if a virtual environment is already activated
if [[ -z "$VIRTUAL_ENV" ]]; then
echo "No virtual environment detected."
# Check if the .venv directory exists
if [[ ! -d ".venv" ]]; then
echo "Creating a new virtual environment..."
python3 -m venv .venv
else
echo "Virtual environment already exists."
fi
# Activate the virtual environment
echo "Activating the virtual environment..."
source .venv/bin/activate
else
echo "Virtual environment is already activated."
fi
# Install required Python packages
echo "Installing required Python packages..."
pip install -r requirements.txt
# Set the PYO3_PYTHON environment variable to point to the Python in the virtual environment
export PYO3_PYTHON=$(pwd)/.venv/bin/python
echo "PYO3_PYTHON set to $(pwd)/.venv/bin/python"
# Dynamically determine the Python version for PYTHONPATH
PYTHON_VERSION=$($PYO3_PYTHON -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
export PYTHONPATH=$(pwd)/.venv/lib/python${PYTHON_VERSION}/site-packages
echo "PYTHONPATH set to $(pwd)/.venv/lib/python${PYTHON_VERSION}/site-packages"
# Run the Rust project in release mode
echo "Running Rust project in release mode..."
cargo run --release