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