Repository navigation
Expand file tree
/
Copy pathchevahbs
More file actions
executable file
·207 lines (183 loc) · 8.92 KB
/
Copy pathchevahbs
File metadata and controls
executable file
·207 lines (183 loc) · 8.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#!/usr/bin/env bash
#
# Chevah Build Script for Python.
#
# Import shared code.
. ./functions.sh
PIP_ARGS="\
-i http://pypi.chevah.com/simple \
--trusted-host=pypi.chevah.com \
"
PIP_INSTALLABLES_WIN="\
pypiwin32==219 \
pycrypto==2.6.1 \
cryptography==1.3 \
pyOpenSSL==16.0.0 \
"
chevahbs_configure() {
CONFIG_ARGS="--disable-shared"
CONFIGURE_ENVIRONMENT=""
case $OS in
"ubuntu1004")
# On Ubuntu there are no libXXX.o, but rather linked against the
# full version number.
CONFIG_ARGS="${CONFIG_ARGS} \
--with-bz2-version=1 \
--with-crypt-version=1 \
--with-openssl-version=0.9.8 \
"
;;
"ubuntu1204")
CONFIG_ARGS="${CONFIG_ARGS} \
--with-bz2-version=1 \
--with-crypt-version=1 \
--with-openssl-version=1.0.0 \
"
;;
aix*)
# In AIX we build _ctypes with external libffi, but not the system
# one. We use our libffi files and statically link against its libs.
execute mkdir -p build/libffi
execute cp $INSTALL_FOLDER/tmp/libffi/* build/libffi/
# The following two parameters are picked up by Python's setup.py
# and will convince it to use our external libffi for _ctypes.
export CPPFLAGS="${CPPFLAGS} -Ibuild/libffi/"
export LDFLAGS="${LDFLAGS} -Lbuild/libffi/"
# Workaround for http://bugs.python.org/issue21917
echo "import os; os.__dict__.pop('O_NOFOLLOW', None)" \
>> Lib/site-packages/sitecustomize.py
# These files are already created in the Python distribution,
# but for some strange reason, make tries to recreate them.
# We just touch them so that make will see them up to date.
touch Include/Python-ast.h Python/Python-ast.c
# MAXMEM option with a value greater than 8192.
CONFIG_ARGS="${CONFIG_ARGS} \
--with-system-ffi \
"
;;
solaris10)
# In Solaris 10, the default OpenSSL is installed in /usr/sfw/.
# Both include options are needed to match both the native Sun
# Studio compiler and GCC.
if [ "${ARCH%64}" = "$ARCH" ]; then
echo "_ssl _ssl.c -I/usr/sfw/include" \
"-I/usr/sfw/include/openssl -L/usr/sfw/lib" \
"-R/usr/sfw/lib -lssl -lcrypto" >> Modules/Setup.local
else
echo "_ssl _ssl.c -I/usr/sfw/include" \
"-I/usr/sfw/include/openssl -L/usr/sfw/lib/64" \
"-R/usr/sfw/lib/64 -lssl -lcrypto" >> Modules/Setup.local
fi
;;
hpux*)
export EXTRA_CFLAGS="-D_REENTRANT"
export LIBS="-lpthread"
CONFIG_ARGS="${CONFIG_ARGS} --without-gcc --without-ctypes"
;;
osx*)
CONFIG_ARGS="${CONFIG_ARGS} --without-gcc"
;;
esac
case $OS in
windows)
echo "Skip configure on Windows."
;;
*)
execute ./configure --prefix="" $CONFIG_ARGS
;;
esac
case $OS in
"hpux")
cp Makefile Makefile.orig
# On HPUX -DNDEBUG is causing troubles.
sed "s/^OPT=.*-O/OPT= -O/" Makefile.orig > Makefile
;;
esac
}
chevahbs_compile() {
case $OS in
windows)
echo "Skip make on Windows."
;;
*)
execute $MAKE
;;
esac
}
chevahbs_install() {
install_folder=$1
case $OS in
windows)
local destination=$INSTALL_FOLDER/lib
local redistributables=../../win-tools/redistributables/
local redistributable_version=9.00.30729.6161
local manifest_wiper=../../win-tools/manifest-wiper.exe
local get_pip=../../python-modules/get-pip.py
# On Windows we don't build from source but rather create the
# distribution from pre-compiled binaries.
current_win_path=`pwd -W | sed 's|\/|\\\\|g'`
install_win_path=`cd $INSTALL_FOLDER && pwd -W | sed 's|\/|\\\\|g'`
echo "Extracting MSI to $install_win_path"
execute msiexec \
//a $current_win_path\\python-installer.msi \
//qn TARGETDIR=$install_win_path\\lib
echo "Copying redistributables"
execute cp $redistributables/$redistributable_version/* $destination
echo "Extracting manifests for python(w).exe and python27.dll"
$manifest_wiper --verbose \
--extract $destination/python.exe.embedded \
$destination/python.exe
$manifest_wiper --verbose \
--extract $destination/pythonw.exe.embedded \
$destination/pythonw.exe
$manifest_wiper --verbose \
--extract $destination/python27.dll.embedded \
$destination/python27.dll
echo "Patching manifests to use our redistributable version"
execute sed -e 's|version="9.0.21022.8"|version="9.00.30729.6161"|' -e 's|publicKeyToken="1fc8b3b9a1e18e3b"||' < $destination/python.exe.embedded > $destination/python.exe.manifest
execute sed -e 's|version="9.0.21022.8"|version="9.00.30729.6161"|' -e 's|publicKeyToken="1fc8b3b9a1e18e3b"||' < $destination/pythonw.exe.embedded > $destination/pythonw.exe.manifest
execute sed -e 's|version="9.0.21022.8"|version="9.00.30729.6161"|' -e 's|publicKeyToken="1fc8b3b9a1e18e3b"||' < $destination/python27.dll.embedded > $destination/python27.dll.manifest
execute rm -f --verbose $destination/*.embedded
echo "Installing pip + binary modules"
execute $destination/python $get_pip $PIP_ARGS
execute $destination/python -m pip \
install $PIP_ARGS $PIP_INSTALLABLES_WIN
# Remove pip.
execute $destination/python -m pip uninstall -y pip
echo "Patching pyWin32 manifests to use our redistributable version"
$manifest_wiper --verbose \
--extract $destination/Lib/site-packages/win32/pythonservice.exe.embedded \
$destination/Lib/site-packages/win32/pythonservice.exe
$manifest_wiper --verbose \
--extract $destination/Lib/site-packages/win32/perfmondata.dll.embedded \
$destination/Lib/site-packages/win32/perfmondata.dll
$manifest_wiper --verbose \
--extract $destination/Lib/site-packages/pywin32_system32/pythoncomloader27.dll.embedded \
$destination/Lib/site-packages/pywin32_system32/pythoncomloader27.dll
execute sed -e 's|version="9.0.21022.8"|version="9.00.30729.6161"|' -e 's|publicKeyToken="1fc8b3b9a1e18e3b"||' < $destination/Lib/site-packages/win32/pythonservice.exe.embedded > $destination/Lib/site-packages/win32/pythonservice.exe.manifest
execute sed -e 's|version="9.0.21022.8"|version="9.00.30729.6161"|' -e 's|publicKeyToken="1fc8b3b9a1e18e3b"||' < $destination/Lib/site-packages/win32/perfmondata.dll.embedded > $destination/Lib/site-packages/win32/perfmondata.dll.manifest
execute rm -f --verbose $desination/Lib/site-packages/win32/*.embedded
execute sed -e 's|version="9.0.21022.8"|version="9.00.30729.6161"|' -e 's|publicKeyToken="1fc8b3b9a1e18e3b"||' < $destination/Lib/site-packages/pywin32_system32/pythoncomloader27.dll.embedded > $destination/Lib/site-packages/pywin32_system32/pythoncomloader27.dll.manifest
execute rm -f --verbose $desination/Lib/site-packages/pywin32_system32/*.embedded
echo "Copy Python runtime to pyWin32 package"
execute cp $destination/*CRT.manifest $destination/Lib/site-packages/win32/
execute cp $destination/python27.dll.manifest $destination/Lib/site-packages/win32/
execute cp $destination/python27.dll $destination/Lib/site-packages/win32/
execute cp $destination/msvc?90.dll $destination/Lib/site-packages/win32/
execute cp $destination/Lib/site-packages/pywin32_system32/*.dll $destination/Lib/site-packages/win32/
# Remove Python MSI installer.
echo "Removing: $destination/python-installer.msi"
execute rm -f --verbose $destination/python-installer.msi
# add cp65001 as an utf-8 alias.
execute mv \
$destination/lib/encodings/aliases.py \
$destination/lib/encodings/aliases.old
execute \
sed "s|# utf_8 codec|# utf_8 codec\n 'cp65001' : 'utf_8',|" < $destination/lib/encodings/aliases.old > $destination/lib/encodings/aliases.py
;;
*)
execute $MAKE install DESTDIR=$INSTALL_FOLDER
;;
esac
}
select_chevahbs_command $@