Imported Upstream version 3.8.0
[platform/upstream/protobuf.git] / kokoro / release / python / linux / config.sh
1 # Define custom utilities
2 # Test for OSX with [ -n "$IS_OSX" ]
3
4 function pre_build {
5     # Any stuff that you need to do before you start building the wheels
6     # Runs in the root directory of this repository.
7     pushd protobuf
8
9     yum install -y devtoolset-2-libatomic-devel
10
11     # Build protoc
12     ./autogen.sh
13     ./configure
14
15     CXXFLAGS="-fPIC -g -O2" ./configure
16     make -j8
17
18     # Generate python dependencies.
19     pushd python
20     python setup.py build_py
21     popd
22
23     popd
24 }
25
26 function bdist_wheel_cmd {
27     # Builds wheel with bdist_wheel, puts into wheelhouse
28     #
29     # It may sometimes be useful to use bdist_wheel for the wheel building
30     # process.  For example, versioneer has problems with versions which are
31     # fixed with bdist_wheel:
32     # https://github.com/warner/python-versioneer/issues/121
33     local abs_wheelhouse=$1
34
35     # Modify build version
36     pwd
37     ls
38     python setup.py bdist_wheel --cpp_implementation --compile_static_extension
39     cp dist/*.whl $abs_wheelhouse
40 }
41
42 function build_wheel {
43     build_wheel_cmd "bdist_wheel_cmd" $@
44 }
45
46 function run_tests {
47     # Runs tests on installed distribution from an empty directory
48     python --version
49     python -c "from google.protobuf.pyext import _message;"
50 }