forked from gpaulissen/ofxstatement-mt940
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.61 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
## -*- mode: make -*-
GIT = git
MYPY = mypy
PROJECT = ofxstatement-mt940
PYTHON = python
PIP = pip
ifeq '$(CONDA_PREFIX)' ''
$(error YOU MUST USE CONDA)
endif
# OS specific section
ifeq '$(findstring ;,$(PATH))' ';'
detected_OS := Windows
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
ifeq ($(detected_OS),Windows)
RM_EGGS = pushd $(CONDA_PREFIX) && del /s/p $(PROJECT).egg-link $(PROJECT)-nspkg.pth
else
RM_EGGS = cd $(CONDA_PREFIX) && find . \( -name $(PROJECT).egg-link -o -name $(PROJECT)-nspkg.pth \) -exec rm -i {} \;
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; shutil.rmtree('.pytest_cache')"
install: clean
$(PIP) install -e .
$(PIP) install -r test_requirements.txt
test:
$(MYPY) --show-error-codes src
$(PYTHON) -m pytest --exitfirst
dist: install test
$(PYTHON) setup.py sdist bdist_wheel
$(PYTHON) -m twine check dist/*
upload_test: dist
$(PYTHON) -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
upload: dist
$(PYTHON) -m twine upload dist/*
# This is GNU specific I guess
VERSION = $(shell $(PYTHON) __about__.py)
TAG = v$(VERSION)
tag:
git tag -a $(TAG) -m "$(TAG)"
git push origin $(TAG)