Updated scripts to not use PDM anymore
This commit is contained in:
@@ -114,10 +114,10 @@ fi
|
|||||||
echo -e "${GREEN}Installing system-wide pip packages needed for Spoolman...${NC}"
|
echo -e "${GREEN}Installing system-wide pip packages needed for Spoolman...${NC}"
|
||||||
if [[ $is_externally_managed_env ]]; then
|
if [[ $is_externally_managed_env ]]; then
|
||||||
echo -e "${GREEN}Installing the packages using apt-get instead of pip since pip is externally managed...${NC}"
|
echo -e "${GREEN}Installing the packages using apt-get instead of pip since pip is externally managed...${NC}"
|
||||||
apt_packages=("python3-setuptools" "python3-wheel" "python3-pdm")
|
apt_packages=("python3-setuptools" "python3-wheel")
|
||||||
sudo apt-get install -y "${apt_packages[@]}" || exit 1
|
sudo apt-get install -y "${apt_packages[@]}" || exit 1
|
||||||
else
|
else
|
||||||
packages=("setuptools" "wheel" "pdm")
|
packages=("setuptools" "wheel")
|
||||||
for package in "${packages[@]}"; do
|
for package in "${packages[@]}"; do
|
||||||
if ! pip3 show "$package" &>/dev/null; then
|
if ! pip3 show "$package" &>/dev/null; then
|
||||||
echo -e "${GREEN}Installing $package...${NC}"
|
echo -e "${GREEN}Installing $package...${NC}"
|
||||||
@@ -131,9 +131,6 @@ fi
|
|||||||
#
|
#
|
||||||
user_python_bin_dir=$(python3 -m site --user-base)/bin
|
user_python_bin_dir=$(python3 -m site --user-base)/bin
|
||||||
if [[ ! "$PATH" =~ "$user_python_bin_dir" ]]; then
|
if [[ ! "$PATH" =~ "$user_python_bin_dir" ]]; then
|
||||||
echo -e "${ORANGE}WARNING: $user_python_bin_dir is not in PATH, this will make it difficult to run PDM commands. Temporarily adding $user_python_bin_dir to PATH...${NC}"
|
|
||||||
echo -e "${ORANGE}To make this permanent, add the following line to your .bashrc or .zshrc file:${NC}"
|
|
||||||
echo -e "${ORANGE}export PATH=$user_python_bin_dir:\$PATH${NC}"
|
|
||||||
export PATH=$user_python_bin_dir:$PATH
|
export PATH=$user_python_bin_dir:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -142,11 +139,18 @@ fi
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Install PDM dependencies
|
# Install PDM dependencies
|
||||||
echo -e "${GREEN}Installing Spoolman backend and its dependencies using PDM...${NC}"
|
echo -e "${GREEN}Installing Spoolman backend and its dependencies...${NC}"
|
||||||
|
|
||||||
# Force PDM to use venv. The default is virtualenv which has had some compatibility issues
|
# Create venv if it doesn't exist
|
||||||
pdm config venv.backend venv || exit 1
|
if [ ! -d "venv" ]; then
|
||||||
pdm sync --prod --no-editable || exit 1
|
python3 -m venv .venv || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
# Install dependencies using pip
|
||||||
|
pip3 install -r requirements.txt || exit 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initialize the .env file if it doesn't exist
|
# Initialize the .env file if it doesn't exist
|
||||||
|
|||||||
@@ -30,6 +30,12 @@ if [[ ! "$PATH" =~ "$user_python_bin_dir" ]]; then
|
|||||||
export PATH=$user_python_bin_dir:$PATH
|
export PATH=$user_python_bin_dir:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Activate .venv
|
||||||
|
#
|
||||||
|
echo -e "${GREEN}Activating .venv...${NC}"
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
#
|
#
|
||||||
# Load envvars from .env file
|
# Load envvars from .env file
|
||||||
#
|
#
|
||||||
@@ -41,4 +47,4 @@ set +o allexport
|
|||||||
# Start Spoolman using pdm run
|
# Start Spoolman using pdm run
|
||||||
#
|
#
|
||||||
echo -e "${GREEN}Starting Spoolman...${NC}"
|
echo -e "${GREEN}Starting Spoolman...${NC}"
|
||||||
pdm run app --host $SPOOLMAN_HOST --port $SPOOLMAN_PORT
|
python -m uvicorn spoolman.main:app --host $SPOOLMAN_HOST --port $SPOOLMAN_PORT
|
||||||
|
|||||||
Reference in New Issue
Block a user