Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Stackless build script

By: a guest on Feb 1st, 2013  |  syntax: DOS  |  size: 4.33 KB  |  views: 39  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @ECHO off
  2.  
  3. REM This should generate the following:
  4. REM - The MSI installer.
  5. REM - The "published binaries".
  6. REM - The HTML documentation zip archive.
  7. REM If RELEASE is NO, then it will choke on all but the building.
  8.  
  9. REM In order to get the published binaries to work correctly at the end:
  10. REM - Open up visual studio.
  11. REM - Do a debug build.
  12. REM - Add GOTO MAKEPUBLISHEDBINARIES after the if .. () statement below
  13. REM TODO: Add another step to do this automatically before the publish binary step?
  14.  
  15. SET RELEASE=YES
  16. SET PY_VERSION=3.2.2
  17. SET PY_VERSIONX=322
  18. SET PYTHON=c:\python27\python.exe
  19. SET HTMLHELP=C:\Program Files (x86)\HTML Help Workshop\hhc.exe
  20. SET SEVENZIP=C:\Program Files\7-Zip\7z.exe
  21. REM This needs to be here because the ssl compilation is broken without it.
  22. SET PERL=c:\Perl\bin\perl.exe
  23.  
  24. SET OLDDIR=%CD%
  25. SET PYDIR=%1
  26. IF %PYDIR%X==X GOTO NOPYDIR
  27. IF NOT EXIST %PYDIR% GOTO NOPYDIR
  28.  
  29. SET SCRIPTDIR=Tools\buildbot
  30. SET MSIDIR=Tools\msi
  31. SET SCRIPT_BUILDX86=%SCRIPTDIR%\build.bat
  32. SET SCRIPT_EXTERNALX86=%SCRIPTDIR%\external.bat
  33. SET SCRIPT_BUILDAMD64=%SCRIPTDIR%\build-amd64.bat
  34. SET SCRIPT_EXTERNALAMD64=%SCRIPTDIR%\external-amd64.bat
  35.  
  36. CD %PYDIR%
  37. IF NOT EXIST %SCRIPT_BUILDX86% GOTO NOBUILDSCRIPT
  38.  
  39. hg revert --no-backup %SCRIPTDIR%
  40. FOR /F "tokens=2* delims=_=" %%A IN ('SET SCRIPT_') DO (
  41.     ECHO Processing: %%B
  42.         REM CONVERT DEFAULT BUILD TO RELEASE
  43.         IF %RELEASE%X==YESX (
  44.                 %PYTHON% -c "f=open(r'%%B', 'r');s=f.read();s=s.replace('DEBUG=1','');s=s.replace('Debug|','Release|');f.close();f=open(r'%%B', 'w');f.write(s);f.close()"
  45.         )
  46. )
  47.  
  48. REM DEBUGGING SHORTCUTS:
  49. REM GOTO MAKEPUBLISHEDBINARIES
  50.  
  51. echo **** Building.
  52. cmd /c %SCRIPT_BUILDX86%
  53.  
  54. :BUILDINSTALLER
  55. echo **** Generating documentation.
  56. set DOCDIR=Doc
  57. cd %DOCDIR%
  58. cmd /c make.bat checkout
  59. cmd /c make.bat html
  60. rem Generate zip HTML documentation.
  61. set BASEFILENAME=%OLDDIR%\stackless-python-%PY_VERSION%-docs-html
  62. del %BASEFILENAME%.zip
  63. "%SEVENZIP%" a -r %BASEFILENAME%.zip html
  64. %PYTHON% %OLDDIR%\gensum.py %BASEFILENAME%.zip
  65. rem Generate tbz HTML documentation.
  66. del %BASEFILENAME%.tar
  67. "%SEVENZIP%" a -r %BASEFILENAME%.tar html
  68. "%SEVENZIP%" a %BASEFILENAME%.tar.bz2 %BASEFILENAME%.tar
  69. del %BASEFILENAME%.tar
  70. %PYTHON% %OLDDIR%\gensum.py %BASEFILENAME%.tar.bz2
  71. cmd /c make.bat htmlhelp
  72. copy build\htmlhelp\python%PY_VERSIONX%.chm %OLDDIR%\python%PY_VERSIONX%sl.chm
  73. %PYTHON% %OLDDIR%\gensum.py %OLDDIR%\python%PY_VERSIONX%sl.chm
  74. cd ..
  75.  
  76. echo **** Generating installer.
  77. SET PCDIR=PC
  78. cd %PCDIR%
  79. nmake -f icons.mak
  80. cd ..
  81.  
  82. echo Making dummy tix folder: %OLDDIR%\tix-nothere
  83. IF EXIST %OLDDIR%\tix-nothere GOTO MAKEINSTALLER
  84. mkdir %OLDDIR%\tix-nothere7
  85. echo > %OLDDIR%\tix-nothere\license.terms
  86.  
  87. :MAKEINSTALLER
  88. hg revert --no-backup %MSIDIR%
  89. cd %MSIDIR%
  90. %PYTHON% -c "f=open(r'msi.py', 'r');s=f.read();s=s.replace('snapshot = 1','snapshot = 0');s=s.replace('tcl8*','tcl-8*');s=s.replace('tk8*','tk-8*');fcv=\"%PY_VERSION%\".strip();s=s.replace('full_current_version = None','full_current_version = \"'+fcv+'\"');s=s.replace('.msi'+chr(34), '-stackless.msi'+chr(34));f.close();f=open(r'msi.py', 'w');f.write(s);f.close()"
  91. nmake -f msisupport.mak
  92. %PYTHON% msi.py
  93. copy python-%PY_VERSION%-stackless.msi %OLDDIR%\
  94. %PYTHON% %OLDDIR%\gensum.py %OLDDIR%\python-%PY_VERSION%-stackless.msi
  95. copy python-%PY_VERSION%-pdb.zip %OLDDIR%\python-%PY_VERSION%-pdb-stackless.zip
  96. %PYTHON% %OLDDIR%\gensum.py %OLDDIR%\python-%PY_VERSION%-pdb-stackless.zip
  97. cd ..\..
  98. REM GOTO DONE
  99.  
  100. :MAKEPUBLISHEDBINARIES
  101. set PCBUILDDIR=PCbuild
  102. cd %PCBUILDDIR%
  103. hg revert --no-backup publish_binaries.py
  104. %PYTHON% -c "f=open(r'publish_binaries.py', 'r');s=f.read();f.close();Mmv=\"%PY_VERSIONX%\".strip();s=s.replace('python30','python'+Mmv[:2]);s=s.replace('stackless-python-30','stackless-python-'+Mmv);f=open(r'publish_binaries.py', 'w');f.write(s);f.close()"
  105. python.exe publish_binaries.py
  106. copy stackless-python-%PY_VERSIONX%.zip %OLDDIR%\
  107. %PYTHON% %OLDDIR%\gensum.py %OLDDIR%\stackless-python-%PY_VERSIONX%.zip
  108. cd ..
  109.  
  110. echo "%SEVENZIP%" a Python.tar *.zip *.py *.bz2 *.msi *.chm
  111. echo pscp Python.tar root@stackless.com:/var/www/stackless/binaries/incoming/
  112.  
  113. :CLEANUP
  114. cd %OLDDIR%
  115. hg revert --no-backup %PYDIR%\%SCRIPTDIR%
  116. hg revert --no-backup %PYDIR%\%MSIDIR%
  117. GOTO DONE
  118.  
  119. :NOBUILDSCRIPT
  120. ECHO Python directory not recognised: "%1"
  121. GOTO CLEANUP
  122.  
  123. :NOPYDIR
  124. ECHO No such Python directory: "%1"
  125.  
  126. :DONE
clone this paste RAW Paste Data