@@ -21,6 +21,7 @@ show_usage() {
21
21
echo " PIP_REQUIREMENTS=\" packageA packageB -r requirements.txt -e git+https://...\" "
22
22
echo " PIP_PREFIX=\" AppDir/usr/share/conda\" "
23
23
echo " ARCH=\" x86_64\" (further supported values: i686)"
24
+ echo " CONDA_SKIP_CLEANUP=\" [all;][conda-pkgs;][__pycache__;][.so;][.a;][cmake;][doc;][man;][site-packages;]\" "
24
25
}
25
26
26
27
_isterm () {
@@ -184,17 +185,59 @@ done
184
185
popd
185
186
186
187
187
- # remove bloat
188
- if [ " $CONDA_SKIP_CLEANUP " == " " ]; then
188
+ # remove bloat, optionally skipped via $CONDA_SKIP_CLEANUP
189
+ IFS=' ;' read -ra cleanup <<< " $CONDA_SKIP_CLEANUP"
190
+ for skip in " ${cleanup[@]} " ; do
191
+ lskip=" $( tr ' [:upper:]' ' [:lower:]' <<< " $skip" ) "
192
+ case " $lskip " in
193
+ " all" | \
194
+ " 1" |" true" |" y" |" yes" ) # To allow SOME backward compatibility - versions previous
195
+ # to this comment allowed any value of $CONDA_SKIP_CLEANUP.
196
+ skip_cleanup=1
197
+ ;;
198
+ " conda-pkgs" )
199
+ skip_conda_pkgs_cleanup=1
200
+ ;;
201
+ " __pycache__" )
202
+ skip_pycache_cleanup=1
203
+ ;;
204
+ " .so" )
205
+ skip_so_cleanup=1
206
+ ;;
207
+ " .a" )
208
+ skip_a_cleanup=1
209
+ ;;
210
+ " cmake" )
211
+ skip_cmake_cleanup=1
212
+ ;;
213
+ " doc" )
214
+ skip_doc_cleanup=1
215
+ ;;
216
+ " man" )
217
+ skip_man_cleanup=1
218
+ ;;
219
+ " site-packages" )
220
+ skip_site_packages_cleanup=1
221
+ ;;
222
+ * )
223
+ log " ERROR: Unknown CONDA_SKIP_CLEANUP value: $skip "
224
+ log
225
+ show_usage
226
+ exit 1
227
+ ;;
228
+ esac
229
+ done
230
+
231
+ if [ " $skip_cleanup " != " 1" ]; then
189
232
pushd " $APPDIR " /usr/conda
190
- rm -rf pkgs
191
- find -type d -iname ' __pycache__' -print0 | xargs -0 rm -r
192
- find -type f -iname ' *.so*' -print -exec strip ' {}' \;
193
- find -type f -iname ' *.a' -print -delete
194
- rm -rf lib/cmake/
195
- rm -rf share/{gtk-,}doc
196
- rm -rf share/man
197
- rm -rf lib/python? .? /site-packages/{setuptools,pip}
233
+ (( $skip_conda_pkgs_cleanup )) || rm -rf pkgs
234
+ (( $skip_pycache_cleanup )) || find -type d -iname ' __pycache__' -print0 | xargs -0 rm -r
235
+ (( $skip_so_cleanup )) || find -type f -iname ' *.so*' -print -exec strip ' {}' \;
236
+ (( $skip_a_cleanup )) || find -type f -iname ' *.a' -print -delete
237
+ (( $skip_cmake_cleanup )) || rm -rf lib/cmake/
238
+ (( $skip_doc_cleanup )) || rm -rf share/{gtk-,}doc
239
+ (( $skip_man_cleanup )) || rm -rf share/man
240
+ (( $skip_site_packages_cleanup )) || rm -rf lib/python? .? /site-packages/{setuptools,pip}
198
241
popd
199
242
fi
200
243
0 commit comments