This repository was archived by the owner on Dec 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (61 loc) · 1.79 KB
/
Makefile
File metadata and controls
75 lines (61 loc) · 1.79 KB
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
PYTHON = python
PIP = pip
VENV_DIR = venv
VER = $(shell git describe --tags)
VERSION = $(firstword $(subst -, ,$(VER)))
ifeq ($(shell git diff --name-only),)
UNCLEAN = "False"
else
UNCLEAN = "True"
endif
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
ifeq ($(OS),Windows_NT)
VENV_BIN = $(VENV_DIR)/Scripts
PIP = $(VENV_BIN)/pip.exe
FLAKE8 = $(VENV_BIN)/flake8.exe
ifeq ($(shell if test -d $(VENV_DIR); then echo "exist";fi),exist)
PYTHON = $(VENV_BIN)/python.exe
endif
else
VENV_BIN = $(VENV_DIR)/bin
PIP = $(VENV_BIN)/pip
FLAKE8 = $(VENV_BIN)/flake8
ifeq ($(shell if test -d $(VENV_DIR); then echo "exist";fi),exist)
PYTHON = $(VENV_BIN)/python
endif
endif
all: src/hamcc/__version__.py
src/hamcc/__version__.py:
echo __version__ = \'$(VERSION)\' > $@
echo __version_str__ = \'$(VER)\' >> $@
echo __branch__ = \'$(BRANCH)\' >> $@
echo __unclean__ = $(UNCLEAN) >> $@
bdist_win: clean all test
PYTHONPATH=./src $(PYTHON) setup_win.py bdist -d dist_exe;
dist: clean all test
$(PYTHON) -m pip install --upgrade pip;
$(PYTHON) -m pip install --upgrade build;
$(PYTHON) -m build;
release:
$(PYTHON) -m pip install --upgrade twine;
$(PYTHON) -m twine upload dist/*;
test: all
$(FLAKE8) ./src --count --select=E9,F63,F7,F82 --show-source --statistics
$(FLAKE8) ./src --count --exit-zero --max-complexity=20 --ignore=E402 --max-line-length=120 --statistics
PYTHONPATH=./src $(PYTHON) -m unittest discover -s ./test
build_devenv:
if [ ! -d $(VENV_DIR) ]; then \
$(PYTHON) -m venv $(VENV_DIR); \
$(PIP) install --upgrade pip setuptools wheel; \
$(PIP) install -r requirements.txt; \
else \
echo "Virtualenv $(VENV_DIR) already exists"; \
fi
.PHONY: src/hamcc/__version__.py test clean_devenv build_devenv
clean:
rm -rf build
rm -rf dist
rm -f src/hamcc/__version__.py
rm -f
clean_devenv:
rm -r venv