Page MenuHomeSoftware Heritage

Makefile.python
No OneTemporary

Makefile.python

# -*- mode: Makefile -*-
PYMODULE := $(shell basename `pwd` | sed 's/-/./g')
PYDIR := $(shell basename `pwd` | sed 's%-%/%g')
PYTHON_BIN := $(shell test -d bin/ && find bin/ -type f -executable | xargs egrep -H '^\#.*python' | cut -f 1 -d :)
TEST_DIRS := .
TEST = python3 -m pytest
TESTFLAGS =
CODESPELL = codespell
CODESPELLFLAGS =
FLAKE = python3 -m flake8
FLAKEFLAGS =
LINT = pylint3
LINTFLAGS = --rcfile=../pylintrc
MYPY = mypy
MYPYFLAGS =
all:
.PHONY: test
test:
$(TEST) $(TESTFLAGS) $(TEST_DIRS)
.PHONY: coverage
coverage:
$(TEST) $(TESTFLAGS) --cov=$(PYMODULE) --cov-branch $(TEST_DIRS)
.PHONY: check check-flake check-codespell
check: check-flake check-codespell check-mypy
check-flake:
$(FLAKE) $(FLAKEFLAGS) swh $(PYTHON_BIN)
check-codespell:
find swh docs -name '*.py' -o -name '*.rst' | xargs -r $(CODESPELL) $(CODESPELLFLAGS)
find . -maxdepth 1 -iname 'readme*' | xargs -r $(CODESPELL) $(CODESPELLFLAGS)
typecheck: check-mypy
check-mypy:
$(MYPY) $(MYPYFLAGS) swh
.PHONY: check-staged
check-staged:
git diff -z --staged --name-only -- '*.py' $(PYTHON_BIN) \
| xargs -0 -L1 -i'{}' /bin/sh -c \
"git show ':{}' | $(FLAKE) $(FLAKEFLAGS) --stdin-display-name '{}' -"
.PHONY: lint
lint:
$(LINT) $(LINTFLAGS) $(PYMODULE)
.PHONY: docs
docs:
make -C docs
.PHONY: distclean
# clean up Python bytecode files. Also consider random *.pyc files, in case
# Python 2.x has been run by mistake
distclean:
find . -type d -name __pycache__ | xargs rm -rf
find . -type f -name '*.pyc' -delete

File Metadata

Mime Type
text/x-makefile
Expires
Fri, Jul 4, 1:45 PM (3 d, 20 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3287497

Event Timeline