-
Notifications
You must be signed in to change notification settings - Fork 191
/
Makefile
84 lines (74 loc) · 2.48 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
fileinfo := Faucet Developers Makefile
author := Shivaram Mysore ([email protected])
## Dependent programs
PYTHON = python
PYREVERSE = pyreverse
YAPF = yapf
PYLINT = pylint
RM := rm
MKDIR := mkdir -p
MV := mv
DOT := dot
SED := sed
UNAME_S := $(shell uname -s)
## Git version 2.11+ is required
GIT := git
GIT_REL_TAG := $(shell $(GIT) describe --abbrev=0 --tags)
GIT_NUM_COMMITS := $(shell $(GIT) rev-list `$(GIT) rev-list --tags --no-walk --max-count=1`..HEAD --count)
GIT_LOC := $(shell $(GIT) diff --shortstat `$(GIT) rev-list --tags --no-walk --max-count=1`)
GIT_BRANCH := $(shell $(GIT) rev-parse --abbrev-ref HEAD)
GIT_REMOTE := $(shell $(GIT) remote)
PROJECT_NAME = faucet
## Directories
DIST_DIR = dist
SRC_DIR = .
all: clobber sdist docs
docs: uml dot
uml:
$(MKDIR) $(DIST_DIR)/doc
$(PYREVERSE) -ASmn -o png -p $(PROJECT_NAME) $(SRC_DIR)/faucet/*py
$(MV) classes*png $(DIST_DIR)/doc
$(MV) packages*png $(DIST_DIR)/doc
codefmt:
@echo Run below command manually to inline replace current code with newly formatted code per “pep8” guidelines
@echo $(YAPF) --style pep8 -ri $(SRC_DIR)/faucet/
codeerrors:
@echo Finding errors in code now ...
$(MKDIR) $(DIST_DIR)
@# ; true to continue on code failing Pylint
$(PYLINT) $(SRC_DIR)/faucet/*py > $(DIST_DIR)/error_report.out ; true
@echo Code error report available at $(DIST_DIR)/error_report.out
stats:
@echo 'Since last release tag $(value GIT_REL_TAG)'
@echo 'number of commits = $(value GIT_NUM_COMMITS)'
@echo 'Net LOC added/removed = $(value GIT_LOC)'
@echo
@echo 'Listing all commits since last tag ...'
@$(GIT) log $(GIT_REL_TAG)..HEAD --oneline
release:
@echo '"version" and "next_version" variables need to be passed in to perform release...'
@echo 'e.g. make release version=1.6.8 next_version=1.6.9'
@echo
@test $(version)
@test $(next_version)
@echo 'Looks good, performing release'
@echo
@echo 'Current release tag $(value GIT_REL_TAG)'
@echo 'Releasing version $(version)'
@echo
ifeq ($(UNAME_S),Darwin)
@$(SED) -i "" -e s/$(value GIT_REL_TAG)/$(version)/ README.rst
else
@$(SED) -i s/$(value GIT_REL_TAG)/$(version)/ README.rst
endif
@$(GIT) commit -a -m "$(version)"
@$(GIT) tag -a $(version) -m "$(version)"
ifeq ($(UNAME_S),Darwin)
@$(SED) -i "" -e s/$(version)/$(next_version)/ setup.cfg
else
@$(SED) -i s/$(version)/$(next_version)/ setup.cfg
endif
@$(GIT) commit -a -m "$(version)"
@$(GIT) push $(GIT_REMOTE) $(GIT_BRANCH)
@$(GIT) push $(GIT_REMOTE) $(version)
@echo 'Done releasing version $(version)'