You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

  1. #!/bin/bash
  2. # Run with as parameter a setup.py that works in the current directory
  3. # e.g. no os.chdir()
  4. # It will run twice, the first time will crash
  5. set -e
  6. SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
  7. if [ ! -d wine-py2exe ]; then
  8. sudo apt-get install wine1.3 axel bsdiff
  9. mkdir wine-py2exe
  10. cd wine-py2exe
  11. export WINEPREFIX=`pwd`
  12. axel -a "http://www.python.org/ftp/python/2.7/python-2.7.msi"
  13. axel -a "http://downloads.sourceforge.net/project/py2exe/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe"
  14. #axel -a "http://winetricks.org/winetricks"
  15. # http://appdb.winehq.org/objectManager.php?sClass=version&iId=21957
  16. echo "Follow python setup on screen"
  17. wine msiexec /i python-2.7.msi
  18. echo "Follow py2exe setup on screen"
  19. wine py2exe-0.6.9.win32-py2.7.exe
  20. #echo "Follow Microsoft Visual C++ 2008 Redistributable Package setup on screen"
  21. #bash winetricks vcrun2008
  22. rm py2exe-0.6.9.win32-py2.7.exe
  23. rm python-2.7.msi
  24. #rm winetricks
  25. # http://bugs.winehq.org/show_bug.cgi?id=3591
  26. mv drive_c/Python27/Lib/site-packages/py2exe/run.exe drive_c/Python27/Lib/site-packages/py2exe/run.exe.backup
  27. bspatch drive_c/Python27/Lib/site-packages/py2exe/run.exe.backup drive_c/Python27/Lib/site-packages/py2exe/run.exe "$SCRIPT_DIR/SizeOfImage.patch"
  28. mv drive_c/Python27/Lib/site-packages/py2exe/run_w.exe drive_c/Python27/Lib/site-packages/py2exe/run_w.exe.backup
  29. bspatch drive_c/Python27/Lib/site-packages/py2exe/run_w.exe.backup drive_c/Python27/Lib/site-packages/py2exe/run_w.exe "$SCRIPT_DIR/SizeOfImage_w.patch"
  30. cd -
  31. else
  32. export WINEPREFIX="$( cd wine-py2exe && pwd )"
  33. fi
  34. wine "C:\\Python27\\python.exe" "$1" py2exe > "py2exe.log" 2>&1 || true
  35. echo '# Copying python27.dll' >> "py2exe.log"
  36. cp "$WINEPREFIX/drive_c/windows/system32/python27.dll" build/bdist.win32/winexe/bundle-2.7/
  37. wine "C:\\Python27\\python.exe" "$1" py2exe >> "py2exe.log" 2>&1