Debian Codegraph @

Makefile

raw
1 # This makefile is used only for running pytype checks.
2 #
3 # To prepare:
4 # sudo apt install ninja
5 # pip install pytype
6 #
7 # To run checks:
8 # make pytype
9 #
10 # Usually you will set
11 # HGPATH - to Mercurial sources directory
12 # MEUPATH - to mercurial_extension_utils directory
13 # unless defaults below are OK
14
15 PYTHON = python
16 PYTYPE = pytype
17 PYTHON_VERSION = $(shell $(PYTHON) -c 'import sys; print("{0.major}.{0.minor}".format(sys.version_info))')
18
19 HGPATH ?= ../../mercurial_tracked/hg-stable
20 MEUPATH ?= ../extension_utils
21
22 ifneq ($(HGPATH),)
23 export PYTHONPATH := $(realpath $(HGPATH)):$(PYTHONPATH)
24 endif
25 ifneq ($(MEUPATH),)
26 export PYTHONPATH := $(realpath $(MEUPATH)):$(PYTHONPATH)
27 endif
28
29
30 .PHONY: help
31 help:
32 @echo 'Commonly used make targets:'
33 @echo ' pytype - run pytype checks on the source tree'
34
35 .PHONY: pytype
36 pytype:
37 @ # [ -n "$(HGPATH)" ] || { echo "HGPATH not specified"; false; }
38 @ # [ -d "$(HGPATH)" ] || { echo "HGPATH not found: $(HGPATH)"; false; }
39 $(PYTYPE) -P ".:$(HGPATH):$(MEUPATH)" -V "$(PYTHON_VERSION)" -j auto \
40 --config pytype.cfg
41 @echo 'pytype crashed while generating the following type stubs:'
42 find .pytype/pyi -name '*.pyi' | xargs grep -l '# Caught error' | sort
43
44 .PHONY: clean
45 clean:
46 $(PYTHON) setup.py clean
47 $(RM) -R .pytype