-
Notifications
You must be signed in to change notification settings - Fork 151
/
Makefile
91 lines (71 loc) · 2.55 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
PY_FILES = $(shell find . -type f -name '*.py')
VERSION = $(shell grep "__version__ =" blocksatcli/main.py | cut -d '"' -f2)
SDIST = dist/blocksat-cli-$(VERSION).tar.gz
SDIST_UNDERSCORE = dist/blocksat_cli-$(VERSION).tar.gz
WHEEL = dist/blocksat_cli-$(VERSION)-py3-none-any.whl
DISTRO = ubuntu:jammy
DISTRO_ALT = $(subst :,-,$(DISTRO))
PLATFORM = linux/amd64,linux/arm64
DOCKERHUB_REPO = blockstream
MANPAGE = blocksat-cli.1
COMPLETION = blocksat-cli.bash-completion
.PHONY: all clean clean-py sdist wheel install docker pypi testpypi manpage completion
all: sdist
clean: clean-py
clean-py:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -f $(MANPAGE)
rm -f $(COMPLETION)
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
$(SDIST): $(PY_FILES)
python3 setup.py sdist
mv $(SDIST_UNDERSCORE) $(SDIST) || true
# NOTE: depending on the setuptools version, the generated sdist file name may
# have blocksat_cli (with an underscore) instead of blocksat-cli (with a
# hyphen). Rename it to blocksat-cli for consistency.
sdist: $(SDIST)
$(WHEEL): $(PY_FILES)
python3 setup.py bdist_wheel
wheel: $(WHEEL)
install: $(SDIST)
pip3 install $(SDIST)[fec]
manpage: $(MANPAGE)
$(MANPAGE): $(PY_FILES)
help2man ./blocksat-cli.py -o $@ -s 1
completion: $(COMPLETION)
$(COMPLETION): $(PY_FILES)
shtab blocksatcli.main.get_parser -s bash > $@
pypi: clean sdist wheel
python3 -m twine upload --repository pypi \
dist/blocksat-cli-$(VERSION).tar.gz \
dist/blocksat_cli-$(VERSION)-*.whl
testpypi: clean sdist wheel
python3 -m twine upload --repository testpypi \
dist/blocksat-cli-$(VERSION).tar.gz \
dist/blocksat_cli-$(VERSION)-*.whl
docker: $(SDIST) $(MANPAGE) $(COMPLETION)
docker build --build-arg distro=$(DISTRO) \
--build-arg version=$(VERSION) \
-t $(DOCKERHUB_REPO)/satellite \
-t $(DOCKERHUB_REPO)/satellite:$(DISTRO_ALT) \
-t $(DOCKERHUB_REPO)/satellite:$(VERSION) \
-f docker/blocksat-host.docker .
docker-push: docker
docker push $(DOCKERHUB_REPO)/satellite
docker-buildx: $(SDIST) $(MANPAGE) $(COMPLETION)
docker buildx build --platform $(PLATFORM) \
--build-arg distro=$(DISTRO) \
--build-arg version=$(VERSION) \
-t $(DOCKERHUB_REPO)/satellite \
-t $(DOCKERHUB_REPO)/satellite:$(VERSION) \
-f docker/blocksat-host.docker .
docker-buildx-push: $(SDIST) $(MANPAGE) $(COMPLETION)
docker buildx build --platform $(PLATFORM) --push \
--build-arg distro=$(DISTRO) \
--build-arg version=$(VERSION) \
-t $(DOCKERHUB_REPO)/satellite \
-t $(DOCKERHUB_REPO)/satellite:$(VERSION) \
-f docker/blocksat-host.docker .