|
19 | 19 | # |
20 | 20 | # The script obeys the following required environment variables: |
21 | 21 | # TF_BUILD_CONTAINER_TYPE: (CPU | GPU | ANDROID | ANDROID_FULL) |
22 | | -# TF_BUILD_PYTHON_VERSION: (PYTHON2 | PYTHON3) |
| 22 | +# TF_BUILD_PYTHON_VERSION: (PYTHON2 | PYTHON3 | PYTHON3.5) |
23 | 23 | # TF_BUILD_IS_PIP: (NO_PIP | PIP | BOTH) |
24 | 24 | # |
25 | 25 | # The below environment variable is required, but will be deprecated together |
|
33 | 33 | # ANDROID & PIP (Android and PIP builds are mutually exclusive) |
34 | 34 | # |
35 | 35 | # 2) TF_BUILD_PYTHON_VERSION is set to PYTHON3, the build will use the version |
36 | | -# pointed to by "which python3" on the system. |
| 36 | +# pointed to by "which python3" on the system, which is typically python3.4. To |
| 37 | +# build for python3.5, set the environment variable to PYTHON3.5 |
37 | 38 | # |
38 | 39 | # |
39 | 40 | # Additionally, the script follows the directions of optional environment |
|
419 | 420 | # Process Python version |
420 | 421 | if [[ ${TF_BUILD_PYTHON_VERSION} == "python2" ]]; then |
421 | 422 | : |
422 | | -elif [[ ${TF_BUILD_PYTHON_VERSION} == "python3" ]]; then |
| 423 | +elif [[ ${TF_BUILD_PYTHON_VERSION} == "python3" || \ |
| 424 | + ${TF_BUILD_PYTHON_VERSION} == "python3.4" || \ |
| 425 | + ${TF_BUILD_PYTHON_VERSION} == "python3.5" ]]; then |
423 | 426 | # Supply proper environment variable to select Python 3 |
424 | 427 | if [[ "${DO_DOCKER}" == "1" ]]; then |
425 | 428 | EXTRA_PARAMS="${EXTRA_PARAMS} -e CI_BUILD_PYTHON=${TF_BUILD_PYTHON_VERSION}" |
@@ -486,6 +489,30 @@ echo "" |
486 | 489 |
|
487 | 490 | TMP_DIR="" |
488 | 491 | DOCKERFILE_FLAG="" |
| 492 | +if [[ "${TF_BUILD_PYTHON_VERSION}" == "python3.5" ]]; then |
| 493 | + # Modify Dockerfile for Python3.5 build |
| 494 | + TMP_DIR=$(mktemp -d) |
| 495 | + echo "Docker build will occur in temporary directory: ${TMP_DIR}" |
| 496 | + |
| 497 | + # Copy the files required for the docker build |
| 498 | + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 499 | + cp -r "${SCRIPT_DIR}/install" "${TMP_DIR}/install" || \ |
| 500 | + die "ERROR: Failed to copy directory ${SCRIPT_DIR}/install" |
| 501 | + |
| 502 | + DOCKERFILE="${SCRIPT_DIR}/Dockerfile.${TF_BUILD_CONTAINER_TYPE}" |
| 503 | + cp "${DOCKERFILE}" "${TMP_DIR}/" || \ |
| 504 | + die "ERROR: Failed to copy Dockerfile at ${DOCKERFILE}" |
| 505 | + DOCKERFILE="${TMP_DIR}/Dockerfile.${TF_BUILD_CONTAINER_TYPE}" |
| 506 | + |
| 507 | + # Replace a line in the Dockerfile |
| 508 | + sed -i \ |
| 509 | + 's/RUN \/install\/install_pip_packages.sh/RUN \/install\/install_python3.5_pip_packages.sh/g' \ |
| 510 | + "${DOCKERFILE}" && \ |
| 511 | + echo "Copied and modified Dockerfile for Python 3.5 build: ${DOCKERFILE}" || \ |
| 512 | + die "ERROR: Faild to copy and modify Dockerfile: ${DOCKERFILE}" |
| 513 | + |
| 514 | + DOCKERFILE_FLAG="--dockerfile ${DOCKERFILE}" |
| 515 | +fi |
489 | 516 |
|
490 | 517 | chmod +x ${TMP_SCRIPT} |
491 | 518 |
|
|
0 commit comments