19f1c98025
1. Documented on README.development how to setup the environment for Windows. 2. Fixed qt/ts/package.json not working due usage of ; instead of && 3. Fixed copy-qt-files rsync using Windows paths instead of Unix ones 4. Fixed Makefile's using Windows Linux Subsystem bash instead of the Cygwin one. 5. Ensured running the correct pip module by using python -m pip instead of just pip. 6. Fixed Makefiles using Windows `find` command, instead of the Cygwin's one (POSIX find). 7. Fixed pyenv sourcing/activate using /pyevn/bin/ instead of /python/Scripts/ on Windows. 8. Fixed pyaudio not installing/linking with portaudio on Windows by installing for a patched fork at evandroforks/pyaudio 9. Forked and fixed portaudio not building with Visual Studio 2017 or superior and added the reference for the patched fork on README.development at evandroforks/portaudio.
98 lines
2.2 KiB
Makefile
98 lines
2.2 KiB
Makefile
SHELL := /bin/bash
|
|
ECHOCMD := /bin/echo -e
|
|
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
|
|
|
|
.SHELLFLAGS := -eu -o pipefail -c
|
|
.DELETE_ON_ERROR:
|
|
MAKEFLAGS += --warn-undefined-variables
|
|
MAKEFLAGS += --no-builtin-rules
|
|
RUNARGS :=
|
|
.SUFFIXES:
|
|
BLACKARGS := -t py36 anki tests setup.py tools/*.py --exclude='_pb2|buildinfo'
|
|
ISORTARGS := anki tests setup.py
|
|
|
|
$(shell mkdir -p .build ../dist)
|
|
|
|
PHONY: all
|
|
all: check
|
|
|
|
.build/run-deps: setup.py
|
|
python -m pip install -e .
|
|
@touch $@
|
|
|
|
.build/dev-deps: requirements.dev
|
|
python -m 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)
|
|
perl -i'' -pe 's/from fluent_pb2/from anki.fluent_pb2/' anki/backend_pb2.pyi
|
|
perl -i'' -pe 's/import fluent_pb2/import anki.fluent_pb2/' anki/backend_pb2.py
|
|
@touch $@
|
|
|
|
.build/hooks: tools/genhooks.py tools/hookslib.py
|
|
python tools/genhooks.py
|
|
black anki/hooks.py
|
|
@touch $@
|
|
|
|
BUILD_STEPS := .build/run-deps .build/dev-deps .build/py-proto anki/buildinfo.py .build/hooks
|
|
|
|
# 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_EXEC} anki tests -name '*.py' | grep -v buildinfo.py)
|
|
|
|
.build/mypy: $(CHECKDEPS)
|
|
mypy anki
|
|
@touch $@
|
|
|
|
.build/test: $(CHECKDEPS)
|
|
python -m pytest --durations=1 -s
|
|
@touch $@
|
|
|
|
.build/lint: $(CHECKDEPS)
|
|
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=ankirspy anki tests setup.py
|
|
@touch $@
|
|
|
|
.build/imports: $(CHECKDEPS)
|
|
isort $(ISORTARGS) --check
|
|
@touch $@
|
|
|
|
.build/fmt: $(CHECKDEPS)
|
|
black --check $(BLACKARGS)
|
|
@touch $@
|
|
|
|
# Building
|
|
######################
|
|
|
|
.PHONY: build
|
|
build: $(BUILD_STEPS) $(CHECKDEPS)
|
|
rm -rf dist build
|
|
python setup.py -q bdist_wheel
|
|
rsync -a dist/*.whl ../dist/
|
|
|
|
# prepare code for running in place
|
|
.PHONY: develop
|
|
develop: $(BUILD_STEPS)
|
|
|
|
anki/buildinfo.py: ../meta/version ../meta/buildhash
|
|
echo "buildhash='$$(cat ../meta/buildhash)'" > $@
|
|
echo "version='$$(cat ../meta/version)'" >> $@
|