96 lines
2.6 KiB
Bash
Executable File
96 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build script for EBoek.info Scraper executable
|
|
# Run this script to compile the application into a standalone executable
|
|
|
|
echo "====================================="
|
|
echo "Building EBoek.info Scraper"
|
|
echo "====================================="
|
|
echo
|
|
|
|
# Check if PyInstaller is installed
|
|
python3 -c "import PyInstaller" 2>/dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "Installing PyInstaller..."
|
|
python3 -m pip install pyinstaller
|
|
echo
|
|
fi
|
|
|
|
# Clean previous builds
|
|
if [ -d "dist" ]; then
|
|
rm -rf "dist"
|
|
fi
|
|
if [ -d "build" ]; then
|
|
rm -rf "build"
|
|
fi
|
|
echo "Cleaned previous builds"
|
|
echo
|
|
|
|
# Option 1: Quick build (single file executable)
|
|
echo "Building single-file executable..."
|
|
echo "This may take a few minutes..."
|
|
echo
|
|
|
|
python3 -m PyInstaller --onefile --windowed --name "EBoek_Scraper" \
|
|
--hidden-import "PyQt5.QtCore" \
|
|
--hidden-import "PyQt5.QtGui" \
|
|
--hidden-import "PyQt5.QtWidgets" \
|
|
--hidden-import "selenium" \
|
|
--hidden-import "selenium.webdriver" \
|
|
--hidden-import "selenium.webdriver.chrome" \
|
|
--hidden-import "core.scraper" \
|
|
--hidden-import "core.scraper_thread" \
|
|
--hidden-import "core.credentials" \
|
|
--hidden-import "gui.main_window" \
|
|
--hidden-import "gui.login_dialog" \
|
|
--hidden-import "gui.progress_dialog" \
|
|
--hidden-import "utils.validators" \
|
|
--exclude-module "tkinter" \
|
|
--exclude-module "matplotlib" \
|
|
../gui_main.py
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo
|
|
echo "BUILD FAILED! Trying alternative method..."
|
|
echo
|
|
|
|
# Option 2: Use spec file
|
|
echo "Building with spec file..."
|
|
python3 -m PyInstaller eboek_scraper.spec
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo "BUILD FAILED!"
|
|
echo "Please check the error messages above."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo
|
|
echo "====================================="
|
|
echo "BUILD SUCCESSFUL!"
|
|
echo "====================================="
|
|
echo
|
|
|
|
# Check which executable was created
|
|
if [ -f "dist/EBoek_Scraper" ]; then
|
|
EXECUTABLE="dist/EBoek_Scraper"
|
|
echo "Your executable is located at: $EXECUTABLE"
|
|
echo
|
|
echo "File size: $(du -h "$EXECUTABLE" | cut -f1)"
|
|
echo
|
|
echo "To run: ./$EXECUTABLE"
|
|
elif [ -f "dist/EBoek_Scraper.exe" ]; then
|
|
EXECUTABLE="dist/EBoek_Scraper.exe"
|
|
echo "Your executable is located at: $EXECUTABLE"
|
|
echo
|
|
echo "File size: $(du -h "$EXECUTABLE" | cut -f1)"
|
|
echo
|
|
echo "To run: ./$EXECUTABLE"
|
|
else
|
|
echo "Error: Could not find built executable!"
|
|
exit 1
|
|
fi
|
|
|
|
echo
|
|
echo "You can now distribute this single file!"
|
|
echo "Note: macOS may show a security warning on first run."
|
|
echo "Right-click and select 'Open' to bypass Gatekeeper." |