2020-01-02 10:43:19 +01:00
|
|
|
SHELL := bash
|
|
|
|
.SHELLFLAGS := -eu -o pipefail -c
|
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
MAKEFLAGS += --warn-undefined-variables
|
|
|
|
MAKEFLAGS += --no-builtin-rules
|
|
|
|
.SUFFIXES:
|
|
|
|
|
2020-01-13 05:38:05 +01:00
|
|
|
BLACKARGS := -t py36 aqt tests setup.py tools/*.py --exclude='aqt/forms|buildinfo'
|
2020-01-06 06:27:59 +01:00
|
|
|
ISORTARGS := aqt tests setup.py
|
2020-01-02 10:43:19 +01:00
|
|
|
|
2020-01-03 05:32:26 +01:00
|
|
|
$(shell mkdir -p .build ../dist)
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
PHONY: all
|
|
|
|
all: check
|
|
|
|
|
|
|
|
.build/run-deps: setup.py
|
|
|
|
pip install -e .
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/dev-deps: requirements.dev
|
|
|
|
pip install -r requirements.dev
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/ui: $(shell find designer -type f)
|
|
|
|
./tools/build_ui.sh
|
|
|
|
@touch $@
|
|
|
|
|
2020-01-02 23:24:59 +01:00
|
|
|
.build/i18n: $(wildcard i18n/translations/anki.pot/*)
|
|
|
|
(cd i18n && ./build-mo-files && ./copy-qt-files)
|
|
|
|
@touch $@
|
|
|
|
|
2020-01-02 10:43:19 +01:00
|
|
|
TSDEPS := $(wildcard ts/src/*.ts)
|
|
|
|
|
|
|
|
.build/js: $(TSDEPS)
|
|
|
|
(cd ts && npm i && npm run build)
|
|
|
|
@touch $@
|
|
|
|
|
2020-01-15 00:11:20 +01:00
|
|
|
.build/hooks: tools/genhooks_gui.py ../pylib/tools/hookslib.py
|
|
|
|
python tools/genhooks_gui.py
|
2020-01-13 08:55:58 +01:00
|
|
|
black aqt/gui_hooks.py
|
2020-01-13 05:38:05 +01:00
|
|
|
@touch $@
|
|
|
|
|
2020-01-13 05:55:32 +01:00
|
|
|
BUILD_STEPS := .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
# Checking
|
|
|
|
######################
|
|
|
|
|
|
|
|
.PHONY: check
|
|
|
|
check: $(BUILD_STEPS) .build/mypy .build/test .build/fmt .build/imports .build/lint .build/ts-fmt
|
|
|
|
|
|
|
|
.PHONY: fix
|
|
|
|
fix: $(BUILD_STEPS)
|
|
|
|
isort $(ISORTARGS)
|
|
|
|
black $(BLACKARGS)
|
|
|
|
(cd ts && npm run pretty)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf .build aqt.egg-info build dist
|
|
|
|
|
|
|
|
# Checking Typescript
|
|
|
|
######################
|
|
|
|
|
|
|
|
JSDEPS := $(patsubst ts/src/%.ts, web/%.js, $(TSDEPS))
|
|
|
|
|
|
|
|
.build/ts-fmt: $(TSDEPS)
|
|
|
|
(cd ts && npm i && npm run check-pretty)
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
# Checking python
|
|
|
|
######################
|
|
|
|
|
2020-01-02 22:48:38 +01:00
|
|
|
PYLIB := ../pylib
|
2020-01-02 10:43:19 +01:00
|
|
|
|
2020-01-06 10:30:54 +01:00
|
|
|
CHECKDEPS := $(shell find aqt tests -name '*.py' | grep -v buildinfo.py)
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
.build/mypy: $(CHECKDEPS) .build/qt-stubs
|
2020-01-12 22:25:23 +01:00
|
|
|
mypy aqt
|
2020-01-02 10:43:19 +01:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/test: $(CHECKDEPS)
|
2020-01-08 06:52:51 +01:00
|
|
|
python -m pytest -s
|
2020-01-02 10:43:19 +01:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/lint: $(CHECKDEPS)
|
2020-01-06 06:27:59 +01:00
|
|
|
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py
|
2020-01-02 10:43:19 +01:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/imports: $(CHECKDEPS)
|
|
|
|
isort $(ISORTARGS) --check
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/fmt: $(CHECKDEPS)
|
|
|
|
black --check $(BLACKARGS)
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.build/qt-stubs:
|
|
|
|
./tools/typecheck-setup.sh
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
# Building
|
|
|
|
######################
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: $(BUILD_STEPS)
|
2020-01-15 01:07:39 +01:00
|
|
|
rm -rf dist build
|
2020-01-04 01:44:35 +01:00
|
|
|
python setup.py -q bdist_wheel
|
2020-01-03 05:32:26 +01:00
|
|
|
rsync -a dist/*.whl ../dist/
|
2020-01-02 10:43:19 +01:00
|
|
|
|
|
|
|
.PHONY: develop
|
|
|
|
develop: $(BUILD_STEPS)
|
2020-01-03 06:15:18 +01:00
|
|
|
|
|
|
|
aqt/buildinfo.py: ../meta/version ../meta/buildhash
|
|
|
|
echo "buildhash='$$(cat ../meta/buildhash)'" > $@
|
|
|
|
echo "version='$$(cat ../meta/version)'" >> $@
|