tunasync-scripts/pypi_shadowmire.sh
Shengqi Chen 367875671a
pypi_shadowmire: adapt to latest version
Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
2024-08-08 16:48:51 +08:00

62 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
SHADOWMIRE=${SHADOWMIRE:-"/home/scripts/shadowmire.py"}
PYPI_MASTER="https://pypi.org"
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-$PYPI_MASTER}
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM%/}
CONF="/tmp/shadowmire.conf"
INIT=${INIT:-"0"}
SHADOWMIRE_UPSTREAM=${SHADOWMIRE_UPSTREAM:-"0"}
REPO="${TUNASYNC_WORKING_DIR}/web"
if [ ! -d "$REPO" ]; then
mkdir -p "$REPO"
INIT="1"
fi
echo "Syncing to $REPO"
DOWNLOAD_MIRROR=""
if [[ $TUNASYNC_UPSTREAM != $PYPI_MASTER ]]; then
# see https://github.com/pypa/bandersnatch/pull/928 for more info
DOWNLOAD_MIRROR="shadowmire_upstream = ${TUNASYNC_UPSTREAM}"
fi
(
cat << EOF
[options]
repo = ${REPO}
sync_packages = true
${DOWNLOAD_MIRROR}
use_pypi_index = true
exclude = [
".+-nightly(-|$)",
EOF
for i in $PYPI_EXCLUDE; do
echo " \"$i\","
done
cat << EOF
]
prerelease_exclude = [
"duckdb",
"graphscope-client",
"lalsuite",
"gs-(apps|engine|include)",
"bigdl-dllib(-spark2|-spark3)?",
"ovito"
]
EOF
) > $CONF
echo "Generated config file:"
cat $CONF
exec python3 $SHADOWMIRE --config $CONF sync