@@ -35,7 +35,12 @@ set -e
3535
3636LAYER_DIR=" .layers"
3737LAYER_FILES_PREFIX=" datadog_lambda_py"
38- AVAILABLE_PYTHON_VERSIONS=(" 3.8" " 3.9" " 3.10" " 3.11" " 3.12" " 3.13" " 3.14" " 3.15" )
38+ AVAILABLE_PYTHON_VERSIONS=(" 3.8" " 3.9" " 3.10" " 3.11" " 3.12" " 3.13" " 3.14" )
39+ # Preview runtimes. AWS has not published a SAM build image for these, so the
40+ # Lambda preview base image is used instead. The Dockerfile installs the
41+ # compiler toolchain that image is missing.
42+ PREVIEW_PYTHON_VERSIONS=(" 3.15" )
43+ ALL_PYTHON_VERSIONS=(" ${AVAILABLE_PYTHON_VERSIONS[@]} " " ${PREVIEW_PYTHON_VERSIONS[@]} " )
3944AVAILABLE_ARCHS=(" arm64" " amd64" )
4045
4146if [ -n " $ARCH " ]; then
6974# Determine which Python versions to build layers for
7075if [ -z " $PYTHON_VERSION " ]; then
7176 echo " Python version not specified, building layers for all versions."
72- PYTHON_VERSIONS=(" ${AVAILABLE_PYTHON_VERSIONS [@]} " )
77+ PYTHON_VERSIONS=(" ${ALL_PYTHON_VERSIONS [@]} " )
7378else
7479 echo " Python version specified: $PYTHON_VERSION "
75- if [[ ! " ${AVAILABLE_PYTHON_VERSIONS [@]} " =~ " ${PYTHON_VERSION} " ]]; then
76- echo " Python version $PYTHON_VERSION is not a valid option. Choose from: ${AVAILABLE_PYTHON_VERSIONS [@]} "
80+ if [[ ! " ${ALL_PYTHON_VERSIONS [@]} " =~ " ${PYTHON_VERSION} " ]]; then
81+ echo " Python version $PYTHON_VERSION is not a valid option. Choose from: ${ALL_PYTHON_VERSIONS [@]} "
7782 echo " "
7883 echo " EXITING SCRIPT."
7984 exit 1
@@ -103,13 +108,11 @@ function docker_build_zip {
103108
104109 destination=$( make_path_absolute $2 )
105110 arch=$3
106- # Python 3.15 is a Lambda preview runtime. AWS has not published
107- # public.ecr.aws/sam/build-python3.15, so use the preview base image.
108- # The Dockerfile installs the compiler toolchain that image is missing.
109- if [ " $1 " = " 3.15" ]; then
110- image=" public.ecr.aws/lambda/python:3.15-preview"
111+ # Preview runtimes have no SAM build image yet. See PREVIEW_PYTHON_VERSIONS.
112+ if [[ " ${PREVIEW_PYTHON_VERSIONS[*]} " =~ " ${1} " ]]; then
113+ image=" public.ecr.aws/lambda/python:${1} -preview"
111114 else
112- image=" public.ecr.aws/sam/build-python$1 :1"
115+ image=" public.ecr.aws/sam/build-python${1} :1"
113116 fi
114117 # Install datadogpy in a docker container to avoid the mess from switching
115118 # between different python runtimes.
0 commit comments