2020# DD_TRACE_COMMIT Specific dd-trace-py commit SHA to build from GitHub.
2121# DD_TRACE_COMMIT_BRANCH dd-trace-py branch name to build from GitHub.
2222# DD_TRACE_WHEEL Path to a pre-built ddtrace .whl file.
23+ # PIN_SETUPTOOLS Set to "true" to constrain setuptools<78 in Docker.
24+ # Only needed for old dd-trace-py commits that import pkg_resources.
2325#
2426# Examples:
2527# # Build a single layer for Python 3.12 on arm64
@@ -92,6 +94,7 @@ replace_ddtrace_dep() {
9294}
9395
9496# Replace ddtrace source if necessary
97+ DOCKER_BUILD_ARGS=" "
9598if [ -n " $DD_TRACE_COMMIT " ]; then
9699 replace_ddtrace_dep " ddtrace = { git = \" https://github.com/DataDog/dd-trace-py.git\" , rev = \" $DD_TRACE_COMMIT \" }"
97100elif [ -n " $DD_TRACE_COMMIT_BRANCH " ]; then
@@ -100,6 +103,12 @@ elif [ -n "$DD_TRACE_WHEEL" ]; then
100103 replace_ddtrace_dep " ddtrace = { file = \" $DD_TRACE_WHEEL \" }"
101104fi
102105
106+ # Older dd-trace-py commits import pkg_resources, which was removed in setuptools>=78.
107+ # Set PIN_SETUPTOOLS=true to constrain setuptools<78 in pip's build isolation.
108+ if [ -n " $PIN_SETUPTOOLS " ]; then
109+ DOCKER_BUILD_ARGS=" --build-arg pin_setuptools=true"
110+ fi
111+
103112function make_path_absolute {
104113 echo " $( cd " $( dirname " $1 " ) " ; pwd) /$( basename " $1 " ) "
105114}
@@ -118,6 +127,7 @@ function docker_build_zip {
118127 --build-arg runtime=python$1 \
119128 --platform linux/${arch} \
120129 --progress=plain \
130+ $DOCKER_BUILD_ARGS \
121131 -o $temp_dir /python
122132
123133 # Zip to destination, and keep directory structure as based in $temp_dir
0 commit comments