forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
47 lines (35 loc) · 1.38 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
#!/usr/bin/make
PKG=client
VERSION := $(shell poetry version -s)
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = docs
BUILDDIR = build
SDIST_FILE = "dist/pyln-${PKG}-$(VERSION).tar.gz"
BDIST_FILE = "dist/pyln_${PKG}-$(VERSION)-py3-none-any.whl"
ARTEFACTS = $(BDIST_FILE) $(SDIST_FILE)
check: check-source check-pytest
check-source: check-flake8 check-mypy check-version
# We want to create an env for this directory.
check-version:
poetry env remove -q python3 || true
poetry env use python3
poetry install
[ "`poetry run python3 -c 'from pyln import $(PKG); print($(PKG).__version__)'`" = "$(VERSION)" ] || exit 1
check-flake8:
flake8 --ignore=E501,E731,W503,E741 pyln tests
check-pytest:
pytest tests
check-mypy:
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
# Having versions in two places sucks, but so does every other option :(
# See https://github.com/python-poetry/poetry/issues/144
upgrade-version:
if [ -z "$(NEW_VERSION)" ]; then echo "Set NEW_VERSION!" >&2; exit 1; fi
poetry version $(NEW_VERSION)
sed 's/^__version__ = .*/__version__ = "$(NEW_VERSION)"/' < pyln/$(PKG)/__init__.py > pyln/$(PKG)/__init__.py.new && mv pyln/$(PKG)/__init__.py.new pyln/$(PKG)/__init__.py
$(SDIST_FILE) $(BDIST_FILE):
poetry build
prod-release: check-version $(ARTEFACTS)
poetry publish