gitcmds_test: apply flake8 suggestions
[git-cola.git] / Makefile
blobb34cf2e22f45b238c421b53ff39385ada11f2354
1 # The default target of this Makefile is...
2 all::
4 # The external commands used by this Makefile are...
5 CTAGS = ctags
6 CP = cp
7 FIND = find
8 FLAKE8 = flake8
9 GIT = git
10 GZIP = gzip
11 LN = ln
12 LN_S = $(LN) -s -f
13 MARKDOWN = markdown
14 MKDIR_P = mkdir -p
15 NOSETESTS = nosetests
16 PIP = pip
17 PYLINT = pylint
18 PYTHON = python
19 RM = rm -f
20 RM_R = rm -fr
21 RMDIR = rmdir
22 TAR = tar
24 # Flags
25 FLAKE8_FLAGS = --max-line-length=80 --statistics --doctests --format=pylint
26 PYLINT_FLAGS = --py3k --output-format=colorized --rcfile=.pylintrc
28 # These values can be overridden on the command-line or via config.mak
29 prefix = $(HOME)
30 bindir = $(prefix)/bin
31 datadir = $(prefix)/share/git-cola
32 coladir = $(datadir)/lib
33 hicolordir = $(prefix)/share/icons/hicolor/scalable/apps
34 darwin_python = /System/Library/Frameworks/Python.framework/Resources/Python.app/Contents/MacOS/Python
35 # DESTDIR =
37 cola_base := git-cola
38 cola_app_base= $(cola_base).app
39 cola_app = $(CURDIR)/$(cola_app_base)
40 cola_version = $(shell $(PYTHON) bin/git-cola version --brief)
41 cola_dist := $(cola_base)-$(cola_version)
43 # Allows e.g. "make test flags=--stop"
44 flags =
45 NOSE ?= $(NOSETESTS) --with-doctest --with-id --exclude=sphinxtogithub $(flags)
47 SETUP ?= $(PYTHON) setup.py
48 setup_args += --prefix=$(prefix)
49 setup_args += --quiet
50 setup_args += --force
51 setup_args += --install-scripts=$(bindir)
52 setup_args += --record=build/MANIFEST
53 setup_args += --install-lib=$(coladir)
54 ifdef DESTDIR
55 setup_args += --root=$(DESTDIR)
56 export DESTDIR
57 endif
58 export prefix
60 PYTHON_DIRS = cola
61 PYTHON_DIRS += test
63 ALL_PYTHON_DIRS = $(PYTHON_DIRS)
64 ALL_PYTHON_DIRS += extras
66 PYTHON_SOURCES = bin/git-cola
67 PYTHON_SOURCES += bin/git-dag
68 PYTHON_SOURCES += share/git-cola/bin/git-xbase
69 PYTHON_SOURCES += setup.py
71 # User customizations
72 -include config.mak
74 all:: build
75 .PHONY: all
77 build:
78 $(SETUP) build
79 .PHONY: build
81 install: all
82 $(SETUP) install $(setup_args)
83 $(MKDIR_P) $(DESTDIR)$(hicolordir)
84 $(LN_S) $(datadir)/icons/git-cola.svg $(DESTDIR)$(hicolordir)/git-cola.svg
85 $(LN_S) git-cola $(DESTDIR)$(bindir)/cola
86 $(RM_R) $(DESTDIR)$(coladir)/git_cola*
87 $(RM_R) git_cola.egg-info
88 .PHONY: install
90 # Maintainer's dist target
91 dist:
92 $(GIT) archive --format=tar --prefix=$(cola_dist)/ HEAD^{tree} | \
93 $(GZIP) -f -9 - >$(cola_dist).tar.gz
94 .PHONY: dist
96 doc:
97 $(MAKE) -C share/doc/git-cola all
98 .PHONY: doc
100 html:
101 $(MAKE) -C share/doc/git-cola html
102 .PHONY: html
104 man:
105 $(MAKE) -C share/doc/git-cola man
106 .PHONY: man
108 install-doc:
109 $(MAKE) -C share/doc/git-cola install
110 .PHONY: install-doc
112 install-html:
113 $(MAKE) -C share/doc/git-cola install-html
114 .PHONY: install-html
116 install-man:
117 $(MAKE) -C share/doc/git-cola install-man
118 .PHONY: install-man
120 uninstall:
121 $(RM) $(DESTDIR)$(prefix)/bin/git-cola
122 $(RM) $(DESTDIR)$(prefix)/bin/git-dag
123 $(RM) $(DESTDIR)$(prefix)/bin/cola
124 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola.desktop
125 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola-folder-handler.desktop
126 $(RM) $(DESTDIR)$(prefix)/share/applications/git-dag.desktop
127 $(RM) $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps/git-cola.svg
128 $(RM_R) $(DESTDIR)$(prefix)/share/git-cola
129 $(RM_R) $(DESTDIR)$(prefix)/share/doc/git-cola
130 $(RM) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES/git-cola.mo
131 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES 2>/dev/null
132 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/* 2>/dev/null
133 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale 2>/dev/null
134 -$(RMDIR) $(DESTDIR)$(prefix)/share/doc 2>/dev/null
135 -$(RMDIR) $(DESTDIR)$(prefix)/share/applications 2>/dev/null
136 -$(RMDIR) $(DESTDIR)$(prefix)/share 2>/dev/null
137 -$(RMDIR) $(DESTDIR)$(prefix)/bin 2>/dev/null
138 -$(RMDIR) $(DESTDIR)$(prefix) 2>/dev/null
139 .PHONY: uninstall
141 test: all
142 $(NOSE) $(PYTHON_DIRS)
143 .PHONY: test
145 coverage:
146 $(NOSE) --with-coverage --cover-package=cola $(PYTHON_DIRS)
147 .PHONY: coverage
149 clean:
150 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py[cod]' -print0 | xargs -0 rm -f
151 $(RM_R) build dist tags git-cola.app
152 $(RM_R) share/locale
153 $(MAKE) -C share/doc/git-cola clean
154 .PHONY: clean
156 tags:
157 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py' -print0 | xargs -0 $(CTAGS) -f tags
158 .PHONY: tags
160 pot:
161 $(SETUP) build_pot -N -d po
162 .PHONY: pot
165 $(SETUP) build_mo -f
166 .PHONY: mo
168 git-cola.app:
169 $(MKDIR_P) $(cola_app)/Contents/MacOS
170 $(MKDIR_P) $(cola_app)/Contents/Resources
171 $(CP) contrib/darwin/Info.plist contrib/darwin/PkgInfo $(cola_app)/Contents
172 $(CP) contrib/darwin/git-cola $(cola_app)/Contents/MacOS
173 $(CP) contrib/darwin/git-cola.icns $(cola_app)/Contents/Resources
174 $(MAKE) prefix=$(cola_app)/Contents/Resources install install-doc
175 $(LN_S) $(darwin_python) $(cola_app)/Contents/Resources/git-cola
176 .PHONY: git-cola.app
178 app-tarball: git-cola.app
179 $(TAR) czf $(cola_dist).app.tar.gz $(cola_app_base)
180 .PHONY: app-tarball
182 # Preview the markdown using "make README.html"
183 %.html: %.md
184 $(MARKDOWN) $< >$@
186 flake8:
187 $(FLAKE8) $(FLAKE8_FLAGS) $(PYTHON_SOURCES) $(PYTHON_DIRS)
188 .PHONY: flake8
190 pylint:
191 $(PYLINT) $(PYLINT_FLAGS) $(PYTHON_SOURCES) $(ALL_PYTHON_DIRS)
192 .PHONY: pylint
194 requirements:
195 $(PIP) install --requirement extras/requirements.txt
196 $(PIP) install --requirement extras/requirements-dev.txt
197 .PHONY: requirements