From 9dd54c421b835d0dde14291160237d2e176d3869 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 16 Mar 2020 13:53:56 -0300 Subject: [PATCH 1/9] Fixed UnicodeEncodeError: 'charmap' codec can't encode character '\u2068' in position 2724: character maps to for pylib/tests/test_stats.py --- pylib/tests/test_stats.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pylib/tests/test_stats.py b/pylib/tests/test_stats.py index 7de3dc831..045983ac0 100644 --- a/pylib/tests/test_stats.py +++ b/pylib/tests/test_stats.py @@ -1,4 +1,5 @@ -# coding: utf-8 +#!/usr/bin/env python3 +# -*- coding: UTF-8 -*- import os import tempfile @@ -34,6 +35,6 @@ def test_graphs(): d = aopen(os.path.join(dir, "test.anki2")) g = d.stats() rep = g.report() - with open(os.path.join(dir, "test.html"), "w") as f: + with open(os.path.join(dir, "test.html"), "w", encoding="UTF-8") as f: f.write(rep) return From 88ea0b18bf583182ede5c5aa6915646c205c6fa1 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 16 Mar 2020 15:18:37 -0300 Subject: [PATCH 2/9] Fixed test_importing.py unit tests failing on windows with PermissionError: [Errno 13] Permission denied --- pylib/tests/test_importing.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pylib/tests/test_importing.py b/pylib/tests/test_importing.py index fc90dcfe0..b563c1734 100644 --- a/pylib/tests/test_importing.py +++ b/pylib/tests/test_importing.py @@ -18,6 +18,15 @@ srcNotes = None srcCards = None +def clear_tempfile(tf): + """ https://stackoverflow.com/questions/23212435/permission-denied-to-write-to-my-temporary-file """ + try: + tf.close() + os.unlink(tf.name) + except: + pass + + def test_anki2_mediadupes(): tmp = getEmptyCol() # add a note that references a sound @@ -208,13 +217,15 @@ def test_tsv_tag_modified(): n.addTag("four") deck.addNote(n) - with NamedTemporaryFile(mode="w") as tf: + # https://stackoverflow.com/questions/23212435/permission-denied-to-write-to-my-temporary-file + with NamedTemporaryFile(mode="w", delete=False) as tf: tf.write("1\tb\tc\n") tf.flush() i = TextImporter(deck, tf.name) i.initMapping() i.tagModified = "boom" i.run() + clear_tempfile(tf) n.load() assert n["Front"] == "1" @@ -243,13 +254,15 @@ def test_tsv_tag_multiple_tags(): n.addTag("five") deck.addNote(n) - with NamedTemporaryFile(mode="w") as tf: + # https://stackoverflow.com/questions/23212435/permission-denied-to-write-to-my-temporary-file + with NamedTemporaryFile(mode="w", delete=False) as tf: tf.write("1\tb\tc\n") tf.flush() i = TextImporter(deck, tf.name) i.initMapping() i.tagModified = "five six" i.run() + clear_tempfile(tf) n.load() assert n["Front"] == "1" @@ -273,13 +286,15 @@ def test_csv_tag_only_if_modified(): n["Left"] = "3" deck.addNote(n) - with NamedTemporaryFile(mode="w") as tf: + # https://stackoverflow.com/questions/23212435/permission-denied-to-write-to-my-temporary-file + with NamedTemporaryFile(mode="w", delete=False) as tf: tf.write("1,2,3\n") tf.flush() i = TextImporter(deck, tf.name) i.initMapping() i.tagModified = "right" i.run() + clear_tempfile(tf) n.load() assert n.tags == [] From d6f900647b95358ada23f5777b99490c910669db Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 16 Mar 2020 15:39:37 -0300 Subject: [PATCH 3/9] Fixed trailing-newlines.sh not failing when rg is not installed --- .github/scripts/trailing-newlines.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/scripts/trailing-newlines.sh b/.github/scripts/trailing-newlines.sh index e2009df8c..b5fc4bac4 100755 --- a/.github/scripts/trailing-newlines.sh +++ b/.github/scripts/trailing-newlines.sh @@ -1,8 +1,12 @@ #!/bin/bash -set -e +set -eo pipefail -files=$(rg -l '[^\n]\z' -g '!*.{svg,scss,json}' || true) +# Checking version to force it fail the build if rg is not installed. +# Because `set -e` does not work inside the subshell $() +rg --version + +files=$(rg -l '[^\n]\z' -g '!*.{png,svg,scss,json}' || true) if [ "$files" != "" ]; then echo "the following files are missing a newline on the last line:" echo $files From 07a24c0d42a773cb62b8e5a10a70d1ec3d1e96ed Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 16 Mar 2020 15:53:10 -0300 Subject: [PATCH 4/9] Fixed make check for pylint not working on Windows due F:\Python\python.exe: can't open file '/cygdrive/f/anki/pyenv/Scripts/pylint': [Errno 2] No such file or directory --- pylib/Makefile | 10 +++++----- qt/Makefile | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pylib/Makefile b/pylib/Makefile index c78af5bf4..96ed9cfd0 100644 --- a/pylib/Makefile +++ b/pylib/Makefile @@ -33,7 +33,7 @@ PROTODEPS := $(wildcard ../proto/*.proto) .build/hooks: tools/genhooks.py tools/hookslib.py python tools/genhooks.py - black anki/hooks.py + python -m black anki/hooks.py @touch $@ BUILD_STEPS := .build/run-deps .build/dev-deps .build/py-proto anki/buildinfo.py .build/hooks @@ -47,7 +47,7 @@ check: $(BUILD_STEPS) .build/mypy .build/test .build/fmt .build/imports .build/l .PHONY: fix fix: $(BUILD_STEPS) isort $(ISORTARGS) - black $(BLACKARGS) + python -m black $(BLACKARGS) .PHONY: clean clean: @@ -59,7 +59,7 @@ clean: CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py) .build/mypy: $(CHECKDEPS) - mypy anki + python -m mypy anki @touch $@ .build/test: $(CHECKDEPS) @@ -67,7 +67,7 @@ CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py) @touch $@ .build/lint: $(CHECKDEPS) - 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) @@ -75,7 +75,7 @@ CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py) @touch $@ .build/fmt: $(CHECKDEPS) - black --check $(BLACKARGS) + python -m black --check $(BLACKARGS) @touch $@ # Building diff --git a/qt/Makefile b/qt/Makefile index 82cd91292..e6aa5e899 100644 --- a/qt/Makefile +++ b/qt/Makefile @@ -42,7 +42,7 @@ TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss) .build/hooks: tools/genhooks_gui.py ../pylib/tools/hookslib.py python tools/genhooks_gui.py - black aqt/gui_hooks.py + python -m black aqt/gui_hooks.py @touch $@ BUILD_STEPS := .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n @@ -56,7 +56,7 @@ check: $(BUILD_STEPS) .build/mypy .build/test .build/fmt .build/imports .build/l .PHONY: fix fix: $(BUILD_STEPS) isort $(ISORTARGS) - black $(BLACKARGS) + python -m black $(BLACKARGS) (cd ts && npm run pretty) .PHONY: clean @@ -80,7 +80,7 @@ PYLIB := ../pylib CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py) .build/mypy: $(CHECKDEPS) .build/qt-stubs - mypy aqt + python -m mypy aqt @touch $@ .build/test: $(CHECKDEPS) @@ -88,7 +88,7 @@ CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py) @touch $@ .build/lint: $(CHECKDEPS) - 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 --extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py @touch $@ .build/imports: $(CHECKDEPS) @@ -96,7 +96,7 @@ CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py) @touch $@ .build/fmt: $(CHECKDEPS) - black --check $(BLACKARGS) + python -m black --check $(BLACKARGS) @touch $@ .build/qt-stubs: From 51823bf1ff64ad41b5dc2e648401056595118edb Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 16 Mar 2020 15:54:59 -0300 Subject: [PATCH 5/9] Fixed typecheck-setup.sh: sudo: command not found on Windows --- qt/po/scripts/copy-qt-files | 2 +- qt/tools/typecheck-setup.sh | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/qt/po/scripts/copy-qt-files b/qt/po/scripts/copy-qt-files index 0a8a7eb25..71218733a 100755 --- a/qt/po/scripts/copy-qt-files +++ b/qt/po/scripts/copy-qt-files @@ -14,4 +14,4 @@ case "${unameOut}" in ;; esac -rsync -a "$qtTranslations"/qt* "$out" +rsync -a "$qtTranslations/" "$out/" diff --git a/qt/tools/typecheck-setup.sh b/qt/tools/typecheck-setup.sh index 65311f07c..a8c3cca25 100755 --- a/qt/tools/typecheck-setup.sh +++ b/qt/tools/typecheck-setup.sh @@ -6,8 +6,23 @@ # able to resolve. A solution that doesn't require modifying the python install # would be welcome! -TOOLS="$(cd "`dirname "$0"`"; pwd)" -modDir=$(python -c 'import PyQt5, sys, os; print(os.path.dirname(sys.modules["PyQt5"].__file__))') -cmd="rsync -a $TOOLS/stubs/PyQt5/* $modDir/" +set -eo pipefail -$cmd > /dev/null 2>&1 || sudo $cmd +TOOLS="$(cd "`dirname "$0"`"; pwd)" +modDir=$(python -c 'import PyQt5, sys, os; sys.stdout.write(os.path.dirname(sys.modules["PyQt5"].__file__))') + +unameOut="$(uname -s)" +case "${unameOut}" in + CYGWIN*) + modDir="$(cygpath -u "${modDir}")" + ;; +esac + +cmd="rsync -a \"${TOOLS}/stubs/PyQt5/\" \"${modDir}/\"" + +if [[ "w${OS}" == "wWindows_NT" ]]; +then + eval "${cmd}" > /dev/null 2>&1 || eval "${cmd}" +else + eval "${cmd}" > /dev/null 2>&1 || eval "${cmd}" || eval "sudo ${cmd}" +fi From 034ac10cf46e8cf26982fcef87864bc3c751ce09 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Tue, 17 Mar 2020 00:24:37 -0300 Subject: [PATCH 6/9] Fixed error: Incompatible types in assignment on qt/aqt/main.py aqt\main.py:1437: error: Incompatible types in assignment (expression has type Module, variable has type "LibraryLoader[WinDLL]") [assignment] _dummy = wintypes ^ --- qt/aqt/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 3f3034bb5..7b17bf50f 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1430,11 +1430,11 @@ will be lost. Continue?""" self.maybeHideAccelerators() self.hideStatusTips() elif isWin: - # make sure ctypes is bundled from ctypes import windll, wintypes # type: ignore - _dummy = windll - _dummy = wintypes + # make sure ctypes is bundled + _dummy1 = windll + _dummy2 = wintypes def maybeHideAccelerators(self, tgt: Optional[Any] = None) -> None: if not self.hideMenuAccels: From 802c5b59cb3e7e7a241c764ef92f117f4510f4c6 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Tue, 17 Mar 2020 01:11:49 -0300 Subject: [PATCH 7/9] 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. --- Makefile | 2 +- pylib/Makefile | 21 +++++++++++++++++++-- pylib/mypy.ini | 1 - qt/Makefile | 24 ++++++++++++++++++++++-- qt/mypy.ini | 1 - rspy/Makefile | 2 +- 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index fdfa2c182..5ade34310 100644 --- a/Makefile +++ b/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 diff --git a/pylib/Makefile b/pylib/Makefile index 96ed9cfd0..a81d32416 100644 --- a/pylib/Makefile +++ b/pylib/Makefile @@ -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) diff --git a/pylib/mypy.ini b/pylib/mypy.ini index 4215061bb..6ad6b351b 100644 --- a/pylib/mypy.ini +++ b/pylib/mypy.ini @@ -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 diff --git a/qt/Makefile b/qt/Makefile index e6aa5e899..ce9f8961f 100644 --- a/qt/Makefile +++ b/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) diff --git a/qt/mypy.ini b/qt/mypy.ini index 5d5a5ca40..a69375016 100644 --- a/qt/mypy.ini +++ b/qt/mypy.ini @@ -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 diff --git a/rspy/Makefile b/rspy/Makefile index 798a67515..49c5237b6 100644 --- a/rspy/Makefile +++ b/rspy/Makefile @@ -5,7 +5,7 @@ ifndef OS OS := unknown endif -ifeq ($(OS),Windows_NT) +ifeq (${OS},Windows_NT) ifndef PYTHON_BIN PYTHON_BIN := python endif From 1ade1a1a0f79b8d6a4343e02fdd6a799115467e3 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Wed, 18 Mar 2020 11:36:32 -0300 Subject: [PATCH 8/9] Fixed moved comment line on qt/aqt/main.py, long variables names on pylib/Makefile and qt/Makefile, and rg --version not going to /dev/null on .github/scripts/trailing-newlines.sh --- .github/scripts/trailing-newlines.sh | 2 +- pylib/Makefile | 8 +++----- qt/Makefile | 14 ++++++-------- qt/aqt/main.py | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/scripts/trailing-newlines.sh b/.github/scripts/trailing-newlines.sh index b5fc4bac4..cf27e9695 100755 --- a/.github/scripts/trailing-newlines.sh +++ b/.github/scripts/trailing-newlines.sh @@ -4,7 +4,7 @@ set -eo pipefail # Checking version to force it fail the build if rg is not installed. # Because `set -e` does not work inside the subshell $() -rg --version +rg --version > /dev/null 2>&1 files=$(rg -l '[^\n]\z' -g '!*.{png,svg,scss,json}' || true) if [ "$files" != "" ]; then diff --git a/pylib/Makefile b/pylib/Makefile index a81d32416..a168d00dc 100644 --- a/pylib/Makefile +++ b/pylib/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find) -MYPY_IGNORED_IMPORTS := +MYPY_ARGS := ifndef OS OS := unknown @@ -12,9 +12,7 @@ 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 + MYPY_ARGS := --warn-unused-ignores endif .SHELLFLAGS := -eu -o pipefail -c @@ -75,7 +73,7 @@ clean: CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py) .build/mypy: $(CHECKDEPS) - python -m mypy ${MYPY_IGNORED_IMPORTS} anki + python -m mypy ${MYPY_ARGS} anki @touch $@ .build/test: $(CHECKDEPS) diff --git a/qt/Makefile b/qt/Makefile index ce9f8961f..9793e0cb8 100644 --- a/qt/Makefile +++ b/qt/Makefile @@ -1,7 +1,7 @@ SHELL := /bin/bash FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find) -MYPY_IGNORED_IMPORTS := -PYLINT_IGNORED_MODULES := +MYPY_ARGS := +PYLINT_ARGS := ifndef OS OS := unknown @@ -13,11 +13,9 @@ 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 + MYPY_ARGS := --warn-unused-ignores else - PYLINT_IGNORED_MODULES := --ignored-modules=win32file,pywintypes,socket,win32pipe + PYLINT_ARGS := --ignored-modules=win32file,pywintypes,socket,win32pipe endif .SHELLFLAGS := -eu -o pipefail -c @@ -99,7 +97,7 @@ PYLIB := ../pylib CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py) .build/mypy: $(CHECKDEPS) .build/qt-stubs - python -m mypy ${MYPY_IGNORED_IMPORTS} aqt + python -m mypy ${MYPY_ARGS} aqt @touch $@ .build/test: $(CHECKDEPS) @@ -107,7 +105,7 @@ CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py) @touch $@ .build/lint: $(CHECKDEPS) - python -m pylint -j 0 --rcfile=.pylintrc -f colorized ${PYLINT_IGNORED_MODULES} \ + python -m pylint -j 0 --rcfile=.pylintrc -f colorized ${PYLINT_ARGS} \ --extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py @touch $@ diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 7b17bf50f..b31d40ebe 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1430,9 +1430,9 @@ will be lost. Continue?""" self.maybeHideAccelerators() self.hideStatusTips() elif isWin: + # make sure ctypes is bundled from ctypes import windll, wintypes # type: ignore - # make sure ctypes is bundled _dummy1 = windll _dummy2 = wintypes From 6c8b005cab67417d352ef0db8f984e4b58cfaa77 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 23 Mar 2020 18:54:24 -0300 Subject: [PATCH 9/9] Deprecated eval usage on qt/tools/typecheck-setup.sh --- qt/tools/typecheck-setup.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qt/tools/typecheck-setup.sh b/qt/tools/typecheck-setup.sh index a8c3cca25..93cca0447 100755 --- a/qt/tools/typecheck-setup.sh +++ b/qt/tools/typecheck-setup.sh @@ -18,11 +18,9 @@ case "${unameOut}" in ;; esac -cmd="rsync -a \"${TOOLS}/stubs/PyQt5/\" \"${modDir}/\"" - -if [[ "w${OS}" == "wWindows_NT" ]]; +if [[ "w${OS}" == "wWindows_NT" ]]; then - eval "${cmd}" > /dev/null 2>&1 || eval "${cmd}" + rsync -a "${TOOLS}/stubs/PyQt5/" "${modDir}/" else - eval "${cmd}" > /dev/null 2>&1 || eval "${cmd}" || eval "sudo ${cmd}" + rsync -a "${TOOLS}/stubs/PyQt5/" "${modDir}/" || sudo rsync -a "${TOOLS}/stubs/PyQt5/" "${modDir}/" fi