Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TransparentLC committed Nov 2, 2023
2 parents 97131ed + 6899bd3 commit 575b25c
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions macos-build-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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."

0 comments on commit 575b25c

Please sign in to comment.