-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
53 lines (38 loc) · 1.5 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
PYTHON = python3
RM = rm
PKG_NAME = postfix_mta_sts_resolver
ARCH_NAME = postfix-mta-sts-resolver
MANPAGES = $(patsubst %.adoc,%,$(wildcard man/*.adoc))
PRJ_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
VENV ?= $(PRJ_DIR)venv
PKGVENV ?= $(PRJ_DIR)pkg_venv
install: $(VENV) setup.py
$(VENV)/bin/python -m pip install -U .[sqlite,redis,postgres,dev]
$(VENV):
$(PYTHON) -m venv $(VENV)
$(VENV)/bin/python -m pip install -U wheel
uninstall: $(VENV)
$(VENV)/bin/python -m pip uninstall -y $(PKG_NAME)
man/%:
asciidoctor --backend=manpage $@.adoc
doc: $(MANPAGES)
clean:
$(RM) -rf $(VENV) $(PKGVENV) dist/ build/ $(PKG_NAME).egg-info/ man/*.?
$(PKGVENV):
$(PYTHON) -m venv $(PKGVENV)
$(PKGVENV)/bin/python -m pip install -U setuptools wheel twine
pkg: $(PKGVENV)
$(PKGVENV)/bin/python setup.py sdist bdist_wheel
$(PKG_NAME).egg-info/PKG-INFO: $(PKGVENV)
$(PKGVENV)/bin/python setup.py egg_info
version: $(PKG_NAME).egg-info/PKG-INFO
@echo Evaluating pagkage version...
$(eval PKG_VERSION := $(if $(PKG_VERSION),$(PKG_VERSION),$(shell grep -Po '(?<=^Version: ).*' $<)))
@echo Version = $(PKG_VERSION)
upload: pkg version
$(PKGVENV)/bin/python -m twine upload dist/$(PKG_NAME)-$(PKG_VERSION)*
testupload: pkg version
$(PKGVENV)/bin/python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/$(PKG_NAME)-$(PKG_VERSION)*
archive: version
git archive --prefix=$(ARCH_NAME)-$(PKG_VERSION)/ -o ../$(ARCH_NAME)-$(PKG_VERSION).tar.gz v$(PKG_VERSION)
.PHONY: install clean uninstall pkg version archive