autobuild.bat 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. @echo Off
  2. setlocal EnableDelayedExpansion
  3. echo.
  4. echo ===========================================
  5. echo 检查编译环境
  6. echo ===========================================
  7. echo.
  8. cd /d "%~dp0"
  9. python --version
  10. if ERRORLEVEL 1 goto :PythonCommandError
  11. goto :CommandBuild
  12. :PythonCommandError
  13. for /f "delims=" %%i in ('REG.EXE QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath" /VE ') do set InstallDir=%%i
  14. if "%InstallDir%" == "" goto :PythonInstallError
  15. set InstallDir=%InstallDir:~22%
  16. if not exist %InstallDir% goto :PythonInstallError
  17. goto :PathBuild
  18. :CommandBuild
  19. python PackTools\PackTools.py %1 %2 %3 %4 %5 %6 %7 %8 %9
  20. if ERRORLEVEL 1 goto :Fail
  21. if ERRORLEVEL 2 goto :Success
  22. goto :Common
  23. :PathBuild
  24. "%InstallDir%\python.exe" PackTools\PackTools.py %1 %2 %3 %4 %5 %6 %7 %8 %9
  25. if ERRORLEVEL 1 goto :Fail
  26. if ERRORLEVEL 2 goto :Success
  27. goto :Common
  28. :ColorTheStr
  29. >"%~2" set /p=<nul&findstr /a:%1 .* "%~2*"&del "%~2*" &&set /p=�<nul
  30. echo.
  31. goto :eof
  32. :PythonInstallError
  33. echo.
  34. echo.
  35. call :ColorTheStr 0C "==========================================="
  36. call :ColorTheStr 0C "     编译错误,Python2.7未安装"
  37. call :ColorTheStr 0C " 请安装Python2.7"
  38. call :ColorTheStr 0C "==========================================="
  39. echo.
  40. goto :Fail
  41. :Fail
  42. echo.
  43. call :ColorTheStr 0C "编译失败"
  44. echo.
  45. goto :Exit
  46. :Success
  47. echo.
  48. call :ColorTheStr 02 "编译成功"
  49. echo.
  50. goto :Exit
  51. :Common
  52. goto :Exit
  53. :Exit