Skip to content

Commit

Permalink
pyln.spec.bolt*: test-release and prod-release targets, fix requireme…
Browse files Browse the repository at this point in the history
…nts.txt

We depend on packages, not modules within them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jun 22, 2020
1 parent f0b54fd commit 7bf03dc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions contrib/pyln-spec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,52 @@ check-source-flake8-%:
check-source-mypy-%:
cd $* && mypy --ignore-missing-imports `find * -name '*.py'`

# There's a smarter way to do this, probably.

VERSION_BOLT1 := $(shell python3 -c 'from pyln.spec import bolt1 as bolt;print(bolt.__version__)')
VERSION_BOLT2 := $(shell python3 -c 'from pyln.spec import bolt2 as bolt;print(bolt.__version__)')
VERSION_BOLT4 := $(shell python3 -c 'from pyln.spec import bolt4 as bolt;print(bolt.__version__)')
VERSION_BOLT7 := $(shell python3 -c 'from pyln.spec import bolt7 as bolt;print(bolt.__version__)')

SDIST_FILE1 := bolt1/dist/pyln-bolt1-$(VERSION_BOLT1).tar.gz
BDIST_FILE1 := bolt1/dist/pyln_bolt1-$(VERSION_BOLT1)-py3-none-any.whl

SDIST_FILE2 := bolt2/dist/pyln-bolt2-$(VERSION_BOLT2).tar.gz
BDIST_FILE2 := bolt2/dist/pyln_bolt2-$(VERSION_BOLT2)-py3-none-any.whl

SDIST_FILE4 := bolt4/dist/pyln-bolt4-$(VERSION_BOLT4).tar.gz
BDIST_FILE4 := bolt4/dist/pyln_bolt4-$(VERSION_BOLT4)-py3-none-any.whl

SDIST_FILE7 := bolt7/dist/pyln-bolt7-$(VERSION_BOLT7).tar.gz
BDIST_FILE7 := bolt7/dist/pyln_bolt7-$(VERSION_BOLT7)-py3-none-any.whl

%.tar.gz:
cd $(dir $@)/.. && python3 setup.py sdist

%.whl:
cd $(dir $@)/.. && python3 setup.py bdist_wheel

ARTEFACTS = $(foreach b,$(BOLTS),$(BDIST_FILE$(b)) $(SDIST_FILE$(b)))

test-release-bolt%: $(ARTEFACTS)
python3 -m twine upload --repository testpypi --skip-existing $(BDIST_FILE$*)

# Create a test virtualenv, install from the testpypi and run the
# tests against it (make sure not to use any virtualenv that may have
# pyln-proto 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 flaky pytest-timeout
testpypi-$*/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-bolt$*
testpypi-$*/bin/python3 -c "from pyln.spec import bolt$* as bolt;assert(bolt.__version__ == '$(VERSION_BOLT$*)')"
testpypi-$*/bin/pytest bolt$*/tests
rm -rf testpypi-$*

test-release: check $(foreach b,$(BOLTS),test-release-bolt$b)

prod-release: test $(ARTEFACTS)
python3 -m twine upload $(ARTEFACTS)

refresh: $(CODE_DIRS:%=%/gen_version.py)

bolt1/pyln/spec/bolt1/gen.py: $(SPECDIR)/01-messaging.md Makefile
Expand Down
2 changes: 1 addition & 1 deletion contrib/pyln-spec/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyln.proto.message
pyln.proto==0.8.4

0 comments on commit 7bf03dc

Please sign in to comment.