Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2d4d8c5

Browse files
committedOct 16, 2024
Simplify the find expression
The `find` expression was a bit complex to grok and it did not remove the `__pycache__` directories. It also missed removing the C-extension tests `*.so` files.
1 parent 8f2e9c5 commit 2d4d8c5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed
 

‎Dockerfile-linux.template

+3-6
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,9 @@ RUN set -eux; \
227227
cd /; \
228228
rm -rf /usr/src/python; \
229229
\
230-
find /usr/local -depth \
231-
\( \
232-
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
233-
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \
234-
\) -exec rm -rf '{}' + \
235-
; \
230+
find /usr/local -type d \( -name test -o -name idle_test -o -name __pycache__ \) -exec rm -rf '{}' +; \
231+
find /usr/local -type f -name libpython3*.a -delete; \
232+
find /usr/local -type f -name *test*.so -delete; \
236233
\
237234
{{ if is_alpine then ( -}}
238235
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \

0 commit comments

Comments
 (0)
Please sign in to comment.