mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
Fixed mypy and pylint not building on Windows
1. error: unused 'type: ignore' comment 2. Module 'pywintypes' has no 'error' member 3. Module 'win32pipe' has no 'SetNamedPipeHandleState' member, but source is unavailable. Consider adding this module to extension-pkg-whitelist if you want to perform analysis based on run-time introspection of living objects.
This commit is contained in:
parent
034ac10cf4
commit
802c5b59cb
6 changed files with 43 additions and 8 deletions
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ ifndef OS
|
|||
OS := unknown
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq (${OS},Windows_NT)
|
||||
ifndef ACTIVATE_SCRIPT
|
||||
ACTIVATE_SCRIPT := pyenv/Scripts/activate
|
||||
endif
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
SHELL := /bin/bash
|
||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
||||
MYPY_IGNORED_IMPORTS :=
|
||||
|
||||
ifndef OS
|
||||
OS := unknown
|
||||
endif
|
||||
|
||||
ifndef UNAME
|
||||
UNAME := unknown
|
||||
endif
|
||||
|
||||
# https://anki.tenderapp.com/discussions/beta-testing/1860-error-unused-type-ignore-comment
|
||||
ifneq (${OS},Windows_NT)
|
||||
ifneq (${UNAME},Darwin)
|
||||
MYPY_IGNORED_IMPORTS := --warn-unused-ignores
|
||||
endif
|
||||
endif
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
|
@ -59,7 +75,7 @@ clean:
|
|||
CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py)
|
||||
|
||||
.build/mypy: $(CHECKDEPS)
|
||||
python -m mypy anki
|
||||
python -m mypy ${MYPY_IGNORED_IMPORTS} anki
|
||||
@touch $@
|
||||
|
||||
.build/test: $(CHECKDEPS)
|
||||
|
@ -67,7 +83,8 @@ CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py)
|
|||
@touch $@
|
||||
|
||||
.build/lint: $(CHECKDEPS)
|
||||
python -m pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=ankirspy anki tests setup.py
|
||||
python -m pylint -j 0 --rcfile=.pylintrc -f colorized \
|
||||
--extension-pkg-whitelist=ankirspy anki tests setup.py
|
||||
@touch $@
|
||||
|
||||
.build/imports: $(CHECKDEPS)
|
||||
|
|
|
@ -7,7 +7,6 @@ check_untyped_defs = true
|
|||
disallow_untyped_decorators = True
|
||||
warn_redundant_casts = True
|
||||
warn_unused_configs = True
|
||||
warn_unused_ignores = True
|
||||
|
||||
[mypy-win32file]
|
||||
ignore_missing_imports = True
|
||||
|
|
24
qt/Makefile
24
qt/Makefile
|
@ -1,5 +1,24 @@
|
|||
SHELL := /bin/bash
|
||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
||||
MYPY_IGNORED_IMPORTS :=
|
||||
PYLINT_IGNORED_MODULES :=
|
||||
|
||||
ifndef OS
|
||||
OS := unknown
|
||||
endif
|
||||
|
||||
ifndef UNAME
|
||||
UNAME := unknown
|
||||
endif
|
||||
|
||||
# https://anki.tenderapp.com/discussions/beta-testing/1860-error-unused-type-ignore-comment
|
||||
ifneq (${OS},Windows_NT)
|
||||
ifneq (${UNAME},Darwin)
|
||||
MYPY_IGNORED_IMPORTS := --warn-unused-ignores
|
||||
endif
|
||||
else
|
||||
PYLINT_IGNORED_MODULES := --ignored-modules=win32file,pywintypes,socket,win32pipe
|
||||
endif
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
|
@ -80,7 +99,7 @@ PYLIB := ../pylib
|
|||
CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py)
|
||||
|
||||
.build/mypy: $(CHECKDEPS) .build/qt-stubs
|
||||
python -m mypy aqt
|
||||
python -m mypy ${MYPY_IGNORED_IMPORTS} aqt
|
||||
@touch $@
|
||||
|
||||
.build/test: $(CHECKDEPS)
|
||||
|
@ -88,7 +107,8 @@ CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py)
|
|||
@touch $@
|
||||
|
||||
.build/lint: $(CHECKDEPS)
|
||||
python -m pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py
|
||||
python -m pylint -j 0 --rcfile=.pylintrc -f colorized ${PYLINT_IGNORED_MODULES} \
|
||||
--extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py
|
||||
@touch $@
|
||||
|
||||
.build/imports: $(CHECKDEPS)
|
||||
|
|
|
@ -6,7 +6,6 @@ show_error_codes = true
|
|||
disallow_untyped_decorators = True
|
||||
warn_redundant_casts = True
|
||||
warn_unused_configs = True
|
||||
warn_unused_ignores = True
|
||||
|
||||
[mypy-win32file]
|
||||
ignore_missing_imports = True
|
||||
|
|
|
@ -5,7 +5,7 @@ ifndef OS
|
|||
OS := unknown
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq (${OS},Windows_NT)
|
||||
ifndef PYTHON_BIN
|
||||
PYTHON_BIN := python
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue