68 lines
1.5 KiB
Batchfile
68 lines
1.5 KiB
Batchfile
@echo Off
|
||
setlocal EnableDelayedExpansion
|
||
|
||
echo.
|
||
echo ===========================================
|
||
echo 检查编译环境
|
||
echo ===========================================
|
||
echo.
|
||
|
||
cd /d "%~dp0"
|
||
|
||
python --version
|
||
if ERRORLEVEL 1 goto :PythonCommandError
|
||
goto :CommandBuild
|
||
|
||
|
||
:PythonCommandError
|
||
for /f "delims=" %%i in ('REG.EXE QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath" /VE ') do set InstallDir=%%i
|
||
if "%InstallDir%" == "" goto :PythonInstallError
|
||
set InstallDir=%InstallDir:~22%
|
||
if not exist %InstallDir% goto :PythonInstallError
|
||
goto :PathBuild
|
||
|
||
:CommandBuild
|
||
python PackTools\APKTools.py %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||
if ERRORLEVEL 1 goto :Fail
|
||
if ERRORLEVEL 2 goto :Success
|
||
goto :Common
|
||
|
||
:PathBuild
|
||
"%InstallDir%\python.exe" PackTools\APKTools.py %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||
if ERRORLEVEL 1 goto :Fail
|
||
if ERRORLEVEL 2 goto :Success
|
||
goto :Common
|
||
|
||
|
||
:ColorTheStr
|
||
>"%~2" set /p=<nul&findstr /a:%1 .* "%~2*"&del "%~2*" &&set /p=<EFBFBD><nul
|
||
echo.
|
||
goto :eof
|
||
|
||
:PythonInstallError
|
||
echo.
|
||
echo.
|
||
call :ColorTheStr 0C "==========================================="
|
||
call :ColorTheStr 0C " 编译错误,Python2.7未安装"
|
||
call :ColorTheStr 0C " 请安装Python2.7"
|
||
call :ColorTheStr 0C "==========================================="
|
||
echo.
|
||
goto :Fail
|
||
|
||
:Fail
|
||
echo.
|
||
call :ColorTheStr 0C "编译失败"
|
||
echo.
|
||
goto :Exit
|
||
|
||
|
||
:Success
|
||
echo.
|
||
call :ColorTheStr 02 "编译成功"
|
||
echo.
|
||
goto :Exit
|
||
|
||
:Common
|
||
goto :Exit
|
||
|
||
:Exit |