mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

Earlier today I pushed a change that split this code up into multiple repos, but that has proved to complicate things too much. So we're back to a single repo, except the individual submodules are better separated than they were before. The README files need updating again; I will push them out soon. Aside from splitting out the different modules, the sound code has moved from from anki to aqt.
87 lines
1.9 KiB
Makefile
87 lines
1.9 KiB
Makefile
PREFIX := /usr
|
|
SHELL := bash
|
|
.SHELLFLAGS := -eu -o pipefail -c
|
|
.DELETE_ON_ERROR:
|
|
MAKEFLAGS += --warn-undefined-variables
|
|
MAKEFLAGS += --no-builtin-rules
|
|
RUNARGS :=
|
|
.SUFFIXES:
|
|
BLACKARGS := -t py36 anki tests --exclude=backend_pb2
|
|
ISORTARGS := anki tests
|
|
|
|
$(shell mkdir -p .build ../build)
|
|
|
|
PHONY: all
|
|
all: check
|
|
|
|
.build/run-deps: setup.py
|
|
pip install -e .
|
|
@touch $@
|
|
|
|
.build/dev-deps: requirements.dev
|
|
pip install -r requirements.dev
|
|
@touch $@
|
|
|
|
PROTODEPS := $(wildcard ../proto/*.proto)
|
|
|
|
.build/py-proto: .build/dev-deps $(PROTODEPS)
|
|
protoc --proto_path=../proto --python_out=anki --mypy_out=anki $(PROTODEPS)
|
|
@touch $@
|
|
|
|
BUILD_STEPS := .build/run-deps .build/dev-deps .build/py-proto
|
|
|
|
# Checking
|
|
######################
|
|
|
|
.PHONY: check
|
|
check: $(BUILD_STEPS) .build/mypy .build/test .build/fmt .build/imports .build/lint
|
|
|
|
.PHONY: fix
|
|
fix: $(BUILD_STEPS)
|
|
isort $(ISORTARGS)
|
|
black $(BLACKARGS)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf .build anki.egg-info build dist
|
|
|
|
# Checking python
|
|
######################
|
|
|
|
CHECKDEPS := $(shell find anki tests -name '*.py' | grep -v buildhash.py)
|
|
|
|
.build/mypy: $(CHECKDEPS)
|
|
mypy anki
|
|
@touch $@
|
|
|
|
.build/test: $(CHECKDEPS)
|
|
python -m nose2 --plugin=nose2.plugins.mp -N 16
|
|
@touch $@
|
|
|
|
.build/lint: $(CHECKDEPS)
|
|
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=ankirspy anki
|
|
@touch $@
|
|
|
|
.build/imports: $(CHECKDEPS)
|
|
isort $(ISORTARGS) --check
|
|
@touch $@
|
|
|
|
.build/fmt: $(CHECKDEPS)
|
|
black --check $(BLACKARGS)
|
|
@touch $@
|
|
|
|
# Building
|
|
######################
|
|
|
|
# we only want the wheel when building, but passing -f wheel to poetry
|
|
# breaks the inclusion of files listed in pyproject.toml
|
|
.PHONY: build
|
|
build: $(BUILD_STEPS) $(CHECKDEPS)
|
|
rm -rf dist
|
|
echo "build='$$(git rev-parse --short HEAD)'" > anki/buildhash.py
|
|
python setup.py bdist_wheel
|
|
rsync -a dist/*.whl ../build/
|
|
|
|
# prepare code for running in place
|
|
.PHONY: develop
|
|
develop: $(BUILD_STEPS)
|