<commit_before>#!/bin/bash

set -e -x

function build_wheel {
    local pyver=$1
    local arch=$2
    local ucs_setting=$3

    # https://www.python.org/dev/peps/pep-0513/#ucs-2-vs-ucs-4-builds
    ucs_tag="m"
    if [ "$pyver" = "3.8"  || "$pyver" = "3.9" ]; then
        ucs_tag=""
    elif [ "$ucs_setting" = "ucs4" ]; then
        ucs_tag="${ucs_tag}u"
    fi

    ML_PYTHON_VERSION=$(python -c \
        "print('cp{maj}{min}-cp{maj}{min}{ucs}'.format( \
               maj='${pyver}'.split('.')[0], \
	       min='${pyver}'.split('.')[1], \
	       ucs='${ucs_tag}'))")

    DOCKER_CONTAINER_NAME=wheel_builder_$(uuidgen)

    # Pin this image because wheel versions in later tags conflict
    ML_IMAGE="quay.io/pypa/manylinux1_${arch}:2020-01-31-d8fa357"
    PMDARIMA_VERSION=`cat ~/pmdarima/pmdarima/VERSION`

    docker pull "${ML_IMAGE}"
    # -v "${_root}":/io \
    docker run \
        --name "${DOCKER_CONTAINER_NAME}" \
        -v `pwd`:/io \
        -e "PYMODULE=pmdarima" \
        -e "PYTHON_VERSION=${ML_PYTHON_VERSION}" \
        -e "PMDARIMA_VERSION=${PMDARIMA_VERSION}" \
        "${ML_IMAGE}" "/io/build_tools/circle/build_manylinux_wheel.sh"
    sudo docker cp "${DOCKER_CONTAINER_NAME}:/io/dist/." "${_root}/dist/"
    docker rm $(docker ps -a -f status=exited -q)
}

# Guarantee we have the VERSION file before continuing
if [[ ! -f ~/pmdarima/pmdarima/VERSION ]]; then
    echo "VERSION file was not created as expected"
    ls -la
    exit 2
fi

# Create base directory
pushd $(dirname $0) > /dev/null
_root=$(dirname $(dirname $(pwd -P))) # get one directory up from parent to get to root dir
popd > /dev/null

echo "Building LINUX OS wheels"
<commit_msg>[MRG+1] Fix bash syntax and update manylinux container (#422)<commit_after>#!/bin/bash

set -e -x

function build_wheel {
    local pyver=$1
    local arch=$2
    local ucs_setting=$3

    # https://www.python.org/dev/peps/pep-0513/#ucs-2-vs-ucs-4-builds
    ucs_tag="m"
    if [ "$pyver" = "3.8" ] || [ "$pyver" = "3.9" ]; then
        ucs_tag=""
    elif [ "$ucs_setting" = "ucs4" ]; then
        ucs_tag="${ucs_tag}u"
    fi

    ML_PYTHON_VERSION=$(python -c \
        "print('cp{maj}{min}-cp{maj}{min}{ucs}'.format( \
               maj='${pyver}'.split('.')[0], \
	       min='${pyver}'.split('.')[1], \
	       ucs='${ucs_tag}'))")

    DOCKER_CONTAINER_NAME=wheel_builder_$(uuidgen)

    ML_IMAGE="quay.io/pypa/manylinux1_${arch}:2021-04-10-43e4a61" # `latest` as of 2021-04-18
    PMDARIMA_VERSION=`cat ~/pmdarima/pmdarima/VERSION`

    docker pull "${ML_IMAGE}"
    # -v "${_root}":/io \
    docker run \
        --name "${DOCKER_CONTAINER_NAME}" \
        -v `pwd`:/io \
        -e "PYMODULE=pmdarima" \
        -e "PYTHON_VERSION=${ML_PYTHON_VERSION}" \
        -e "PMDARIMA_VERSION=${PMDARIMA_VERSION}" \
        "${ML_IMAGE}" "/io/build_tools/circle/build_manylinux_wheel.sh"
    sudo docker cp "${DOCKER_CONTAINER_NAME}:/io/dist/." "${_root}/dist/"
    docker rm $(docker ps -a -f status=exited -q)
}

# Guarantee we have the VERSION file before continuing
if [[ ! -f ~/pmdarima/pmdarima/VERSION ]]; then
    echo "VERSION file was not created as expected"
    ls -la
    exit 2
fi

# Create base directory
pushd $(dirname $0) > /dev/null
_root=$(dirname $(dirname $(pwd -P))) # get one directory up from parent to get to root dir
popd > /dev/null

echo "Building LINUX OS wheels"

{'fraction_non_alphanumeric': 0.1757396449704142, 'fraction_numerical': 0.022189349112426034, 'mean_word_length': 2.8074324324324325, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7567941', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1303, 'n_words': 268}