mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
pypi: support download-mirror
from bandersnatch 5.1.0 see https://github.com/pypa/bandersnatch/releases/tag/5.1.0 for more info
This commit is contained in:
parent
a5bf8066aa
commit
80e1221e67
15
pypi.sh
15
pypi.sh
@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
BANDERSNATCH=${BANDERSNATCH:-"/usr/local/bin/bandersnatch"}
|
BANDERSNATCH=${BANDERSNATCH:-"/usr/local/bin/bandersnatch"}
|
||||||
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"https://pypi.org/"}
|
PYPI_MASTER="https://pypi.org/"
|
||||||
|
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-$PYPI_MASTER}
|
||||||
CONF="/tmp/bandersnatch.conf"
|
CONF="/tmp/bandersnatch.conf"
|
||||||
INIT=${INIT:-"0"}
|
INIT=${INIT:-"0"}
|
||||||
|
|
||||||
@ -12,12 +13,19 @@ fi
|
|||||||
|
|
||||||
echo "Syncing to $TUNASYNC_WORKING_DIR"
|
echo "Syncing to $TUNASYNC_WORKING_DIR"
|
||||||
|
|
||||||
|
DOWNLOAD_MIRROR=""
|
||||||
|
if [[ $TUNASYNC_UPSTREAM != $PYPI_MASTER ]]; then
|
||||||
|
# see https://github.com/pypa/bandersnatch/pull/928 for more info
|
||||||
|
DOWNLOAD_MIRROR="download-mirror = ${TUNASYNC_UPSTREAM}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $INIT == "0" ]]; then
|
if [[ $INIT == "0" ]]; then
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
[mirror]
|
[mirror]
|
||||||
directory = ${TUNASYNC_WORKING_DIR}
|
directory = ${TUNASYNC_WORKING_DIR}
|
||||||
master = ${TUNASYNC_UPSTREAM}
|
master = ${PYPI_MASTER}
|
||||||
|
${DOWNLOAD_MIRROR}
|
||||||
json = true
|
json = true
|
||||||
timeout = 300
|
timeout = 300
|
||||||
workers = 5
|
workers = 5
|
||||||
@ -47,7 +55,8 @@ else
|
|||||||
cat > $CONF << EOF
|
cat > $CONF << EOF
|
||||||
[mirror]
|
[mirror]
|
||||||
directory = ${TUNASYNC_WORKING_DIR}
|
directory = ${TUNASYNC_WORKING_DIR}
|
||||||
master = ${TUNASYNC_UPSTREAM}
|
master = ${PYPI_MASTER}
|
||||||
|
${DOWNLOAD_MIRROR}
|
||||||
json = true
|
json = true
|
||||||
timeout = 15
|
timeout = 15
|
||||||
workers = 10
|
workers = 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user