Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ RUN PYTHONNODEBUGRANGES=1 python -OO -m compileall -b ./python/lib/$runtime/site
# DEV: ddtrace>=4.7.0rc3 checks for .pyc files in addition to .py files for instrumentation
# discovery (DataDog/dd-trace-py#17196), so we can safely remove all .py files.
# For older versions, we need to keep patch.py files for instrumentation discovery.
# Wheels from dd-trace-py CI built with DD_SERVERLESS_BUILD=1 install as the
# ddtrace_serverless distribution, so read the version from either dist-info.
# Without it the version check fails and every contrib patch.py (~700 kB) stays.
RUN pip install --quiet packaging && \
DDTRACE_VERSION=$(grep "^Version:" ./python/lib/$runtime/site-packages/ddtrace-*.dist-info/METADATA | awk '{print $2}') && \
DDTRACE_VERSION=$(cat ./python/lib/$runtime/site-packages/ddtrace-*.dist-info/METADATA \
./python/lib/$runtime/site-packages/ddtrace_serverless-*.dist-info/METADATA 2>/dev/null \
| grep -m1 "^Version:" | awk '{print $2}') && \
echo "Detected ddtrace version: ${DDTRACE_VERSION:-unknown}" && \
if python -c "from packaging.version import Version; exit(0 if Version('$DDTRACE_VERSION') >= Version('4.7.0rc3') else 1)"; then \
find ./python/lib/$runtime/site-packages -name \*.py | xargs rm -rf; \
else \
Expand Down
Loading