-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
47 lines (34 loc) · 1.37 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
PYTHON = python3
RM = rm
PKG_NAME = chunk_nordic
ARCH_NAME = chunk-nordic
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 .[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)
clean:
$(RM) -rf $(VENV) $(PKGVENV) dist/ build/ $(PKG_NAME).egg-info/ .tox/ .coverage
$(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 upload testupload archive