@@ -8,6 +8,31 @@ PACKAGE_NAME=alphaquant
88# BUILD_NAME is taken from environment variables, e.g. alphaquant-1.2.3-macos-darwin-arm64 or alphaquant-1.2.3-macos-darwin-x64
99rm -rf ${BUILD_NAME} .pkg
1010
11+ curl_with_retries () {
12+ local args=(
13+ -L
14+ -f
15+ --retry 3
16+ --retry-delay 2
17+ -H " User-Agent: alphaquant-release-build"
18+ )
19+
20+ curl " ${args[@]} " " $@ "
21+ }
22+
23+ list_alphamap_data_downloads () {
24+ python -c ' from urllib.parse import quote
25+ from alphamap.organisms_data import all_organisms
26+ base_url = "https://raw.githubusercontent.com/MannLabs/alphamap/main/alphamap/data/"
27+ seen = set()
28+ for organism in all_organisms.values():
29+ for key in ("fasta_name", "uniprot_name"):
30+ name = organism[key]
31+ if name not in seen:
32+ seen.add(name)
33+ print(f"{name}\t{base_url}{quote(name)}")'
34+ }
35+
1136# If needed, include additional source such as e.g.:
1237# cp ../../alphaquant/data/*.fasta dist/alphaquant/data
1338
@@ -36,23 +61,14 @@ mkdir -p ${CONTENTS_FOLDER}/Frameworks/alphamap/data/
3661# ###
3762# ###Download all AlphaMap FASTA and CSV files from GitHub, which are needed for the further analyses. There is a lot of error checking to ensure that the files get actually added during the build
3863echo " Starting downloads of FASTA and CSV files..."
39- DOWNLOAD_LIST=$( curl -L -f https://api.github.com/repos/MannLabs/alphamap/contents/alphamap/data? ref=main)
40- if [ $? -ne 0 ]; then
41- echo " Error: Failed to fetch file list from GitHub API"
42- exit 1
43- fi
44-
45- echo " $DOWNLOAD_LIST " | \
46- grep " \" download_url\" .*\.\(fasta\|csv\)\" " | \
47- cut -d ' "' -f 4 | \
48- while read url; do
49- if [ -z " $url " ]; then
64+ list_alphamap_data_downloads | \
65+ while IFS=$' \t ' read -r filename url; do
66+ if [ -z " $filename " ] || [ -z " $url " ]; then
5067 echo " Warning: Empty URL detected, skipping..."
5168 continue
5269 fi
53- filename=$( basename $url )
5470 echo " Downloading $filename ..."
55- if ! curl -L -f " $url " -o " ${CONTENTS_FOLDER} /Frameworks/alphamap/data/$filename " ; then
71+ if ! curl_with_retries " $url " -o " ${CONTENTS_FOLDER} /Frameworks/alphamap/data/$filename " ; then
5672 echo " Error: Failed to download $filename "
5773 exit 1
5874 fi
@@ -76,7 +92,7 @@ mkdir -p ${CONTENTS_FOLDER}/MacOS/_internal/alphaquant/resources/
7692# Download and extract the first zip file
7793echo " Downloading and extracting first resource from datashare..."
7894TEMP_ZIP1=$( mktemp)
79- if ! curl -L -f " https://datashare.biochem.mpg.de/s/ezPzeqStEgDD8gg/download" -o " $TEMP_ZIP1 " ; then
95+ if ! curl_with_retries " https://datashare.biochem.mpg.de/s/ezPzeqStEgDD8gg/download" -o " $TEMP_ZIP1 " ; then
8096 echo " Error: Failed to download first resource from datashare"
8197 exit 1
8298fi
@@ -87,7 +103,7 @@ rm "$TEMP_ZIP1"
87103# Download and extract the second zip file
88104echo " Downloading and extracting second resource from datashare..."
89105TEMP_ZIP2=$( mktemp)
90- if ! curl -L -f " https://datashare.biochem.mpg.de/s/stH9pmNe6O9CRHG/download" -o " $TEMP_ZIP2 " ; then
106+ if ! curl_with_retries " https://datashare.biochem.mpg.de/s/stH9pmNe6O9CRHG/download" -o " $TEMP_ZIP2 " ; then
91107 echo " Error: Failed to download second resource from datashare"
92108 exit 1
93109fi
0 commit comments