comparison packaging/wine-py2exe @ 669:30ae339d7224

py2exe packaging
author Neil Muller <drnlmuller@gmail.com>
date Sun, 08 Sep 2013 17:47:25 +0200
parents
children
comparison
equal deleted inserted replaced
668:700ebab5240a 669:30ae339d7224
1 #!/bin/sh
2 # wine-py2exe
3 #
4 # Usage: wine-py2exe
5
6 WS_VERSION=`sed -nre 's/VERSION_STR = "(.*)"/\1/p' setup.py`
7 BUILD_FOLDER="nagslang-${WS_VERSION}"
8 ZIP_NAME="${BUILD_FOLDER}.zip"
9 PY2EXE_LOG="py2exe.log"
10
11 WINE_PYTHON=`winepath "C:/Python27"`
12 WINE_SYS32=`winepath "C:/windows/system32"`
13
14 #
15 # Run py2exe build under wine
16 #
17
18 echo "=== Running wine python setup.py ==="
19 echo ""
20 echo " Werewolf Sonata version: ${WS_VERSION}"
21 echo " Writing log to ${PY2EXE_LOG}."
22 echo ""
23 echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
24 echo " WARNING: After running please fix the nagslang.exe"
25 echo " checksum and executable size using PETools!"
26 echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
27 echo ""
28
29 rm -rf "dist/${BUILD_FOLDER}"
30 mkdir -p "dist/${BUILD_FOLDER}"
31 rm -rf "dist/${ZIP_NAME}"
32
33 wine python setup.py py2exe >${PY2EXE_LOG} 2>&1
34
35 #
36 # Copy dependencies py2exe missed
37 #
38
39 echo "=== Copying dependencies that py2exe missed ==="
40 echo ""
41
42 DEST="dist/${BUILD_FOLDER}"
43
44 cp -v "${WINE_SYS32}/python27.dll" "${DEST}"
45
46 echo "'data' -> '${DEST}/data'"
47 hg archive -I "path:data/" "${DEST}"
48
49 echo "'${WINE_PYTHON}/Lib/site-packages/pygame' -> '${DEST}'"
50 rm -rf "${DEST}/pygame"
51 cp -R "${WINE_PYTHON}/Lib/site-packages/pygame" "${DEST}"
52 echo "'${WINE_PYTHON}/Lib/site-packages/pymunk' -> '${DEST}'"
53 rm -rf "${DEST}/pymunk"
54 cp -R "${WINE_PYTHON}/Lib/site-packages/pymunk" "${DEST}"
55 # Needed so we'll find it when running
56 cp -R "${WINE_PYTHON}/Lib/site-packages/pymunk/chipmunk.dll" "${DEST}"
57 rm -rf "${DEST}/pygame/examples" "${DEST}/pygame/tests" "${DEST}/pygame/docs"
58
59 #
60 # create zip file
61 #
62
63 echo "=== Creating zip of patched py2exe dist folder ==="
64 echo ""
65 echo " Zip file: dist/${ZIP_NAME}"
66 echo " Build folder: dist/${BUILD_FOLDER}"
67 echo ""
68
69 cd dist
70 rm -f "$ZIP_NAME"
71 zip -r -q "$ZIP_NAME" "$BUILD_FOLDER"
72 cd ..
73
74 echo "=== Done ==="
75 echo ""
76 echo -n " "; du -sh dist/${ZIP_NAME}
77 echo -n " "; du -sh dist/${BUILD_FOLDER}
78 echo ""