forked from rustyrussell/runes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 1.44 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
#! /usr/bin/make
PKG = runes
VERSION := $(shell python3 -c 'import ${PKG}; print(${PKG}.__version__)')
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = docs
BUILDDIR = build
SDIST_FILE = "dist/${PKG}-$(VERSION).tar.gz"
BDIST_FILE = "dist/${PKG}-$(VERSION)-py3-none-any.whl"
ARTEFACTS = $(BDIST_FILE) $(SDIST_FILE)
check: check-source check-pytest
check-source: check-flake8 check-mypy
check-flake8:
flake8 --ignore=E501,E731,W503 *.py
check-pytest:
pytest
check-mypy:
mypy *.py
$(SDIST_FILE):
python3 setup.py sdist
$(BDIST_FILE):
python3 setup.py bdist_wheel
test-release: check $(ARTEFACTS)
python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS)
# Create a test virtualenv, install from the testpypi and run the
# tests against it (make sure not to use any virtualenv that may have
# -${PKG} already installed).
virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear
# Install the requirements from the prod repo, they are not being kept up to date on the test repo
testpypi/bin/python3 -m pip install -r requirements.txt pytest
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps ${PKG}
testpypi/bin/python3 -c "import ${PKG}; assert(${PKG}.__version__ == '$(VERSION)')"
testpypi/bin/pytest
rm -rf testpypi
prod-release: test-release $(ARTEFACTS)
python3 -m twine upload $(ARTEFACTS)