Created
July 4, 2016 07:02
-
-
Save asaf400/f3420440f2216c89a1e066e2827b41ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p output | |
for file in `ls -l | grep -v ^d | awk '{print $9}'`; do | |
md5=`md5sum $file | awk '{print $1}'` | |
firstletter=${file:0:1} | |
IFS='-' read -ra ADDR <<< "$file" | |
IFS='_' read -ra firstword <<< "${ADDR[0]}" #firstword | |
IFS='_' read -ra version <<< "${ADDR[1]}" #version | |
echo $version | |
midpath="$firstletter/$firstword/$file#md5=$md5" | |
case "$file" in | |
*tar.gz) | |
type="source" | |
;; | |
*py2*exe) | |
type="2.7" | |
;; | |
*py2*whl) | |
type="2.7" | |
;; | |
esac | |
path="../../packages/$type/$midpath" | |
compiled="<a href=$path>$file</a><br />" | |
echo $compiled | |
htmlheader="<html><head><title>Links for $firstword</title><meta name=\"api-version\" value=\"2\" /></head><body><h1>Links for $firstword</h1>" | |
htmlfooter='</body></html>' | |
mkdir -p $firstword | |
echo "Prossecing $firstword" | |
if [ -f $firstword/index.html ] ; then | |
grep "$version" $firstword/index.html | |
if [ $? -eq 0 ] ; then | |
echo Skipping, Version exists! | |
else | |
echo pending to html! | |
sed -i 's@</body></html>@'"${compiled}"'</body></html>@g' $firstword/index.html | |
fi | |
else | |
echo Building html! | |
touch $firstword/index.html | |
echo $htmlheader > $firstword/index.html | |
echo $compiled >> $firstword/index.html | |
echo $htmlfooter >> $firstword/index.html | |
fi | |
echo "" | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creates an Index.html for use in pypi server in /simple context.
Iterates over all the files in the $pwd, calculates md5, and either builds or appends index.html entries for version