78 lines
2.3 KiB
Batchfile
78 lines
2.3 KiB
Batchfile
@echo off
|
|
setlocal
|
|
set distro=fspecs
|
|
cd /d "%~dp0"
|
|
|
|
:arch
|
|
echo 1) 32-bit (recommended)
|
|
echo 2) 64-bit
|
|
set /p arch=
|
|
echo.
|
|
if not "%arch%" == "1" if not "%arch%" == "2" goto arch
|
|
|
|
if exist "%cd%\dist" (
|
|
echo deleting old dist...
|
|
rmdir /s /q "%cd%\dist"
|
|
if not "%errorlevel%" == "0" echo something went wrong while deleting old dist & goto error
|
|
)
|
|
|
|
if not exist "%cd%\python34" (
|
|
echo.
|
|
echo downloading python 3.4.4...
|
|
if "%arch%" == "1" curl https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi -o python-3.4.4.msi
|
|
if "%arch%" == "2" curl https://www.python.org/ftp/python/3.4.4/python-3.4.4.amd64.msi -o python-3.4.4.msi
|
|
if not "%errorlevel%" == "0" echo something went wrong while downloading python & goto error
|
|
|
|
echo.
|
|
echo extracting python 3.4.4...
|
|
start /wait msiexec /a "%cd%\python-3.4.4.msi" /qb targetdir="%cd%\python34"
|
|
if not "%errorlevel%" == "0" echo something went wrong while extracting python & goto error
|
|
del "%cd%\python-3.4.4.msi"
|
|
)
|
|
|
|
REM set path
|
|
set path=%cd%\python34;%path%
|
|
|
|
REM check version
|
|
python.exe --version | find /i "3.4.4" >nul
|
|
if not "%errorlevel%" == "0" echo something went wrong while setting the path (wrong version) & goto error
|
|
|
|
echo.
|
|
echo installing prerequisites...
|
|
python.exe -c "import ensurepip;ensurepip.bootstrap()"
|
|
if not "%errorlevel%" == "0" echo something went wrong while installing a prerequisite & goto error
|
|
python.exe -m pip install "pefile==2019.4.18"
|
|
if not "%errorlevel%" == "0" echo something went wrong while installing a prerequisite & goto error
|
|
python.exe -m pip install "PyInstaller==3.4"
|
|
if not "%errorlevel%" == "0" echo something went wrong while installing a prerequisite & goto error
|
|
python.exe -m pip install "colorama==0.3.5"
|
|
if not "%errorlevel%" == "0" echo something went wrong while installing a prerequisite & goto error
|
|
|
|
echo.
|
|
echo compiling script...
|
|
python.exe -m PyInstaller "%cd%\%distro%.py" --onefile
|
|
if not "%errorlevel%" == "0" echo something went wrong while compiling a script & goto error
|
|
|
|
echo.
|
|
echo copying config files...
|
|
copy "%cd%\%distro%.ini" "%cd%\dist"
|
|
copy "%cd%\%distro%.ascii-*" "%cd%\dist"
|
|
|
|
echo.
|
|
echo cleaning up...
|
|
rmdir /s /q "%cd%\build"
|
|
rmdir /s /q "%cd%\__pycache__"
|
|
del %distro%.spec
|
|
|
|
REM done
|
|
echo.
|
|
echo done.
|
|
echo you can find the EXEs in dist\
|
|
pause
|
|
goto exit
|
|
|
|
:error
|
|
pause
|
|
goto exit
|
|
|
|
:exit |