Skip to content

Commit f313c46

Browse files
authored
ci: fix ddtrace version detection (#764)
1 parent ea8d015 commit f313c46

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ RUN rm -rf \
6363
# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONNODEBUGRANGES
6464
RUN PYTHONNODEBUGRANGES=1 python -OO -m compileall -b ./python/lib/$runtime/site-packages
6565
# remove all .py files
66-
# DEV: ddtrace>=4.7.0rc4 checks for .pyc files in addition to .py files for instrumentation
66+
# DEV: ddtrace>=4.7.0rc3 checks for .pyc files in addition to .py files for instrumentation
6767
# discovery (DataDog/dd-trace-py#17196), so we can safely remove all .py files.
6868
# For older versions, we need to keep patch.py files for instrumentation discovery.
69-
RUN if python -c "from packaging.version import Version; import ddtrace; exit(0 if Version(ddtrace.__version__) >= Version('4.7.0rc3') else 1)"; then \
69+
RUN pip install --quiet packaging && \
70+
DDTRACE_VERSION=$(grep "^Version:" ./python/lib/$runtime/site-packages/ddtrace-*.dist-info/METADATA | awk '{print $2}') && \
71+
if python -c "from packaging.version import Version; exit(0 if Version('$DDTRACE_VERSION') >= Version('4.7.0rc3') else 1)"; then \
7072
find ./python/lib/$runtime/site-packages -name \*.py | xargs rm -rf; \
7173
else \
7274
find ./python/lib/$runtime/site-packages -name \*.py | grep -v ddtrace/contrib | xargs rm -rf && \

0 commit comments

Comments
 (0)