|
| 1 | +@echo off |
| 2 | + |
| 3 | +if "%1"=="" goto usage |
| 4 | +if "%2"=="" goto usage |
| 5 | + |
| 6 | +set platform=%1 |
| 7 | +set version=%2 |
| 8 | + |
| 9 | +set success=0 |
| 10 | +if "%platform%"=="win32" set success=1 |
| 11 | +if "%platform%"=="win-amd64" set success=1 |
| 12 | +if %success% neq 1 ( |
| 13 | + echo [build_all.bat] ERROR: invalid platform. Allowed: win32, win-amd64. |
| 14 | + goto usage |
| 15 | +) |
| 16 | + |
| 17 | +echo [build_all.bat] PLATFORM: %platform% |
| 18 | +echo [build_all.bat] VERSION: %version% |
| 19 | + |
| 20 | +set DISABLE_INNO_SETUP=0 |
| 21 | + |
| 22 | +echo.%*|findstr /C:"--disable-inno-setup" >nul 2>&1 |
| 23 | +if %errorlevel% equ 0 ( |
| 24 | + set DISABLE_INNO_SETUP=1 |
| 25 | +) |
| 26 | + |
| 27 | +:: Clean directories from previous run |
| 28 | +rm -rf Output/ |
| 29 | +rm -rf cefpython3-*-setup/ |
| 30 | +rm -rf dist/ |
| 31 | + |
| 32 | +mkdir dist |
| 33 | + |
| 34 | +echo [build_all.bat] Installing setuptools and wheel |
| 35 | +pip install setuptools wheel |
| 36 | +if %errorlevel% neq 0 ( |
| 37 | + echo [build_all.bat] ERROR: pip install setuptools wheel |
| 38 | + exit /B 1 |
| 39 | +) |
| 40 | + |
| 41 | +if %DISABLE_INNO_SETUP% equ 0 ( |
| 42 | + echo [build_all.bat] Creating Inno Setup intaller |
| 43 | + python make-installer.py -v %version% |
| 44 | + if %errorlevel% equ 0 ( |
| 45 | + mv Output/*.exe dist/ |
| 46 | + if %errorlevel% neq 0 ( |
| 47 | + echo [build_all.bat] ERROR: moving inno setup installer failed |
| 48 | + exit /B 1 |
| 49 | + ) |
| 50 | + rmdir Output |
| 51 | + if %errorlevel% neq 0 ( |
| 52 | + echo [build_all.bat] ERROR: deleting Output/ directory failed |
| 53 | + exit /B 1 |
| 54 | + ) |
| 55 | + ) else if %errorlevel% neq 0 ( |
| 56 | + echo [build_all.bat] ERROR: creating Inno Setup installer failed |
| 57 | + exit /B 1 |
| 58 | + ) |
| 59 | +) |
| 60 | + |
| 61 | +echo [build_all.bat] Creating Distutils setup |
| 62 | +python make-setup.py -v %version% |
| 63 | +if %errorlevel% neq 0 ( |
| 64 | + echo [build_all.bat] ERROR: creating Distutils setup |
| 65 | + exit /B 1 |
| 66 | +) |
| 67 | + |
| 68 | +:: Enter the setup directory |
| 69 | +cd cefpython3-*-setup/ |
| 70 | + |
| 71 | +echo [build_all.bat] Creating Distutils source package |
| 72 | +python setup.py sdist |
| 73 | +if %errorlevel% neq 0 ( |
| 74 | + echo [build_all.bat] ERROR: creating Distutils source package |
| 75 | + exit /B 1 |
| 76 | +) |
| 77 | + |
| 78 | +echo [build_all.bat] Creating Python Egg |
| 79 | +python setup.py bdist_egg |
| 80 | +if %errorlevel% neq 0 ( |
| 81 | + echo [build_all.bat] ERROR: creating Python Egg failed |
| 82 | + exit /B 1 |
| 83 | +) |
| 84 | + |
| 85 | +echo [build_all.bat] Creating Python Wheel |
| 86 | +python setup.py bdist_wheel |
| 87 | +if %errorlevel% neq 0 ( |
| 88 | + echo [build_all.bat] ERROR: creating Python Wheel failed |
| 89 | + exit /B 1 |
| 90 | +) |
| 91 | + |
| 92 | +echo [build_all.bat] Creating MSI installer |
| 93 | +python setup.py bdist_msi |
| 94 | +if %errorlevel% neq 0 ( |
| 95 | + echo [build_all.bat] ERROR: creating MSI installer failed |
| 96 | + exit /B 1 |
| 97 | +) |
| 98 | + |
| 99 | +echo [build_all.bat] Creating EXE installer |
| 100 | +python setup.py bdist_wininst |
| 101 | +if %errorlevel% neq 0 ( |
| 102 | + echo [build_all.bat] ERROR: creating EXE installer failed |
| 103 | + exit /B 1 |
| 104 | +) |
| 105 | + |
| 106 | +echo [build_all.bat] Moving all packages to the dist/ directory |
| 107 | +mv dist/* ../dist/ |
| 108 | +if %errorlevel% neq 0 ( |
| 109 | + echo [build_all.bat] ERROR: moving packages failed |
| 110 | + exit /B 1 |
| 111 | +) |
| 112 | + |
| 113 | +:: Up to the installer/ directory |
| 114 | +cd ../ |
| 115 | + |
| 116 | +echo [build_all.bat] Deleting the Distutils setup directory |
| 117 | +rm -rf cefpython3-*-setup/ |
| 118 | +if %errorlevel% neq 0 ( |
| 119 | + echo [build_all.bat] ERROR: failed deleting the Distutils setup directory |
| 120 | + exit /B 1 |
| 121 | +) |
| 122 | + |
| 123 | +cd dist/ |
| 124 | + |
| 125 | +echo [build_all.bat] Renaming some of the packages to include platform tag |
| 126 | +setlocal ENABLEDELAYEDEXPANSION |
| 127 | +for /R %%i in (*) do ( |
| 128 | + set oldfile=%%i |
| 129 | + set newfile=!oldfile:.egg=-%platform%.egg! |
| 130 | + if "!oldfile!" neq "!newfile!" ( |
| 131 | + mv !oldfile! !newfile! |
| 132 | + ) |
| 133 | + set oldfile=%%i |
| 134 | + set newfile=!oldfile:.zip=-%platform%.zip! |
| 135 | + if "!oldfile!" neq "!newfile!" ( |
| 136 | + mv !oldfile! !newfile! |
| 137 | + ) |
| 138 | +) |
| 139 | +endlocal |
| 140 | + |
| 141 | +echo [build_all.bat] Packages in the dist/ directory: |
| 142 | +dir |
| 143 | + |
| 144 | +echo OK |
| 145 | + |
| 146 | +goto :eof |
| 147 | +:usage |
| 148 | +@echo [build_all.bat] ERROR: platform or version arguments missing or invalid |
| 149 | +@echo [build_all.bat] ERROR: example usage: build_all.bat win32 31.2 |
| 150 | +exit /B 1 |
0 commit comments