#!/bin/bash # From: https://github.com/pypa/python-manylinux-demo/blob/master/travis/build-wheels.sh # which is in the public domain. # # This is run inside a CentOS 5 virtual machine to build manylinux wheels: # # $ docker run -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/ci/build_manylinux.sh # set -e -x global action := $1 if [[ $action == "build" ]] { # Compile wheels cd /io for PYBIN in [/opt/python/*/bin] { "$PYBIN/pip" install -r requirements/wheel.pip "$PYBIN/python" setup.py bdist_wheel -d ~/wheelhouse/ } cd ~ # Bundle external shared libraries into the wheels for whl in [wheelhouse/*.whl] { auditwheel repair $whl -w /io/dist/ } } elif [[ $action == "test" ]] { # Install packages and test global TOXBIN := '/opt/python/cp27-cp27m/bin' "$TOXBIN/pip" install -r /io/requirements/ci.pip for PYBIN in [/opt/python/*/bin/] { global PYNAME := $["$PYBIN/python" -c "import sys; print('python{0[0]}.{0[1]}'.format(sys.version_info))] global TOXENV := $["$PYBIN/python" -c "import sys; print('py{0[0]}{0[1]}'.format(sys.version_info))] ln -s "$PYBIN/$PYNAME" /usr/local/bin/$PYNAME "$TOXBIN/tox" -e $TOXENV rm -f /usr/local/bin/$PYNAME #"${PYBIN}/pip" install python-manylinux-demo --no-index -f /io/dist #(cd "$HOME"; "${PYBIN}/nosetests" pymanylinuxdemo) } } else { echo "Need an action to perform!" } (CommandList children: [ (C {(set)} {(-e)} {(-x)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:action) op:Equal rhs:{($ VSub_Number "$1")} spids:[32])] spids: [32] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$action")} right: {(DQ (build))} ) ) terminator: ) ] action: [ (C {(cd)} {(/io)}) (ForEach iter_name: PYBIN iter_words: [{(/opt/python/) (Lit_Other "*") (/bin)}] do_arg_iter: False body: (DoGroup children: [ (C {(DQ ($ VSub_Name "$PYBIN") (/pip))} {(install)} {(-r)} {(requirements/wheel.pip)}) (C {(DQ ($ VSub_Name "$PYBIN") (/python))} {(setup.py)} {(bdist_wheel)} {(-d)} {(TildeSubPart prefix:"") (/wheelhouse/)} ) ] spids: [74 104] ) spids: [68 72] ) (C {(cd)} {(TildeSubPart prefix:"")}) (ForEach iter_name: whl iter_words: [{(wheelhouse/) (Lit_Other "*") (.whl)}] do_arg_iter: False body: (DoGroup children: [ (C {(auditwheel)} {(repair)} {(DQ ($ VSub_Name "$whl"))} {(-w)} {(/io/dist/)}) ] spids: [128 144] ) spids: [122 126] ) ] spids: [-1 51] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$action")} right: {(DQ (test))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TOXBIN) op: Equal rhs: {(/opt/python/cp27-cp27m/bin)} spids: [169] ) ] spids: [169] ) (C {(DQ ($ VSub_Name "$TOXBIN") (/pip))} {(install)} {(-r)} {(/io/requirements/ci.pip)}) (ForEach iter_name: PYBIN iter_words: [{(/opt/python/) (Lit_Other "*") (/bin/)}] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PYNAME) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(DQ ($ VSub_Name "$PYBIN") (/python))} {(-c)} { (DQ ( "import sys; print('python{0[0]}.{0[1]}'.format(sys.version_info))" ) ) } ) ] ) left_token: spids: [201 212] ) } spids: [200] ) ] spids: [200] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TOXENV) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(DQ ($ VSub_Name "$PYBIN") (/python))} {(-c)} { (DQ ( "import sys; print('py{0[0]}{0[1]}'.format(sys.version_info))" ) ) } ) ] ) left_token: spids: [216 227] ) } spids: [215] ) ] spids: [215] ) (C {(ln)} {(-s)} {(DQ ($ VSub_Name "$PYBIN") (/) ($ VSub_Name "$PYNAME"))} {(/usr/local/bin/) ($ VSub_Name "$PYNAME")} ) (C {(DQ ($ VSub_Name "$TOXBIN") (/tox))} {(-e)} {($ VSub_Name "$TOXENV")}) (C {(rm)} {(-f)} {(/usr/local/bin/) ($ VSub_Name "$PYNAME")}) ] spids: [197 270] ) spids: [191 195] ) ] spids: [147 162] ) ] else_action: [(C {(echo)} {(DQ ("Need an action to perform!"))})] spids: [273 282] ) ] )