]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | function getpyver { | |
4 | if [ "$1" = "15" ]; then | |
5 | PYVER=1.5 | |
6 | elif [ "$1" = "20" ]; then | |
7 | PYVER=2.0 | |
8 | elif [ "$1" = "21" ]; then | |
9 | PYVER=2.1 | |
10 | elif [ "$1" = "22" ]; then | |
11 | PYVER=2.2 | |
12 | else | |
13 | echo You must specify Python version as first parameter. | |
14 | exit | |
15 | fi | |
16 | } | |
17 | ||
18 | getpyver $1 | |
19 | shift | |
20 | ||
21 | python$PYVER -c "import sys;print '\n', sys.version, '\n'" | |
22 | ||
23 | ||
24 | SETUP="python$PYVER -u setup.py" | |
25 | FLAGS="USE_SWIG=1 IN_CVS_TREE=1" # BUILD_GLCANVAS=0" | |
26 | OTHERFLAGS="" | |
27 | ||
28 | ||
29 | ||
30 | # "c" --> clean | |
31 | if [ "$1" = "c" ]; then | |
32 | shift | |
33 | CMD="$SETUP $FLAGS $OTHERFLAGS clean" | |
34 | OTHERCMD="rm -f wxPython/*.so" | |
35 | ||
36 | # "d" --> clean extension modules only | |
37 | elif [ "$1" = "d" ]; then | |
38 | shift | |
39 | CMD="rm -f wxPython/*.so" | |
40 | ||
41 | # "t" --> touch *.i files | |
42 | elif [ "$1" = "t" ]; then | |
43 | shift | |
44 | #CMD="set CMD=touch src\*.i; touch contrib\glcanvas\*.i; touch contrib\ogl\*.i; touch contrib\stc\*.i" | |
45 | CMD='find . -name "*.i" | xargs -l touch' | |
46 | ||
47 | # "i" --> install | |
48 | elif [ "$1" = "i" ]; then | |
49 | shift | |
50 | CMD="$SETUP build $OTHERFLAGS install" | |
51 | ||
52 | # "s" --> source dist | |
53 | elif [ "$1" = "s" ]; then | |
54 | shift | |
55 | CMD="$SETUP $OTHERFLAGS sdist" | |
56 | ||
57 | # "r" --> rpm dist | |
58 | elif [ "$1" = "r" ]; then | |
59 | WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"` | |
60 | for VER in 15 20 21; do | |
61 | getpyver $VER | |
62 | ||
63 | echo "*****************************************************************" | |
64 | echo "******* Building wxPython for Python $PYVER" | |
65 | echo "*****************************************************************" | |
66 | ||
67 | # NOTE: This assumes that /usr/local/bin is BEFORE /usr/bin on the PATH | |
68 | # AND that you have write access to it. | |
69 | rm -f /usr/local/bin/python | |
70 | ln -s /usr/bin/python$PYVER /usr/local/bin/python | |
71 | SETUP="/usr/local/bin/python -u setup.py" | |
72 | ||
73 | # save the original | |
74 | cp setup.py setup.py.save | |
75 | ||
76 | # fix up setup.py the way we want... | |
77 | sed "s/BUILD_GLCANVAS = /BUILD_GLCANVAS = 0 #/" < setup.py.save > setup.py.temp | |
78 | sed "s/GL_ONLY = /GL_ONLY = 1 #/" < setup.py.temp > setup.py | |
79 | ||
80 | # build wxPython-gl RPM | |
81 | $SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt | |
82 | rm dist/wxPython-gl*.tar.gz | |
83 | ||
84 | # Build wxPython RPM | |
85 | cp setup.py setup.py.temp | |
86 | sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py | |
87 | $SETUP $OTHERFLAGS bdist_rpm --binary-only | |
88 | ||
89 | # put the oringal setup.py back | |
90 | cp setup.py.save setup.py | |
91 | rm setup.py.* | |
92 | ||
93 | # rename the binary RPM's | |
94 | mv dist/wxPython-$WXPYVER-1.i386.rpm dist/wxPython-$WXPYVER-1-Py$VER.i386.rpm | |
95 | mv dist/wxPython-gl-$WXPYVER-1.i386.rpm dist/wxPython-gl-$WXPYVER-1-Py$VER.i386.rpm | |
96 | ||
97 | done | |
98 | # rebuild the source dists without the munched up setup.py | |
99 | $SETUP $OTHERFLAGS sdist | |
100 | $SETUP $OTHERFLAGS bdist_rpm --source-only | |
101 | exit 0 | |
102 | ||
103 | ||
104 | # "f" --> FINAL (no debug) | |
105 | elif [ "$1" = "f" ]; then | |
106 | shift | |
107 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*" | |
108 | ||
109 | # (no command arg) --> normal build for development | |
110 | else | |
111 | CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*" | |
112 | fi | |
113 | ||
114 | ||
115 | echo $CMD | |
116 | eval $CMD | |
117 | ||
118 | ||
119 | if [ "$OTHERCMD" != "" ]; then | |
120 | echo $OTHERCMD | |
121 | $OTHERCMD | |
122 | fi | |
123 |