pypiserver/bin/gen-standalone.sh

46 lines
1.2 KiB
Bash
Raw Normal View History

#! /bin/sh
#
## Create an executable zip file.
# Invoked by `commit-standalone.sh`.
2016-07-17 23:25:09 +02:00
set -x
2016-07-17 22:23:20 +02:00
set -o errexit
exec_zip="./pypi-server-standalone.py"
my_dir="$(dirname "$0")"
cd $my_dir/..
rm -rf ./build/* ./dist/*
python setup.py bdist_wheel
wheel="./dist/pypiserver-*.whl"
## Modify `wheel` archive with `__main__.py` at root,
# add dependencies, and
# prepend it with a python-flashbang + some header-comments >= 10-lines
# so that ``head pypiserver*.py``behaves politely.
#
sudo update-ca-certificates || echo "Failed updating certs (run on travis container?)"
unzip -jo $wheel pypiserver/__main__.py -d ./dist
zip -d $wheel pypiserver/__main__.py
zip -mj $wheel ./dist/__main__.py
wget https://files.pythonhosted.org/packages/2d/a7/1a3363e5d531d438267a79d43d4b8d224655adef489e98fc96678fe16ed1/passlib-1.6.5-py2.py3-none-any.whl \
2016-07-17 22:04:00 +02:00
-O ./dist/passlib-1.6.5-py2.py3-none-any.whl
zip -mj $wheel ./dist/passlib-*.whl
gitversion=$(git describe --tags)
cat - $wheel > "$exec_zip" << EOF
#!/usr/bin/env python
##
2015-09-17 02:05:20 +02:00
## Standalone pypiserver-$gitversion $(date -R)
##
## Execute it like that:
## $exec_zip <packages_dir>
## To get more help, type:
## $exec_zip --help
##
## BINARY CONTENT FOLLOWS
EOF
chmod a+xr "$exec_zip"