-
Notifications
You must be signed in to change notification settings - Fork 171
/
pypi_shadowmire.sh
executable file
·65 lines (51 loc) · 1.15 KB
/
pypi_shadowmire.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
SHADOWMIRE=${SHADOWMIRE:-"/home/scripts/shadowmire.py"}
PYPI_MASTER="https://pypi.org"
TUNASYNC_UPSTREAM=${TUNASYNC_UPSTREAM_URL:-$PYPI_MASTER}
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
USE_PYPI_INDEX=""
if [[ $SHADOWMIRE_USE_PYPI_INDEX == "1" ]]; then
USE_PYPI_INDEX="use_pypi_index = true"
fi
(
cat << EOF
[options]
repo = "${REPO}"
sync_packages = true
${DOWNLOAD_MIRROR}
${USE_PYPI_INDEX}
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