From 3a39049607846865b433a0294b39901ee26bff9e Mon Sep 17 00:00:00 2001 From: hyrulelinks <134026642+hyrulelinks@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:11:18 +0800 Subject: [PATCH] Update macos-build-script.sh --- macos-build-script.sh | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/macos-build-script.sh b/macos-build-script.sh index 7b1bb5a..ef30c2f 100644 --- a/macos-build-script.sh +++ b/macos-build-script.sh @@ -4,33 +4,35 @@ git clone https://github.com/TransparentLC/realesrgan-gui.git cd realesrgan-gui # Create and activate Python virtual environment +echo "INFO: 🚀 Checking current Python version..." python_version=$(python3 -V 2>&1 | cut -d" " -f2 | cut -d"." -f1-2) if ! which python3 >/dev/null 2>&1; then - echo "ERROR: ❌ The 'python3' command not found." - echo "ERROR: Please check the Python environment configuration." + echo "ERROR: ⛔️ The 'python3' command not found." + echo "ERROR: 💬 Please check the Python environment configuration." exit 1 else echo "INFO: The 'python3' command found." - if [ "$python_version" == "3.11" ]; then - echo "INFO: ✅ The current Python version is 3.11" - echo "INFO: Creating Python virtual enviroment..." + if [ "$python_version" == "3.12" ]; then + echo "INFO: ✅ The current Python version is 3.12" + echo "INFO: 🚀 Creating Python 3.12 virtual enviroment..." python3 -m venv venv - echo "INFO: Activating Python virtual enviroment..." + echo "INFO: 🚀 Activating Python virtual enviroment..." source venv/bin/activate else - echo "ERROR: ❌ The current Python version is $python_version but 3.11 is required." - echo "INFO: Creating Python 3.11 virtual environment via virtualenv." + echo "ERROR: ⛔️ The current Python version is $python_version but 3.12 is required." + echo "INFO: 🚀 Installling Python package 'virtualenv'..." pip3 install virtualenv - virtualenv -p python3.11 venv - echo "INFO: Activating Python virtual enviroment..." + echo "INFO: 🚀 Creating Python 3.12 virtual enviroment..." + virtualenv -p python3.12 venv + echo "INFO: 🚀 Activating Python virtual enviroment..." source venv/bin/activate fi fi # Download required files -echo "INFO: 🔽 Downloading realesrgan-ncnn-vulkan..." +echo "INFO: 🚀 Downloading realesrgan-ncnn-vulkan executable and models..." base_url="https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0" source_file="realesrgan-ncnn-vulkan-20220424-macos.zip" target_file="realesrgan-ncnn-vulkan" @@ -65,15 +67,16 @@ mv "temp_file" "$target_file" chmod u+x "$target_file" # Install dependencies -echo "INFO: Installing requirements..." +echo "INFO: 🚀 Installing requirements..." pip3 install -r requirements.txt +echo "INFO: 🚀 Installing Python package 'pyinstaller'..." pip install pyinstaller # Build macOS app -echo "INFO: Packaging macOS app..." +echo "INFO: 🚀 Packaging macOS app..." sudo pyinstaller realesrgan-gui-macos.spec # Copy built app to Download directory ditto dist/Real-ESRGAN\ GUI.app $HOME/Downloads/Real-ESRGAN\ GUI.app -echo "INFO: 'Real-ESRGAN GUI.app' is in Downloads directory." -echo "INFO: Please manually drag 'Real-ESRGAN GUI.app' to Applications directory to finish install." +echo "INFO: ✅ 'Real-ESRGAN GUI.app' is in Downloads directory." +echo "INFO: 💬 Please manually drag 'Real-ESRGAN GUI.app' to Applications directory to finish install."