-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
68 lines (54 loc) · 1.79 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
## -*- mode: make -*-
GIT = git
PYTHON = python
MYPY = mypy
PIP = pip
PROJECT = bridge-markup
# OS specific section
ifeq '$(findstring ;,$(PATH))' ';'
detected_OS := Windows
HOME = $(USERPROFILE)
else
detected_OS := $(shell uname 2>/dev/null || echo Unknown)
detected_OS := $(patsubst CYGWIN%,Cygwin,$(detected_OS))
detected_OS := $(patsubst MSYS%,MSYS,$(detected_OS))
detected_OS := $(patsubst MINGW%,MSYS,$(detected_OS))
endif
ifdef CONDA_PREFIX
home = $(CONDA_PREFIX)
else
home = $(HOME)
endif
ifeq ($(detected_OS),Windows)
RM_EGGS = pushd $(home) && del /s/q $(PROJECT).egg-link $(PROJECT)-nspkg.pth
else
RM_EGGS = { cd $(home) && find . \( -name $(PROJECT).egg-link -o -name $(PROJECT)-nspkg.pth \) -print -exec rm -i "{}" \; ; } 2>/dev/null
endif
.PHONY: clean install test dist distclean upload
clean:
$(PYTHON) setup.py clean --all
-$(RM_EGGS)
$(PYTHON) -Bc "import pathlib; [p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')]"
$(PYTHON) -Bc "import pathlib; [p.rmdir() for p in pathlib.Path('.').rglob('__pycache__')]"
$(PYTHON) -Bc "import shutil; import os; [shutil.rmtree(d) for d in ['.pytest_cache', '.mypy_cache', 'dist', 'htmlcov', '.coverage'] if os.path.isdir(d)]"
$(MAKE) --directory=test/data -f ../../bml.mk distclean
install: clean
$(PIP) install -r requirements.txt
$(PIP) install -e .
$(PIP) install -r test_requirements.txt
test:
$(MYPY) --show-error-codes src
$(PYTHON) -m pytest --exitfirst
dist: install test
$(PYTHON) -m build
$(PYTHON) -m twine check dist/*
upload_test: dist
$(PYTHON) -m twine upload --repository testpypi dist/*
upload: dist
$(PYTHON) -m twine upload dist/*
# This is GNU specific I guess
VERSION = $(shell $(PYTHON) src/bml/about.py)
TAG = v$(VERSION)
tag:
git tag -a $(TAG) -m "$(TAG)"
git push origin $(TAG)