Skip to content

Commit 80e1221

Browse files
pypi: support download-mirror
from bandersnatch 5.1.0 see https://github.com/pypa/bandersnatch/releases/tag/5.1.0 for more info
1 parent a5bf806 commit 80e1221

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pypi.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
22
set -e
33
BANDERSNATCH=${BANDERSNATCH:-"/usr/local/bin/bandersnatch"}
4-
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"https://pypi.org/"}
4+
PYPI_MASTER="https://pypi.org/"
5+
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-$PYPI_MASTER}
56
CONF="/tmp/bandersnatch.conf"
67
INIT=${INIT:-"0"}
78

@@ -12,12 +13,19 @@ fi
1213

1314
echo "Syncing to $TUNASYNC_WORKING_DIR"
1415

16+
DOWNLOAD_MIRROR=""
17+
if [[ $TUNASYNC_UPSTREAM != $PYPI_MASTER ]]; then
18+
# see https://github.com/pypa/bandersnatch/pull/928 for more info
19+
DOWNLOAD_MIRROR="download-mirror = ${TUNASYNC_UPSTREAM}"
20+
fi
21+
1522
if [[ $INIT == "0" ]]; then
1623
(
1724
cat << EOF
1825
[mirror]
1926
directory = ${TUNASYNC_WORKING_DIR}
20-
master = ${TUNASYNC_UPSTREAM}
27+
master = ${PYPI_MASTER}
28+
${DOWNLOAD_MIRROR}
2129
json = true
2230
timeout = 300
2331
workers = 5
@@ -47,7 +55,8 @@ else
4755
cat > $CONF << EOF
4856
[mirror]
4957
directory = ${TUNASYNC_WORKING_DIR}
50-
master = ${TUNASYNC_UPSTREAM}
58+
master = ${PYPI_MASTER}
59+
${DOWNLOAD_MIRROR}
5160
json = true
5261
timeout = 15
5362
workers = 10

0 commit comments

Comments
 (0)