@@ -68,7 +68,8 @@ if [ "$CONDA_PACKAGES" == "" ]; then
6868fi
6969
7070# the user can specify a directory into which the conda installer is downloaded
71- # if they don't specify one, we use a temporary directory
71+ # if they don't specify one, we use a temporary directory with a predictable name to preserve downloaded files across runs
72+ # this should reduce the download overhead
7273# if one is specified, the installer will not be re-downloaded unless it has changed
7374if [ " $CONDA_DOWNLOAD_DIR " != " " ]; then
7475 # resolve path relative to cwd
@@ -77,20 +78,16 @@ if [ "$CONDA_DOWNLOAD_DIR" != "" ]; then
7778 fi
7879
7980 log " Using user-specified download directory: $CONDA_DOWNLOAD_DIR "
80- mkdir -p " $CONDA_DOWNLOAD_DIR "
8181else
8282 # create temporary directory into which downloaded files are put
83- CONDA_DOWNLOAD_DIR=" $( mktemp -d ) "
83+ CONDA_DOWNLOAD_DIR=" /tmp/linuxdeploy-plugin-conda- $( whoami ) "
8484
85- _cleanup () {
86- if [ -d " $CONDA_DOWNLOAD_DIR " ]; then
87- rm -rf " $CONDA_DOWNLOAD_DIR "
88- fi
89- }
90-
91- trap _cleanup EXIT
85+ log " Using default temporary download directory: $CONDA_DOWNLOAD_DIR "
9286fi
9387
88+ # make sure the directory exists
89+ mkdir -p " $CONDA_DOWNLOAD_DIR "
90+
9491if [ -d " $APPDIR " /usr/conda ]; then
9592 log " WARNING: conda prefix directory exists: $APPDIR /usr/conda"
9693 log " Please make sure you perform a clean build before releases to make sure your process works properly."
114111
115112pushd " $CONDA_DOWNLOAD_DIR "
116113 miniconda_url=https://repo.continuum.io/miniconda/" $miniconda_installer_filename "
117- wget -N -c " $miniconda_url "
114+ # let's make sure the file exists before we then rudimentarily ensure mutual exclusive access to it with flock
115+ touch " $miniconda_installer_filename "
116+ flock " $miniconda_installer_filename " wget -N -c " $miniconda_url "
118117popd
119118
120119# install into usr/conda/ instead of usr/ to make sure that the libraries shipped with conda don't overwrite or
0 commit comments