PageRenderTime 61ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/bleachbit-0.8.7/windows/setup_py2exe.bat

#
Batch | 131 lines | 91 code | 23 blank | 17 comment | 32 complexity | 5ff726c876bffdd42247fa09ba9765ed MD5 | raw file
Possible License(s): GPL-3.0
  1. @echo off
  2. REM BleachBit
  3. REM Copyright (C) 2009 Andrew Ziem
  4. REM http://bleachbit.sourceforge.net
  5. REM
  6. REM This program is free software: you can redistribute it and/or modify
  7. REM it under the terms of the GNU General Public License as published by
  8. REM the Free Software Foundation, either version 3 of the License, or
  9. REM (at your option) any later version.
  10. REM
  11. REM This program is distributed in the hope that it will be useful,
  12. REM but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. REM GNU General Public License for more details.
  15. REM
  16. REM You should have received a copy of the GNU General Public License
  17. REM along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. set GTK_DIR=c:\gtk
  19. set NSIS_EXE="c:\program files\nsis\makensis.exe"
  20. if not exist c:\python27 goto py25
  21. set PYTHON_DIR=c:\python27
  22. set PYTHON_VER=27
  23. goto after_py
  24. :py25
  25. set PYTHON_DIR=c:\python25
  26. set PYTHON_VER=25
  27. :after_py
  28. set SZ_EXE="C:\Program Files\7-Zip\7z.exe"
  29. set UPX_EXE=upx
  30. set UPX_OPTS=--best --crp-ms=999999 --nrv2e
  31. echo Checking for translations
  32. set CANARY=locale
  33. if not exist %CANARY% goto error
  34. echo Checking for GTK
  35. set CANARY=%GTK_DIR%
  36. if not exist %CANARY% goto error
  37. echo Deleting directories build and dist
  38. del /q /s build > nul
  39. del /q /s dist > nul
  40. echo Pre-compressing executables
  41. if not "%1" == "fast" for /r %PYTHON_DIR% %%e in (*.pyd) do %UPX_EXE% %UPX_OPTS% "%%e"
  42. if not "%1" == "fast" for /r %GTK_DIR% %%e in (*.exe,*.dll) do %UPX_EXE% %UPX_OPTS% "%%e"
  43. REM do not pre-compress python25.dll because py2exe modifies it
  44. if not "%1" == "fast" %UPX_EXE% %UPX_OPTS% %windir%\system32\pywintypes%PYTHON_VER%.dll
  45. echo Running py2exe
  46. copy bleachbit.py bleachbit_console.py
  47. %PYTHON_DIR%\python.exe -OO setup.py py2exe
  48. del bleachbit_console.py
  49. set CANARY=dist\bleachbit.exe
  50. if not exist %CANARY% goto error
  51. echo Copying GTK files and icon
  52. copy %GTK_DIR%\bin\intl.dll dist
  53. mkdir dist\etc
  54. xcopy %GTK_DIR%\etc dist\etc /i /s /q
  55. mkdir dist\lib
  56. xcopy %GTK_DIR%\lib dist\lib /i /s /q
  57. mkdir dist\share
  58. copy bleachbit.png dist\share\
  59. xcopy %GTK_DIR%\share dist\share /i /s /q
  60. echo Compressing executables
  61. if not "%1" == "fast" for /r dist %%e in (*.pyd,*.dll,*.exe) do %UPX_EXE% "%%e" %UPX_OPTS%
  62. echo Purging unnecessary GTK+ files
  63. %PYTHON_DIR%\python.exe setup.py clean-dist
  64. echo Copying BleachBit localizations
  65. xcopy locale dist\share\locale /i /s /q
  66. set CANARY=dist\share\locale\es\LC_MESSAGES\bleachbit.mo
  67. if not exist %CANARY% goto error
  68. echo Copying BleachBit cleaners
  69. xcopy cleaners\*xml dist\share\cleaners\ /i /s /q
  70. echo Checking for CleanerML
  71. set CANARY=dist\share\cleaners\internet_explorer.xml
  72. if not exist %CANARY% goto error
  73. echo Checking for Linux-only cleaners
  74. if exist dist\share\cleaners\wine.xml echo "grep -l os=.linux. dist/share/cleaners/*xml | xargs rm -f"
  75. if exist dist\share\cleaners\wine.xml pause
  76. echo Recompressing library.zip with 7-Zip
  77. if "%1" == "fast" goto nsis
  78. if not exist %SZ_EXE% echo %SZ_EXE% does not exist
  79. if not exist %SZ_EXE% goto nsis
  80. cd dist
  81. mkdir library
  82. cd library
  83. %SZ_EXE% x ..\library.zip
  84. echo "Size before 7zip recompression
  85. dir ..\library.zip
  86. del ..\library.zip
  87. %SZ_EXE% a -tzip -mx=9 -mfb=255 ..\library.zip
  88. echo "Size after 7zip recompression
  89. dir ..\library.zip
  90. cd ..\..
  91. rd /s /q dist\library
  92. set CANARY=dist\library.zip
  93. if not exist %CANARY% goto error
  94. echo Building portable
  95. rd /s /q BleachBit-portable
  96. xcopy /e /i dist BleachBit-Portable
  97. echo [Portable] > BleachBit-Portable\BleachBit.ini
  98. %SZ_EXE% a -mx=9 -md=32m BleachBit-0.0.0-portable.zip BleachBit-portable
  99. :nsis
  100. echo Building installer
  101. if "%1" == "fast" %NSIS_EXE% /X"SetCompressor /FINAL zlib" windows\bleachbit.nsi
  102. if not "%1" == "fast" %NSIS_EXE% windows\bleachbit.nsi
  103. echo Success!
  104. goto exit
  105. :error
  106. echo %CANARY% not found
  107. echo Process aborted because of error!
  108. :exit