Skip to content

Commit fbb4e9a

Browse files
authored
Merge pull request #7 from sonatype-nexus-community/platform-index
add index.html intro for each compute platform directory
2 parents 02a617a + d20f235 commit fbb4e9a

File tree

1 file changed

+47
-22
lines changed

1 file changed

+47
-22
lines changed

update-pytorch.sh

+47-22
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,51 @@ function checkCount() {
5555
fi
5656
}
5757

58+
function updateHumanIndexes() {
59+
cat <<EOF > whl/index.html
60+
<!DOCTYPE html>
61+
<html>
62+
<body>
63+
<h1>Sonatype <a href="https://pytorch.org/">PyTorch</a> PyPI improved indexes for <a href="https://help.sonatype.com/en/pypi-repositories.html#download--search--and-install-packages-using-pip">Nexus Repository</a></h1>
64+
65+
Generated by <a href="https://github.com/sonatype-nexus-community/pytorch-pypi">sonatype-nexus-community/pytorch-pypi</a> from <a href="https://download.pytorch.org/whl/">https://download.pytorch.org/whl/</a>
66+
<p>
67+
for the full index, use <code>--index-url <a href="simple">https://sonatype-nexus-community.github.io/pytorch-pypi/whl/simple</code></a>
68+
<p>
69+
You can also use compute platform filtered indexes:
70+
<ul>
71+
$(for d in whl/*
72+
do
73+
d="$(echo $d | cut -c 5-)"
74+
[ -d "whl/$d" ] && [ "$d" != "simple" ] \
75+
&& echo "<li><a href=\"$d\">$d</a></li>"
76+
done)
77+
</ul>
78+
</body>
79+
</html>
80+
EOF
81+
82+
for d in whl/*
83+
do
84+
d="$(echo $d | cut -c 5-)"
85+
[ -d "whl/$d" ] && [ "$d" != "simple" ] \
86+
&& cat <<EOF > whl/$d/index.html
87+
<!DOCTYPE html>
88+
<html>
89+
<body>
90+
<h1>Sonatype <a href="https://pytorch.org/">PyTorch</a> PyPI improved indexes for <a href="https://help.sonatype.com/en/pypi-repositories.html#download--search--and-install-packages-using-pip">Nexus Repository</a></h1>
91+
92+
Generated by <a href="https://github.com/sonatype-nexus-community/pytorch-pypi">sonatype-nexus-community/pytorch-pypi</a> from <a href="https://download.pytorch.org/whl/$d/">https://download.pytorch.org/whl/$d/</a>
93+
<p>
94+
for $d compute platform index, use <code>--index-url <a href="simple">https://sonatype-nexus-community.github.io/pytorch-pypi/whl/$d/simple</code></a>
95+
<p>
96+
see also <a href="..">other available indexes</a>
97+
</body>
98+
</html>
99+
EOF
100+
done
101+
}
102+
58103
# update main PyTorch index, that contains everything, whatever the compute platform
59104
updateIndex "whl"
60105

@@ -65,6 +110,7 @@ git diff-index --name-status HEAD
65110
if `git diff-index --quiet HEAD`
66111
then
67112
echo "no update found in PyTorch main index."
113+
updateHumanIndexes
68114
exit 0
69115
fi
70116
echo "updates found in PyTorch main index: updating also compute platform specific ones..."
@@ -77,30 +123,9 @@ for d in cpu cpu-cxx11-abi cpu_pypi_pkg cu118 cu121 cu124 rocm6.0 rocm6.1
77123
do
78124
updateIndex "whl/$d"
79125
done
126+
updateHumanIndexes
80127

81128
du -sh whl/*
82129

83130
for d in whl/simple whl/*/simple ; do echo "$(ls $d | wc -l | xargs) $d" ; done > summary.txt
84131
cat summary.txt
85-
86-
cat <<EOF > whl/index.html
87-
<!DOCTYPE html>
88-
<html>
89-
<body>
90-
<h1>Sonatype <a href="https://pytorch.org/">PyTorch</a> PyPI <b>improved</b> indexes</h1>
91-
92-
Generated by <a href="https://github.com/sonatype-nexus-community/pytorch-pypi">sonatype-nexus-community/pytorch-pypi</a> from <a href="https://download.pytorch.org/whl/">https://download.pytorch.org/whl/</a>
93-
94-
<ul>
95-
<li><a href="simple">simple</a> full index</li>
96-
<li>compute platform filtered indexes:<ul>
97-
$(for d in whl/*
98-
do
99-
d="$(echo $d | cut -c 5-)"
100-
[ -d "whl/$d" ] && [ "$d" != "simple" ] && echo "<li><a href=\"$d/simple\">$d/simple</a></li>"
101-
done)
102-
</ul></li>
103-
</ul>
104-
</body>
105-
</html>
106-
EOF

0 commit comments

Comments
 (0)