ENVDIR=envdir

.DEFAULT_GOAL=test-install

clean:
	rm -rf $(ENVDIR) build dist *.egg-info

build: setup.py topplot topplot_/*.py
	python3 setup.py sdist bdist_wheel

test-upload: build
	echo ebardie | twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*
	sleep 3

upload: clean build
	echo ebardie | twine upload --verbose  dist/*

test-install:
	[ -d $(ENVDIR) ] && rm -rf $(ENVDIR); \
	python3 -m venv $(ENVDIR); \
	. $(ENVDIR)/bin/activate; \
	pip install -U pip pycairo; \
	pip install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple -v topplot
	bash

install:
	[ -d $(ENVDIR) ] && rm -rf $(ENVDIR); \
	python3 -m venv $(ENVDIR); \
	. $(ENVDIR)/bin/activate; \
	pip install -U pip pycairo; \
	pip install -v -U topplot

.PHONY: build clean test-upload test-install
