From fdb44d401198b93ab4ea01a0dd687ec213ed0402 Mon Sep 17 00:00:00 2001 From: Kevin Thompson Date: Sun, 10 Aug 2025 13:21:08 -0500 Subject: [PATCH] pyinstaller doesn't get installed to Windows PATH, so we need to find it --- windows/build_windows.bat | 133 ++++++++++++++++++++++++++++++++------ 1 file changed, 112 insertions(+), 21 deletions(-) diff --git a/windows/build_windows.bat b/windows/build_windows.bat index 339bbcd..f5bf930 100644 --- a/windows/build_windows.bat +++ b/windows/build_windows.bat @@ -5,53 +5,144 @@ echo YouTube Channel Archiver - Windows Build Script echo ================================================================ echo. -echo [1/5] Checking Python installation... +echo [STEP 1] Checking Python installation... python --version > nul 2>&1 if errorlevel 1 ( echo ERROR: Python is not installed or not in PATH + echo. echo Please install Python from https://python.org + echo Make sure to check "Add Python to PATH" during installation + echo. pause exit /b 1 ) -python --version + +for /f "tokens=2" %%i in ('python --version 2^>^&1') do set PYTHON_VERSION=%%i +echo SUCCESS: Python %PYTHON_VERSION% is installed echo. -echo [2/5] Installing/updating build dependencies... -python -m pip install --upgrade pip -python -m pip install pyinstaller +echo [STEP 2] Checking PyInstaller installation... +python -c "import PyInstaller" > nul 2>&1 +if errorlevel 1 ( + echo PyInstaller not found. Installing now... + echo. + echo [STEP 2a] Updating pip... + python -m pip install --upgrade pip + + echo. + echo [STEP 2b] Installing PyInstaller... + python -m pip install pyinstaller + + echo. + echo [STEP 2c] Verifying PyInstaller installation... + python -c "import PyInstaller; print('PyInstaller version:', PyInstaller.__version__)" + if errorlevel 1 ( + echo ERROR: PyInstaller installation failed + pause + exit /b 1 + ) + echo SUCCESS: PyInstaller installed successfully +) else ( + echo SUCCESS: PyInstaller is already installed + python -c "import PyInstaller; print('PyInstaller version:', PyInstaller.__version__)" +) echo. -echo [3/5] Creating executable with PyInstaller... -pyinstaller --onefile --windowed --name "YouTubeChannelArchiver" --distpath dist --workpath build youtube_archiver_standalone.py +echo [STEP 3] Checking for source file... +if not exist "youtube_archiver_standalone.py" ( + echo ERROR: youtube_archiver_standalone.py not found in current directory + echo Current directory: %CD% + echo. + echo Files in current directory: + dir *.py + echo. + echo Please make sure the Python script is in the same folder as this batch file + pause + exit /b 1 +) echo. -echo [4/5] Testing the executable... +echo [STEP 4] Building executable with PyInstaller... +echo Command: python -m PyInstaller --onefile --windowed --name "YouTubeChannelArchiver" --distpath dist --workpath build --clean youtube_archiver_standalone.py +echo. + +REM Use python -m PyInstaller instead of direct pyinstaller command +python -m PyInstaller --onefile --windowed --name "YouTubeChannelArchiver" --distpath dist --workpath build --clean youtube_archiver_standalone.py + +echo. +echo [STEP 5] Verifying build... if exist "dist\YouTubeChannelArchiver.exe" ( - echo SUCCESS: Executable created at dist\YouTubeChannelArchiver.exe + echo SUCCESS: Executable created successfully! + echo Location: %CD%\dist\YouTubeChannelArchiver.exe + + REM Get file size + for %%A in ("dist\YouTubeChannelArchiver.exe") do ( + set "filesize=%%~zA" + ) + echo File size: %filesize% bytes + + echo. + echo [STEP 6] Creating portable package... + if not exist "portable" mkdir portable + copy "dist\YouTubeChannelArchiver.exe" "portable\" > nul + if exist "README.txt" copy "README.txt" "portable\" > nul + if exist "LICENSE.txt" copy "LICENSE.txt" "portable\" > nul + echo Portable version created in 'portable' folder + ) else ( echo ERROR: Executable was not created + echo. + echo Checking for build errors in the output above... + echo Common issues: + echo - Missing dependencies + echo - Antivirus blocking the build + echo - Insufficient disk space + echo - Path issues with special characters + echo. + echo Build files location: + if exist "build" ( + echo Build directory exists: %CD%\build + ) else ( + echo Build directory not found + ) + + if exist "dist" ( + echo Dist directory exists: %CD%\dist + echo Contents of dist directory: + dir dist + ) else ( + echo Dist directory not found + ) + pause exit /b 1 ) -echo. -echo [5/5] Creating portable package... -if not exist "portable" mkdir portable -copy "dist\YouTubeChannelArchiver.exe" "portable\" -echo Portable version created in 'portable' folder - echo. echo ================================================================ echo BUILD COMPLETED SUCCESSFULLY! echo ================================================================ echo. echo Files created: -echo - dist\YouTubeChannelArchiver.exe (main executable) +echo - dist\YouTubeChannelArchiver.exe (main executable - %filesize% bytes) echo - portable\YouTubeChannelArchiver.exe (portable version) echo. -echo You can now: -echo 1. Test the executable by running it -echo 2. Distribute the portable folder -echo 3. Create an installer using the Inno Setup script below +echo Architecture info: +python -c "import platform; print('Python architecture:', platform.architecture()[0])" +python -c "import platform; print('Machine type:', platform.machine())" + echo. -pause +echo Next steps: +echo 1. Test the executable: dist\YouTubeChannelArchiver.exe +echo 2. Distribute the portable folder, or +echo 3. Create an installer using installer.iss with Inno Setup +echo. +echo Press any key to open the dist folder... +pause > nul + +REM Try to open the folder +if exist "dist\YouTubeChannelArchiver.exe" ( + explorer dist +) else ( + echo Could not open folder automatically +)