forked from juju/charm-helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (54 loc) · 1.76 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
PROJECT=charmhelpers
PYTHON := /usr/bin/env python3
SUITE=unstable
TESTS=tests/
all:
@echo "make source - Create source package"
@echo "make sdeb - Create debian source package"
@echo "make deb - Create debian package"
@echo "make clean"
@echo "make userinstall - Install locally"
@echo "make docs - Build html documentation"
@echo "make release - Build and upload package and docs to PyPI"
@echo "make test"
sdeb: source
scripts/build source
deb: source
scripts/build
source: setup.py
scripts/update-revno
python3 setup.py sdist
clean:
-python3 setup.py clean
rm -rf build/ MANIFEST
find . -name '*.pyc' -delete
find . -name '__pycache__' -delete
rm -rf dist/*
rm -rf .venv3
(which dh_clean && dh_clean) || true
userinstall:
scripts/update-revno
python3 setup.py install --user
.venv3:
dpkg-query -W -f='$${status}' gcc python3-dev python-virtualenv python3-apt 2>/dev/null | grep --invert-match "not-installed" || sudo apt-get install -y python3-dev python-virtualenv python3-apt
virtualenv .venv3 --python=python3 --system-site-packages
.venv3/bin/pip install -U pip
.venv3/bin/pip install -I -r test-requirements.txt
# Note we don't even attempt to run tests if lint isn't passing.
test: lint test-py3
@echo OK
test-py3:
@echo Starting Py3 tests...
tox -e py3
lint:
tox -e pep8
docs:
- [ -z "`dpkg -l | grep python3-sphinx`" ] && sudo apt-get install python-sphinx -y
- [ -z "`dpkg -l | grep python3-pip`" ] && sudo apt-get install python-pip -y
- [ -z "`pip list | grep -i sphinx-pypi-upload`" ] && sudo pip install sphinx-pypi-upload
- [ -z "`pip list | grep -i sphinx_rtd_theme`" ] && sudo pip install sphinx_rtd_theme
cd docs && make html && cd -
.PHONY: docs
release: docs
$(PYTHON) setup.py sdist upload upload_sphinx
build: test lint docs