Commit 0e484d10 by William Tisäter

Turn build.sh into a Makefile

parent 093d3771
.PHONY: docs
all: test docs
test:
@echo "Downloading test databases"
rm -rf maxmind-geoip-samples.tar.gz tests/data; mkdir -p tests/data
curl -s https://www.defunct.cc/maxmind-geoip-samples.tar.gz | tar -zx -C tests
@echo "Testing local state"
@tox --version > /dev/null || (echo "Requires tox - install requirements.txt"; exit 1)
tox
docs:
@echo "Building documentation"
make -C docs clean
make -C docs html
clean:
@echo "Cleaning doc, test and cache files"
find . -name *.pyc -delete
rm -rf pygeoip-* pygeoip.egg-info
#!/bin/bash
function warning { echo "Warning: $1"; }
function error { echo "Error: $1" 1>&2; exit 1; }
pushd $(dirname $0)
if [ -z "$(virtualenv --version)" ]; then
error "Missing virtualenv binary"
fi
if [ ! -d venv ]; then
virtualenv venv || error "virtualenv failed"
venv/bin/pip install tox nose || error "pip failed"
fi
if [ ! -d tests/data ]; then
pushd tests
wget https://www.defunct.cc/maxmind-geoip-samples.tar.gz
tar -zxvf maxmind-geoip-samples.tar.gz
unlink maxmind-geoip-samples.tar.gz
popd
fi
venv/bin/tox || error "tox failed"
if [ -z "$(pandoc --version)" ]; then
warning "Skipping Markdown to reStructuredText translation"
else
pandoc -f markdown -t rst -o README.rst README.md || error "pandoc failed"
fi
popd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment