From e92eeda040163c573937cbe6d56cb9abe7e0fd99 Mon Sep 17 00:00:00 2001 From: abdo Date: Fri, 18 Dec 2020 23:34:42 +0300 Subject: [PATCH 001/179] Strip isolation characters from app link Reported in https://forums.ankiweb.net/t/bug-link-in-about-window/5894 --- qt/aqt/about.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt/aqt/about.py b/qt/aqt/about.py index adac5bc64..f61c6c83c 100644 --- a/qt/aqt/about.py +++ b/qt/aqt/about.py @@ -5,6 +5,7 @@ import platform import time import aqt.forms +from anki.lang import without_unicode_isolation from anki.utils import versionWithBuild from aqt.addons import AddonManager, AddonMeta from aqt.qt import * @@ -100,7 +101,10 @@ def show(mw): QT_VERSION_STR, PYQT_VERSION_STR, ) - abouttext += tr(TR.ABOUT_VISIT_WEBSITE, val=aqt.appWebsite) + "" + abouttext += ( + without_unicode_isolation(tr(TR.ABOUT_VISIT_WEBSITE, val=aqt.appWebsite)) + + "" + ) # automatically sorted; add new lines at the end allusers = sorted( From ef1f58c8b6225775a7736d534215b461c8402f2a Mon Sep 17 00:00:00 2001 From: k12ish Date: Sat, 19 Dec 2020 17:59:07 +0000 Subject: [PATCH 002/179] Added method --- pylib/anki/collection.py | 10 ++++++++++ qt/aqt/deckbrowser.py | 10 +++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 77eab8716..28a67ab6f 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -379,6 +379,16 @@ class Collection: def cardCount(self) -> Any: return self.db.scalar("select count() from cards") + def card_count_from_did(self, did, recursive=False): + dids = [did] + if recursive: + dids += [r[1] for r in self.decks.children(did)] + count = self.db.scalar( + "select count() from cards where did in {0} or " + "odid in {0}".format(ids2str(dids)) + ) + return count + def remove_cards_and_orphaned_notes(self, card_ids: Sequence[int]): "You probably want .remove_notes_by_card() instead." self.backend.remove_cards(card_ids=card_ids) diff --git a/qt/aqt/deckbrowser.py b/qt/aqt/deckbrowser.py index 00f63f2e0..11946be0f 100644 --- a/qt/aqt/deckbrowser.py +++ b/qt/aqt/deckbrowser.py @@ -278,13 +278,9 @@ class DeckBrowser: self.mw.checkpoint(tr(TR.DECKS_DELETE_DECK)) deck = self.mw.col.decks.get(did) if not deck["dyn"]: - dids = [did] + [r[1] for r in self.mw.col.decks.children(did)] - cnt = self.mw.col.db.scalar( - "select count() from cards where did in {0} or " - "odid in {0}".format(ids2str(dids)) - ) - if cnt: - extra = tr(TR.DECKS_IT_HAS_CARD, count=cnt) + count = self.mw.col.card_count_from_did(did, recursive=True) + if count: + extra = tr(TR.DECKS_IT_HAS_CARD, count=count) else: extra = None if ( From cc0572a3854de9a6fb4429bb8686c6838d5e49f6 Mon Sep 17 00:00:00 2001 From: k12ish Date: Sat, 19 Dec 2020 18:12:58 +0000 Subject: [PATCH 003/179] Added type hints, renamed kwarg --- pylib/anki/collection.py | 6 +++--- qt/aqt/deckbrowser.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 28a67ab6f..1b47dbc10 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -379,9 +379,9 @@ class Collection: def cardCount(self) -> Any: return self.db.scalar("select count() from cards") - def card_count_from_did(self, did, recursive=False): - dids = [did] - if recursive: + def card_count_from_did(self, did: int, count_subdecks: bool = False) -> Any: + dids: List[int] = [did] + if count_subdecks: dids += [r[1] for r in self.decks.children(did)] count = self.db.scalar( "select count() from cards where did in {0} or " diff --git a/qt/aqt/deckbrowser.py b/qt/aqt/deckbrowser.py index 11946be0f..eb3a3adcf 100644 --- a/qt/aqt/deckbrowser.py +++ b/qt/aqt/deckbrowser.py @@ -265,7 +265,7 @@ class DeckBrowser: node.collapsed = not node.collapsed self._renderPage(reuse=True) - def _dragDeckOnto(self, draggedDeckDid, ontoDeckDid): + def _dragDeckOnto(self, draggedDeckDid: int, ontoDeckDid: int): try: self.mw.col.decks.renameForDragAndDrop(draggedDeckDid, ontoDeckDid) gui_hooks.sidebar_should_refresh_decks() @@ -274,11 +274,11 @@ class DeckBrowser: self.show() - def _delete(self, did): + def _delete(self, did: int): self.mw.checkpoint(tr(TR.DECKS_DELETE_DECK)) deck = self.mw.col.decks.get(did) if not deck["dyn"]: - count = self.mw.col.card_count_from_did(did, recursive=True) + count = self.mw.col.card_count_from_did(did, count_subdecks=True) if count: extra = tr(TR.DECKS_IT_HAS_CARD, count=count) else: From e99a7c0f90cebc4b40215501fed5627d0350bed1 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 20 Dec 2020 10:26:16 +1000 Subject: [PATCH 004/179] tweak naming and move method into col.decks --- pylib/anki/collection.py | 10 ---------- pylib/anki/decks.py | 10 ++++++++++ qt/aqt/deckbrowser.py | 5 ++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 1b47dbc10..77eab8716 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -379,16 +379,6 @@ class Collection: def cardCount(self) -> Any: return self.db.scalar("select count() from cards") - def card_count_from_did(self, did: int, count_subdecks: bool = False) -> Any: - dids: List[int] = [did] - if count_subdecks: - dids += [r[1] for r in self.decks.children(did)] - count = self.db.scalar( - "select count() from cards where did in {0} or " - "odid in {0}".format(ids2str(dids)) - ) - return count - def remove_cards_and_orphaned_notes(self, card_ids: Sequence[int]): "You probably want .remove_notes_by_card() instead." self.backend.remove_cards(card_ids=card_ids) diff --git a/pylib/anki/decks.py b/pylib/anki/decks.py index 675da7c21..2c0132b5a 100644 --- a/pylib/anki/decks.py +++ b/pylib/anki/decks.py @@ -210,6 +210,16 @@ class DeckManager: def count(self) -> int: return len(self.all_names_and_ids()) + def card_count(self, did: int, include_subdecks: bool) -> Any: + dids: List[int] = [did] + if include_subdecks: + dids += [r[1] for r in self.children(did)] + count = self.col.db.scalar( + "select count() from cards where did in {0} or " + "odid in {0}".format(ids2str(dids)) + ) + return count + def get(self, did: Union[int, str], default: bool = True) -> Optional[Deck]: if not did: if default: diff --git a/qt/aqt/deckbrowser.py b/qt/aqt/deckbrowser.py index eb3a3adcf..24f0f9df0 100644 --- a/qt/aqt/deckbrowser.py +++ b/qt/aqt/deckbrowser.py @@ -277,12 +277,11 @@ class DeckBrowser: def _delete(self, did: int): self.mw.checkpoint(tr(TR.DECKS_DELETE_DECK)) deck = self.mw.col.decks.get(did) + extra = None if not deck["dyn"]: - count = self.mw.col.card_count_from_did(did, count_subdecks=True) + count = self.mw.col.decks.card_count(did, include_subdecks=True) if count: extra = tr(TR.DECKS_IT_HAS_CARD, count=count) - else: - extra = None if ( deck["dyn"] or not extra From 165007180abcdf83bff3aa31e76abc34ce752450 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 20 Dec 2020 10:54:51 +1000 Subject: [PATCH 005/179] add winrt for TTS work https://github.com/ankitects/anki/pull/855 Also update psutil version --- pip/requirements.in | 1 + pip/requirements.txt | 3 ++- qt/aqt/BUILD.bazel | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pip/requirements.in b/pip/requirements.in index aeb852182..d66356a2e 100644 --- a/pip/requirements.in +++ b/pip/requirements.in @@ -25,6 +25,7 @@ fluent-syntax # windows only psutil; sys.platform == "win32" pywin32; sys.platform == "win32" +winrt==1.0.20239.1; sys.platform == "win32" and platform_release == "10" # transitive windows dependencies atomicwrites; sys.platform == "win32" # via pytest diff --git a/pip/requirements.txt b/pip/requirements.txt index bff2336d8..e0efec0de 100644 --- a/pip/requirements.txt +++ b/pip/requirements.txt @@ -35,7 +35,7 @@ pathspec==0.8.1 # via black pip-tools==5.4.0 # via -r requirements.in pluggy==0.13.1 # via pytest protobuf==3.14.0 # via -r requirements.in, mypy-protobuf -psutil==5.7.3 ; sys_platform == "win32" # via -r requirements.in +psutil==5.8.0 ; sys_platform == "win32" # via -r requirements.in py==1.10.0 # via pytest pylint==2.6.0 # via -r requirements.in pyparsing==2.4.7 # via packaging @@ -57,6 +57,7 @@ typing-extensions==3.7.4.3 # via black, mypy urllib3==1.26.2 # via requests waitress==1.4.4 # via -r requirements.in werkzeug==1.0.1 # via flask +winrt==1.0.20239.1 ; sys_platform == "win32" and platform_release == "10" # via -r requirements.in wrapt==1.12.1 # via astroid # The following packages are considered to be unsafe in a requirements file: diff --git a/qt/aqt/BUILD.bazel b/qt/aqt/BUILD.bazel index 42836be2e..246cb97c1 100644 --- a/qt/aqt/BUILD.bazel +++ b/qt/aqt/BUILD.bazel @@ -57,6 +57,7 @@ aqt_deps = [ "@bazel_tools//src/conditions:host_windows": [ requirement("psutil"), requirement("pywin32"), + requirement("winrt"), ], "//conditions:default": [], }) @@ -112,6 +113,7 @@ py_wheel( "pyqtwebengine", 'psutil; sys.platform == "win32"', 'pywin32; sys.platform == "win32"', + 'winrt==1.0.20239.1 ; sys_platform == "win32" and platform_release == "10"', "anki==" + anki_version, ], strip_path_prefixes = [ From 56703e5f3a7c05ac6aef7d24fcafdf709d0811bb Mon Sep 17 00:00:00 2001 From: Ryan Aird Date: Mon, 14 Dec 2020 21:49:57 -0600 Subject: [PATCH 006/179] WinRT TTS API support --- qt/aqt/sound.py | 3 ++- qt/aqt/tts.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 4f9c324a7..e936e499b 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -916,9 +916,10 @@ def setup_audio(taskman: TaskManager, base_folder: str) -> None: av_player.players.append(MacTTSPlayer(taskman)) elif isWin: - from aqt.tts import WindowsTTSPlayer + from aqt.tts import WindowsTTSPlayer, WindowsRTTTSFilePlayer av_player.players.append(WindowsTTSPlayer(taskman)) + av_player.players.append(WindowsRTTTSFilePlayer(taskman)) # cleanup at shutdown atexit.register(av_player.shutdown) diff --git a/qt/aqt/tts.py b/qt/aqt/tts.py index 50c84761d..b3ee56fda 100644 --- a/qt/aqt/tts.py +++ b/qt/aqt/tts.py @@ -28,6 +28,8 @@ from __future__ import annotations import os import re import subprocess +import threading +import asyncio from concurrent.futures import Future from dataclasses import dataclass from operator import attrgetter @@ -516,3 +518,63 @@ if isWin: "eg. 1.5 -> 15, 0.5 -> -5" speed = (speed * 10) - 10 return int(max(-10, min(10, speed))) + + @dataclass + class WindowsRTVoice(TTSVoice): + id: Any + + class WindowsRTTTSFilePlayer(TTSProcessPlayer): + voice_list = None + tmppath = os.path.join(tmpdir(), "tts.wav") + + def import_voices(self) -> None: + import winrt.windows.media.speechsynthesis as speechsynthesis + self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices() + def get_available_voices(self) -> List[TTSVoice]: + t = threading.Thread(target=self.import_voices) + t.start() + t.join() + return list(map(self._voice_to_object, self.voice_list)) + def _voice_to_object(self, voice: Any) -> TTSVoice: + return WindowsRTVoice(id=voice.id, name=voice.display_name.replace(" ", "_"), lang=voice.language.replace("-", "_")) + def _play(self, tag: AVTag) -> None: + assert isinstance(tag, TTSTag) + match = self.voice_for_tag(tag) + assert match + voice = cast(WindowsRTVoice, match.voice) + + self._taskman.run_on_main( + lambda: gui_hooks.av_player_did_begin_playing(self, tag) + ) + asyncio.run(self.speakText(tag, voice.id)) + def _on_done(self, ret: Future, cb: OnDoneCallback): + ret.result() + + # inject file into the top of the audio queue + from aqt.sound import av_player + + av_player.insert_file(self.tmppath) + + # then tell player to advance, which will cause the file to be played + cb() + async def speakText(self, tag: TTSTag, voice_id): + import winrt.windows.media.speechsynthesis as speechsynthesis + import winrt.windows.storage.streams as streams + synthesizer = speechsynthesis.SpeechSynthesizer() + + voices = speechsynthesis.SpeechSynthesizer.get_all_voices() + voice_match = next(filter(lambda v: v.id == voice_id, voices)) + + assert voice_match + + synthesizer.voice = voice_match + synthesizer.options.speaking_rate = tag.speed + + stream = await synthesizer.synthesize_text_to_stream_async(tag.field_text) + inputStream = stream.get_input_stream_at(0) + dataReader = streams.DataReader(inputStream) + dataReader.load_async(stream.size) + f = open(self.tmppath, 'wb') + for x in range(stream.size): + f.write(bytes([dataReader.read_byte()])) + f.close() From 9a0b112a0fca8b2924885069297b862167e210bb Mon Sep 17 00:00:00 2001 From: Ryan Aird Date: Sat, 19 Dec 2020 20:10:23 -0600 Subject: [PATCH 007/179] Lower default rank for non-RT voices and restrict to Windows 10 October 2018 or greater --- qt/aqt/sound.py | 9 +++++++-- qt/aqt/tts.py | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index e936e499b..1b44adebc 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -5,6 +5,7 @@ from __future__ import annotations import atexit import os +import platform import re import subprocess import sys @@ -916,10 +917,14 @@ def setup_audio(taskman: TaskManager, base_folder: str) -> None: av_player.players.append(MacTTSPlayer(taskman)) elif isWin: - from aqt.tts import WindowsTTSPlayer, WindowsRTTTSFilePlayer + from aqt.tts import WindowsRTTTSFilePlayer, WindowsTTSPlayer av_player.players.append(WindowsTTSPlayer(taskman)) - av_player.players.append(WindowsRTTTSFilePlayer(taskman)) + + if platform.release() == "10": + # If Windows 10, ensure it's October 2018 update or later + if int(platform.version().split(".")[-1]) >= 17763: + av_player.players.append(WindowsRTTTSFilePlayer(taskman)) # cleanup at shutdown atexit.register(av_player.shutdown) diff --git a/qt/aqt/tts.py b/qt/aqt/tts.py index b3ee56fda..2536a8d56 100644 --- a/qt/aqt/tts.py +++ b/qt/aqt/tts.py @@ -25,11 +25,11 @@ expose the name of the engine, which would mean the user could write from __future__ import annotations +import asyncio import os import re import subprocess import threading -import asyncio from concurrent.futures import Future from dataclasses import dataclass from operator import attrgetter @@ -470,6 +470,7 @@ if isWin: return LCIDS.get(dec_str, "unknown") class WindowsTTSPlayer(TTSProcessPlayer): + default_rank = -1 try: speaker = win32com.client.Dispatch("SAPI.SpVoice") except: @@ -529,14 +530,22 @@ if isWin: def import_voices(self) -> None: import winrt.windows.media.speechsynthesis as speechsynthesis + self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices() + def get_available_voices(self) -> List[TTSVoice]: t = threading.Thread(target=self.import_voices) t.start() t.join() return list(map(self._voice_to_object, self.voice_list)) + def _voice_to_object(self, voice: Any) -> TTSVoice: - return WindowsRTVoice(id=voice.id, name=voice.display_name.replace(" ", "_"), lang=voice.language.replace("-", "_")) + return WindowsRTVoice( + id=voice.id, + name=voice.display_name.replace(" ", "_"), + lang=voice.language.replace("-", "_"), + ) + def _play(self, tag: AVTag) -> None: assert isinstance(tag, TTSTag) match = self.voice_for_tag(tag) @@ -547,6 +556,7 @@ if isWin: lambda: gui_hooks.av_player_did_begin_playing(self, tag) ) asyncio.run(self.speakText(tag, voice.id)) + def _on_done(self, ret: Future, cb: OnDoneCallback): ret.result() @@ -557,9 +567,11 @@ if isWin: # then tell player to advance, which will cause the file to be played cb() + async def speakText(self, tag: TTSTag, voice_id): import winrt.windows.media.speechsynthesis as speechsynthesis import winrt.windows.storage.streams as streams + synthesizer = speechsynthesis.SpeechSynthesizer() voices = speechsynthesis.SpeechSynthesizer.get_all_voices() @@ -574,7 +586,7 @@ if isWin: inputStream = stream.get_input_stream_at(0) dataReader = streams.DataReader(inputStream) dataReader.load_async(stream.size) - f = open(self.tmppath, 'wb') + f = open(self.tmppath, "wb") for x in range(stream.size): f.write(bytes([dataReader.read_byte()])) f.close() From ac78698a1ebbe317ee66496acd91a343ad3187f0 Mon Sep 17 00:00:00 2001 From: Ryan Aird Date: Sat, 19 Dec 2020 20:15:12 -0600 Subject: [PATCH 008/179] Add rye761 to contributers list --- CONTRIBUTORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a1ebd645f..20813b6b5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -66,9 +66,10 @@ David Allison Tsung-Han Yu Piotr Kubowicz RumovZ -Cecini +Cecini Krish Shah ianki +rye761 ******************** From 9b2de395e10802be646a08e5e7f6c606f4939e0c Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Sun, 20 Dec 2020 23:20:59 +0100 Subject: [PATCH 009/179] Wrap field name in editor in span --- qt/aqt/data/web/js/editor.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qt/aqt/data/web/js/editor.ts b/qt/aqt/data/web/js/editor.ts index aafc63efb..32bf43947 100644 --- a/qt/aqt/data/web/js/editor.ts +++ b/qt/aqt/data/web/js/editor.ts @@ -351,7 +351,9 @@ function setFields(fields) { } txt += ` - ${n} + + ${n} + From a30064d5e9df07b0458d26a3c8e8112c5e64e58b Mon Sep 17 00:00:00 2001 From: Ryan Aird Date: Sun, 20 Dec 2020 19:43:09 -0600 Subject: [PATCH 010/179] Make RT import statement conditional, fix formatting, ignore WinRT for type checking --- qt/aqt/sound.py | 4 +++- qt/aqt/tts.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 1b44adebc..64fdc6304 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -917,11 +917,13 @@ def setup_audio(taskman: TaskManager, base_folder: str) -> None: av_player.players.append(MacTTSPlayer(taskman)) elif isWin: - from aqt.tts import WindowsRTTTSFilePlayer, WindowsTTSPlayer + from aqt.tts import WindowsTTSPlayer av_player.players.append(WindowsTTSPlayer(taskman)) if platform.release() == "10": + from aqt.tts import WindowsRTTTSFilePlayer + # If Windows 10, ensure it's October 2018 update or later if int(platform.version().split(".")[-1]) >= 17763: av_player.players.append(WindowsRTTTSFilePlayer(taskman)) diff --git a/qt/aqt/tts.py b/qt/aqt/tts.py index 2536a8d56..467b6ee07 100644 --- a/qt/aqt/tts.py +++ b/qt/aqt/tts.py @@ -529,7 +529,7 @@ if isWin: tmppath = os.path.join(tmpdir(), "tts.wav") def import_voices(self) -> None: - import winrt.windows.media.speechsynthesis as speechsynthesis + import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices() @@ -569,8 +569,8 @@ if isWin: cb() async def speakText(self, tag: TTSTag, voice_id): - import winrt.windows.media.speechsynthesis as speechsynthesis - import winrt.windows.storage.streams as streams + import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore + import winrt.windows.storage.streams as streams # type: ignore synthesizer = speechsynthesis.SpeechSynthesizer() From 502049025aaf7116e3766944bda84561f781b0aa Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Mon, 21 Dec 2020 03:13:31 +0100 Subject: [PATCH 011/179] Remove special treatment of empty fields in editor ts --- qt/aqt/data/web/css/editor.scss | 7 ++++++- qt/aqt/data/web/js/editor.ts | 24 ++++-------------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/qt/aqt/data/web/css/editor.scss b/qt/aqt/data/web/css/editor.scss index 1b4da129f..68cdc6dd5 100644 --- a/qt/aqt/data/web/css/editor.scss +++ b/qt/aqt/data/web/css/editor.scss @@ -8,9 +8,14 @@ padding: 5px; overflow-wrap: break-word; overflow: auto; + + &:empty::after { + content: "\A"; + white-space: pre; + } } -.clearfix:after { +.clearfix::after { content: ""; display: table; clear: both; diff --git a/qt/aqt/data/web/js/editor.ts b/qt/aqt/data/web/js/editor.ts index aafc63efb..389c556f8 100644 --- a/qt/aqt/data/web/js/editor.ts +++ b/qt/aqt/data/web/js/editor.ts @@ -121,11 +121,6 @@ function inPreEnvironment() { } function onInput() { - // empty field? - if (currentField.innerHTML === "") { - currentField.innerHTML = "
"; - } - // make sure IME changes get saved triggerKeyTimer(); } @@ -346,9 +341,6 @@ function setFields(fields) { for (let i = 0; i < fields.length; i++) { const n = fields[i][0]; let f = fields[i][1]; - if (!f) { - f = "
"; - } txt += ` ${n} @@ -408,20 +400,12 @@ function hideDupes() { $("#dupes").hide(); } -/// If the field has only an empty br, remove it first. -let insertHtmlRemovingInitialBR = function (html: string) { - if (html !== "") { - // remove
in empty field - if (currentField && currentField.innerHTML === "
") { - currentField.innerHTML = ""; - } - setFormat("inserthtml", html); - } -}; - let pasteHTML = function (html, internal, extendedMode) { html = filterHTML(html, internal, extendedMode); - insertHtmlRemovingInitialBR(html); + + if (html !== "") { + setFormat("inserthtml", html); + } }; let filterHTML = function (html, internal, extendedMode) { From 198639a09582727dc4116875512f220a7f99dfda Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 13:44:29 +1000 Subject: [PATCH 012/179] update setuptools; remove header So users don't need to manually exclude the header from the git commit --- pip/requirements.txt | 4 +--- pip/update.py | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pip/requirements.txt b/pip/requirements.txt index e0efec0de..af7e21843 100644 --- a/pip/requirements.txt +++ b/pip/requirements.txt @@ -1,5 +1,3 @@ -# See README.md - appdirs==1.4.4 # via black astroid==2.4.2 # via pylint atomicwrites==1.4.0 ; sys_platform == "win32" # via -r requirements.in, pytest @@ -62,4 +60,4 @@ wrapt==1.12.1 # via astroid # The following packages are considered to be unsafe in a requirements file: pip==20.3.3 # via pip-tools -setuptools==51.0.0 # via jsonschema +setuptools==51.1.0.post20201221 # via jsonschema diff --git a/pip/update.py b/pip/update.py index 1ff1adfd4..dd80192f5 100644 --- a/pip/update.py +++ b/pip/update.py @@ -3,15 +3,16 @@ import os import click from piptools.scripts import compile + @click.group() def cli(): pass + cli.add_command(compile.cli, "compile") print("Updating deps...") os.chdir("pip") -sys.argv[1:] = ["compile", "--allow-unsafe", "--upgrade"] - -cli() +sys.argv[1:] = ["compile", "--allow-unsafe", "--upgrade", "--no-header"] +cli() \ No newline at end of file From 873a27641f87f25a4be0649b2d47d571afd587d3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 13:57:51 +1000 Subject: [PATCH 013/179] document winrt pin reason --- pip/requirements.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pip/requirements.in b/pip/requirements.in index d66356a2e..c2b3e8990 100644 --- a/pip/requirements.in +++ b/pip/requirements.in @@ -25,6 +25,8 @@ fluent-syntax # windows only psutil; sys.platform == "win32" pywin32; sys.platform == "win32" +# pinned due to https://github.com/microsoft/xlang/issues/717 +# the latest version apparently works on python3.9 winrt==1.0.20239.1; sys.platform == "win32" and platform_release == "10" # transitive windows dependencies From 68390eccde446cb095ae69a916a4e2a78b7602bb Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 14:23:10 +1000 Subject: [PATCH 014/179] fail gracefully in winrt voice list fails to load If no voices are installed, get_all_voices() throws a "file not found" error. --- qt/aqt/tts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt/aqt/tts.py b/qt/aqt/tts.py index 467b6ee07..2f47a17c2 100644 --- a/qt/aqt/tts.py +++ b/qt/aqt/tts.py @@ -531,7 +531,11 @@ if isWin: def import_voices(self) -> None: import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore - self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices() + try: + self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices() + except Exception as e: + print("winrt tts voices unavailable:", e) + self.voice_list = [] def get_available_voices(self) -> List[TTSVoice]: t = threading.Thread(target=self.import_voices) From 4c6e87ac8734e6a1b8e0557851cb267254924e2e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 14:42:00 +1000 Subject: [PATCH 015/179] update waitress to handle broken hostnames Fixes https://github.com/Pylons/waitress/issues/312 --- pip/requirements.in | 2 +- pip/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pip/requirements.in b/pip/requirements.in index c2b3e8990..72af7bc87 100644 --- a/pip/requirements.in +++ b/pip/requirements.in @@ -19,7 +19,7 @@ requests[socks] send2trash snakeviz stringcase -waitress +waitress>=2.0.0b1 fluent-syntax # windows only diff --git a/pip/requirements.txt b/pip/requirements.txt index af7e21843..eddaa4008 100644 --- a/pip/requirements.txt +++ b/pip/requirements.txt @@ -53,7 +53,7 @@ tornado==6.1 # via snakeviz typed-ast==1.4.1 # via black, mypy typing-extensions==3.7.4.3 # via black, mypy urllib3==1.26.2 # via requests -waitress==1.4.4 # via -r requirements.in +waitress==2.0.0b1 # via -r requirements.in werkzeug==1.0.1 # via flask winrt==1.0.20239.1 ; sys_platform == "win32" and platform_release == "10" # via -r requirements.in wrapt==1.12.1 # via astroid From 019a65efc109491adbae19d9713870246b368c0e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 14:52:27 +1000 Subject: [PATCH 016/179] drop QtRecorder driver; rename existing --- qt/aqt/preferences.py | 1 - qt/aqt/profiles.py | 11 +++++++---- qt/aqt/sound.py | 42 +----------------------------------------- 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 4304c61b8..273d87eb6 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -223,7 +223,6 @@ class Preferences(QDialog): self.form.interrupt_audio.setChecked(self.mw.pm.interrupt_audio()) self._recording_drivers = [ RecordingDriver.QtAudioInput, - RecordingDriver.QtRecorder, RecordingDriver.PyAudio, ] # fixme: i18n diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index bbb5547a8..71ff9d0d1 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -33,9 +33,8 @@ from aqt.utils import TR, locale_dir, showWarning, tr class RecordingDriver(Enum): - QtRecorder = "qtrecorder" - PyAudio = "pyaudio" - QtAudioInput = "qtaudioinput" + PyAudio = "PyAudio" + QtAudioInput = "Qt" metaConf = dict( @@ -641,7 +640,11 @@ create table if not exists profiles def recording_driver(self) -> RecordingDriver: if driver := self.profile.get("recordingDriver"): - return RecordingDriver(driver) + try: + return RecordingDriver(driver) + except ValueError: + # revert to default + pass return RecordingDriver.QtAudioInput def set_recording_driver(self, driver: RecordingDriver): diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 64fdc6304..a5e4e08fa 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -521,44 +521,6 @@ class Recorder(ABC): pass -# Qt recording -########################################################################## - - -class QtRecorder(Recorder): - def __init__(self, output_path: str, parent: QWidget): - super().__init__(output_path) - - from PyQt5.QtMultimedia import QAudioRecorder - - self._recorder = QAudioRecorder(parent) - audio = self._recorder.audioSettings() - audio.setSampleRate(44100) - audio.setChannelCount(1) - self._recorder.setEncodingSettings( - audio, - self._recorder.videoSettings(), - "audio/x-wav", - ) - self._recorder.setOutputLocation(QUrl.fromLocalFile(self.output_path)) - self._recorder.setMuted(True) - - def start(self, on_done: Callable[[], None]) -> None: - self._recorder.record() - super().start(on_done) - - def stop(self, on_done: Callable[[str], None]): - self._recorder.stop() - super().stop(on_done) - - def on_timer(self): - duration = self._recorder.duration() - if duration >= 300: - # disable mute after recording starts to avoid clicks/pops - if self._recorder.isMuted(): - self._recorder.setMuted(False) - - # QAudioInput recording ########################################################################## @@ -770,9 +732,7 @@ class RecordDialog(QDialog): def _start_recording(self): driver = self.mw.pm.recording_driver() - if driver is RecordingDriver.QtRecorder: - self._recorder = QtRecorder(namedtmp("rec.wav"), self._parent) - elif driver is RecordingDriver.PyAudio: + if driver is RecordingDriver.PyAudio: self._recorder = PyAudioRecorder(self.mw, namedtmp("rec.wav")) elif driver is RecordingDriver.QtAudioInput: self._recorder = QtAudioInputRecorder( From ebeae9a5a049b575c2be209992605a71e7fb51f6 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 15:59:16 +1000 Subject: [PATCH 017/179] don't pass BUILDINFO into build script It was causing the build script to be recompiled each time a commit was made, even though buildinfo.txt was not changing. --- rslib/BUILD.bazel | 9 +++++++-- rslib/build/main.rs | 19 ++++++++++--------- rslib/src/version.rs | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/rslib/BUILD.bazel b/rslib/BUILD.bazel index c6fc8f87a..51d89ba7a 100644 --- a/rslib/BUILD.bazel +++ b/rslib/BUILD.bazel @@ -14,13 +14,12 @@ cargo_build_script( "PROTOC": "$(location @com_google_protobuf//:protoc)", "RSLIB_FTL_ROOT": "$(location @rslib_ftl//:l10n.toml)", "EXTRA_FTL_ROOT": "$(location @extra_ftl//:l10n.toml)", - "BUILDINFO": "$(location //:buildinfo.txt)", + "BAZEL": "1", }, crate_root = "build/main.rs", data = [ "//ftl", "backend.proto", - "//:buildinfo.txt", "@com_google_protobuf//:protoc", # bazel requires us to list these out separately "@rslib_ftl//:l10n.toml", @@ -50,6 +49,10 @@ _anki_features = [ "translations", ] +_anki_rustc_env = { + "BUILDINFO": "$(location //:buildinfo.txt)", +} + rust_library( name = "anki", srcs = glob([ @@ -61,6 +64,7 @@ rust_library( "//rslib/cargo:serde_derive", "//rslib/cargo:serde_repr", ], + rustc_env = _anki_rustc_env, visibility = ["//visibility:public"], deps = [ ":build_script", @@ -121,6 +125,7 @@ rust_test( data = glob([ "tests/support/**", ]), + rustc_env = _anki_rustc_env, deps = ["//rslib/cargo:env_logger"], ) diff --git a/rslib/build/main.rs b/rslib/build/main.rs index 597d84686..45c316a6f 100644 --- a/rslib/build/main.rs +++ b/rslib/build/main.rs @@ -5,13 +5,14 @@ fn main() { mergeftl::write_ftl_files_and_fluent_rs(); protobuf::write_backend_proto_rs(); - // copy or mock buildinfo in out_dir - let buildinfo = if let Ok(buildinfo) = std::env::var("BUILDINFO") { - std::fs::read_to_string(&buildinfo).expect("buildinfo missing") - } else { - "".to_string() - }; - let buildinfo_out = - std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).join("buildinfo.txt"); - std::fs::write(&buildinfo_out, buildinfo).unwrap(); + // when building with cargo (eg for rust analyzer), generate a dummy BUILDINFO + if std::env::var("BAZEL").is_err() { + let buildinfo_out = + std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).join("buildinfo.txt"); + std::fs::write(&buildinfo_out, "").unwrap(); + println!( + "cargo:rustc-env=BUILDINFO={}", + buildinfo_out.to_str().expect("buildinfo") + ); + } } diff --git a/rslib/src/version.rs b/rslib/src/version.rs index b7203ae21..b537a4074 100644 --- a/rslib/src/version.rs +++ b/rslib/src/version.rs @@ -5,7 +5,7 @@ use lazy_static::lazy_static; use std::env; fn buildinfo(key: &str) -> &'static str { - let buildinfo = include_str!(concat!(env!("OUT_DIR"), "/buildinfo.txt")); + let buildinfo = include_str!(env!("BUILDINFO")); for line in buildinfo.split('\n') { let mut it = line.split(' '); if it.next().unwrap() == key { From 0bc4ea9c4d1d5d0dbfd3fa85026e18796a175fa4 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 15:04:22 +1000 Subject: [PATCH 018/179] ask users to report if PyAudio works better for them --- qt/aqt/preferences.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 273d87eb6..98d7e0788 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -252,9 +252,18 @@ class Preferences(QDialog): restart_required = True self.mw.pm.set_interrupt_audio(self.form.interrupt_audio.isChecked()) - self.mw.pm.set_recording_driver( - self._recording_drivers[self.form.recording_driver.currentIndex()] - ) + + new_audio_driver = self._recording_drivers[ + self.form.recording_driver.currentIndex() + ] + if self.mw.pm.recording_driver() != new_audio_driver: + self.mw.pm.set_recording_driver(new_audio_driver) + if new_audio_driver == RecordingDriver.PyAudio: + showInfo( + """\ +The PyAudio driver will likely be removed in a future update. If you find it works better \ +for you than the default driver, please let us know on the Anki forums.""" + ) if restart_required: showInfo(tr(TR.PREFERENCES_CHANGES_WILL_TAKE_EFFECT_WHEN_YOU)) From 65a35fef5540d6c23ed315caf562953498f76de8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 16:09:06 +1000 Subject: [PATCH 019/179] link .prettierrc into qt/aqt/data/web/js So automatic formatting in VS Code matches CI format --- qt/aqt/data/web/js/.prettierrc | 1 + 1 file changed, 1 insertion(+) create mode 120000 qt/aqt/data/web/js/.prettierrc diff --git a/qt/aqt/data/web/js/.prettierrc b/qt/aqt/data/web/js/.prettierrc new file mode 120000 index 000000000..c070caedf --- /dev/null +++ b/qt/aqt/data/web/js/.prettierrc @@ -0,0 +1 @@ +../../../../../ts/.prettierrc \ No newline at end of file From 4e1d57e2d2f0fae4897a75ef053cabfda758fc79 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 16:09:23 +1000 Subject: [PATCH 020/179] check formatting of .js files in aqt/data mathjax.js did not match //ts:format output --- qt/aqt/data/web/js/BUILD.bazel | 2 +- qt/aqt/data/web/js/mathjax.js | 44 +++++++++++++++++----------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/qt/aqt/data/web/js/BUILD.bazel b/qt/aqt/data/web/js/BUILD.bazel index 862363cb6..b47d90193 100644 --- a/qt/aqt/data/web/js/BUILD.bazel +++ b/qt/aqt/data/web/js/BUILD.bazel @@ -38,7 +38,7 @@ filegroup( prettier_test( name = "format_check", - srcs = glob(["*.ts"]), + srcs = glob(["*.ts", "*.js"]), ) # source files need fixing first diff --git a/qt/aqt/data/web/js/mathjax.js b/qt/aqt/data/web/js/mathjax.js index c863939c1..f5d99fb84 100644 --- a/qt/aqt/data/web/js/mathjax.js +++ b/qt/aqt/data/web/js/mathjax.js @@ -1,27 +1,27 @@ window.MathJax = { - tex: { - displayMath: [["\\[", "\\]"]], - processRefs: false, - processEnvironments: false, - packages: { - "[+]": ["noerrors", "mhchem"], + tex: { + displayMath: [["\\[", "\\]"]], + processRefs: false, + processEnvironments: false, + packages: { + "[+]": ["noerrors", "mhchem"], + }, }, - }, - startup: { - typeset: false, - pageReady: () => { - return MathJax.startup.defaultPageReady(); + startup: { + typeset: false, + pageReady: () => { + return MathJax.startup.defaultPageReady(); + }, }, - }, - options: { - renderActions: { - addMenu: [], - checkLoading: [], + options: { + renderActions: { + addMenu: [], + checkLoading: [], + }, + ignoreHtmlClass: "tex2jax_ignore", + processHtmlClass: "tex2jax_process", + }, + loader: { + load: ["[tex]/noerrors", "[tex]/mhchem"], }, - ignoreHtmlClass: "tex2jax_ignore", - processHtmlClass: "tex2jax_process", - }, - loader: { - load: ["[tex]/noerrors", "[tex]/mhchem"], - }, }; From 729293f5e3b65063ef3b75e4606eda9738b3a763 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 16:13:32 +1000 Subject: [PATCH 021/179] remove voice recording fixme --- qt/aqt/preferences.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 98d7e0788..65cba5c3c 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -225,7 +225,8 @@ class Preferences(QDialog): RecordingDriver.QtAudioInput, RecordingDriver.PyAudio, ] - # fixme: i18n + # The plan is to phase out PyAudio soon, so will hold off on + # making this string translatable for now. self.form.recording_driver.addItems( [ f"Voice recording driver: {driver.value}" From 7d1c8c29f91b200937989decbe20617484ee7d4e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 16:37:28 +1000 Subject: [PATCH 022/179] add a small delay before terminating recording https://forums.ankiweb.net/t/anki-crashes-periodically-after-clicking-record-audio-button/5824/12 --- qt/aqt/sound.py | 55 ++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index a5e4e08fa..445ccff32 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -530,6 +530,7 @@ class QtAudioInputRecorder(Recorder): super().__init__(output_path) self.mw = mw + self._parent = parent from PyQt5.QtMultimedia import ( QAudio, @@ -567,34 +568,42 @@ class QtAudioInputRecorder(Recorder): self._buffer += self._iodevice.readAll() def stop(self, on_done: Callable[[str], None]): - # read anything remaining in buffer & stop - self._on_read_ready() - self._audio_input.stop() + def on_stop_timer(): + # read anything remaining in buffer & stop + self._on_read_ready() + self._audio_input.stop() - if err := self._audio_input.error(): - showWarning(f"recording failed: {err}") - return - - def write_file(): - # swallow the first 300ms to allow audio device to quiesce - wait = int(44100 * self.STARTUP_DELAY) - if len(self._buffer) <= wait: + if err := self._audio_input.error(): + showWarning(f"recording failed: {err}") return - self._buffer = self._buffer[wait:] - # write out the wave file - wf = wave.open(self.output_path, "wb") - wf.setnchannels(self._format.channelCount()) - wf.setsampwidth(self._format.sampleSize() // 8) - wf.setframerate(self._format.sampleRate()) - wf.writeframes(self._buffer) - wf.close() + def write_file(): + # swallow the first 300ms to allow audio device to quiesce + wait = int(44100 * self.STARTUP_DELAY) + if len(self._buffer) <= wait: + return + self._buffer = self._buffer[wait:] - def and_then(fut): - fut.result() - Recorder.stop(self, on_done) + # write out the wave file + wf = wave.open(self.output_path, "wb") + wf.setnchannels(self._format.channelCount()) + wf.setsampwidth(self._format.sampleSize() // 8) + wf.setframerate(self._format.sampleRate()) + wf.writeframes(self._buffer) + wf.close() - self.mw.taskman.run_in_background(write_file, and_then) + def and_then(fut): + fut.result() + Recorder.stop(self, on_done) + + self.mw.taskman.run_in_background(write_file, and_then) + + # schedule the stop for half a second in the future, + # to avoid truncating the end of the recording + self._stop_timer = t = QTimer(self._parent) + t.timeout.connect(on_stop_timer) # type: ignore + t.setSingleShot(True) + t.start(500) # PyAudio recording From 2ae4d14bc585dc1810a6ff14faa0319f393142ec Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Mon, 21 Dec 2020 08:00:47 +0100 Subject: [PATCH 023/179] Focus special handling of Shift+Tab on macOS --- qt/aqt/data/web/js/editor.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/qt/aqt/data/web/js/editor.ts b/qt/aqt/data/web/js/editor.ts index aafc63efb..753a9fc7d 100644 --- a/qt/aqt/data/web/js/editor.ts +++ b/qt/aqt/data/web/js/editor.ts @@ -54,12 +54,6 @@ function onKey(evt: KeyboardEvent) { currentField.blur(); return; } - // shift+tab goes to previous field - if (navigator.platform === "MacIntel" && evt.which === 9 && evt.shiftKey) { - evt.preventDefault(); - focusPrevious(); - return; - } // fix Ctrl+right/left handling in RTL fields if (currentField.dir === "rtl") { @@ -206,16 +200,6 @@ function focusField(n) { $("#f" + n).focus(); } -function focusPrevious() { - if (!currentField) { - return; - } - const previous = currentFieldOrdinal() - 1; - if (previous >= 0) { - focusField(previous); - } -} - function focusIfField(x, y) { const elements = document.elementsFromPoint(x, y); for (let i = 0; i < elements.length; i++) { From 64173b5c02a99b1adf9fae216737011a6943717a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 17:05:31 +1000 Subject: [PATCH 024/179] .prettierrc needs to be in web/, as it's needed for sass as well --- qt/aqt/data/web/.prettierrc | 1 + qt/aqt/data/web/js/.prettierrc | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 120000 qt/aqt/data/web/.prettierrc delete mode 120000 qt/aqt/data/web/js/.prettierrc diff --git a/qt/aqt/data/web/.prettierrc b/qt/aqt/data/web/.prettierrc new file mode 120000 index 000000000..d44059133 --- /dev/null +++ b/qt/aqt/data/web/.prettierrc @@ -0,0 +1 @@ +../../../../ts/.prettierrc \ No newline at end of file diff --git a/qt/aqt/data/web/js/.prettierrc b/qt/aqt/data/web/js/.prettierrc deleted file mode 120000 index c070caedf..000000000 --- a/qt/aqt/data/web/js/.prettierrc +++ /dev/null @@ -1 +0,0 @@ -../../../../../ts/.prettierrc \ No newline at end of file From 256db8557753c9be4c7ad34440a4a6a8fedfae73 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 17:56:20 +1000 Subject: [PATCH 025/179] work around --text-fg ending up in fields https://forums.ankiweb.net/t/strange-behaviour-in-the-html-editor/5796/4 --- qt/aqt/data/web/css/editor.scss | 1 - qt/aqt/data/web/js/editor.ts | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/qt/aqt/data/web/css/editor.scss b/qt/aqt/data/web/css/editor.scss index 1b4da129f..69008ed69 100644 --- a/qt/aqt/data/web/css/editor.scss +++ b/qt/aqt/data/web/css/editor.scss @@ -4,7 +4,6 @@ .field { border: 1px solid var(--border); background: var(--frame-bg); - color: var(--text-fg); padding: 5px; overflow-wrap: break-word; overflow: auto; diff --git a/qt/aqt/data/web/js/editor.ts b/qt/aqt/data/web/js/editor.ts index 32bf43947..e0c75a74d 100644 --- a/qt/aqt/data/web/js/editor.ts +++ b/qt/aqt/data/web/js/editor.ts @@ -343,6 +343,11 @@ function onCutOrCopy() { function setFields(fields) { let txt = ""; + // webengine will include the variable after enter+backspace + // if we don't convert it to a literal colour + const color = window + .getComputedStyle(document.documentElement) + .getPropertyValue("--text-fg"); for (let i = 0; i < fields.length; i++) { const n = fields[i][0]; let f = fields[i][1]; @@ -369,6 +374,7 @@ function setFields(fields) { oncut='onCutOrCopy(this);' contentEditable=true class=field + style='color: ${color}' >${f} `; From 73679b03e73e4df23ad59fdccb6cfb2a7fb50a8e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 19:24:04 +1000 Subject: [PATCH 026/179] possible fix for sync button colour blue after sync If the client's clock is behind AnkiWeb's, even by a few seconds, we can end up with a situation where last_begin_at is updated after the sync to a value less than the mtime we received from AnkiWeb, causing the collection to be saved, which bumps the modtime. Work around this by recording mtime at begin() time, and seeing if it has changed in either direction. Thanks to Rumo, who did the hard work looking into it: https://forums.ankiweb.net/t/why-is-my-sync-button-blue/2078/21 --- pylib/anki/collection.py | 2 +- pylib/anki/dbproxy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 77eab8716..6ac769814 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -196,7 +196,7 @@ class Collection: # Until we can move away from long-running transactions, the Python # code needs to know if transaction should be committed, so we need # to check if the backend updated the modification time. - return self.db.last_begin_at <= self.mod + return self.db.last_begin_at != self.mod def save( self, name: Optional[str] = None, mod: Optional[int] = None, trx: bool = True diff --git a/pylib/anki/dbproxy.py b/pylib/anki/dbproxy.py index e555c74b3..1a9c024ff 100644 --- a/pylib/anki/dbproxy.py +++ b/pylib/anki/dbproxy.py @@ -30,7 +30,7 @@ class DBProxy: ############### def begin(self) -> None: - self.last_begin_at = anki.utils.intTime(1000) + self.last_begin_at = self.scalar("select mod from col") self._backend.db_begin() def commit(self) -> None: From 212b251334de44b8e7a8f11b4921fe870f1a2a33 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 19:28:47 +1000 Subject: [PATCH 027/179] tag the wheels as manual so test ... doesn't build them --- pylib/anki/BUILD.bazel | 1 + qt/aqt/BUILD.bazel | 1 + 2 files changed, 2 insertions(+) diff --git a/pylib/anki/BUILD.bazel b/pylib/anki/BUILD.bazel index 525ec667c..64137b168 100644 --- a/pylib/anki/BUILD.bazel +++ b/pylib/anki/BUILD.bazel @@ -129,6 +129,7 @@ py_wheel( strip_path_prefixes = [ "pylib/", ], + tags = ["manual"], version = anki_version, visibility = ["//visibility:public"], deps = [":anki_pkg"], diff --git a/qt/aqt/BUILD.bazel b/qt/aqt/BUILD.bazel index 246cb97c1..ad75b8f39 100644 --- a/qt/aqt/BUILD.bazel +++ b/qt/aqt/BUILD.bazel @@ -119,6 +119,7 @@ py_wheel( strip_path_prefixes = [ "qt/", ], + tags = ["manual"], version = anki_version, visibility = ["//visibility:public"], deps = [ From 7fbd7ec76316feaf0e13be6097eb9869fa788caf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 19:31:15 +1000 Subject: [PATCH 028/179] build wheels in Linux CI --- .buildkite/linux/entrypoint | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.buildkite/linux/entrypoint b/.buildkite/linux/entrypoint index 4514bcd39..00ebc3eb5 100755 --- a/.buildkite/linux/entrypoint +++ b/.buildkite/linux/entrypoint @@ -18,6 +18,9 @@ $BAZEL build $BUILDARGS ... echo "+++ Running tests" $BAZEL test $BUILDARGS ... +echo "--- Building wheels" +$BAZEL build dist + echo "--- Cleanup" # if tests succeed, back up node_modules folder mv ts/node_modules /state/ From d600bd5800e08b7ad0f43abd3629f44ceb0aa323 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Dec 2020 20:13:17 +1000 Subject: [PATCH 029/179] update translations --- repos.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repos.bzl b/repos.bzl index 059c2db97..cb809e42d 100644 --- a/repos.bzl +++ b/repos.bzl @@ -130,8 +130,8 @@ def register_repos(): # translations ################ - core_i18n_commit = "8d10e26bd363001d1119147eef8b7aa1cecfa137" - core_i18n_shallow_since = "1608250325 +1000" + core_i18n_commit = "8e844100cfb0af6e20bd2b8f2520a93ac9c4afc6" + core_i18n_shallow_since = "1608469231 +0000" qtftl_i18n_commit = "50f55f232b3cae3f113ba5a94497a7da76137156" qtftl_i18n_shallow_since = "1608120047 +0000" From 86108cca5502d6ca0c4960c6c5b6817d08ea5ccf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 22 Dec 2020 09:29:30 +1000 Subject: [PATCH 030/179] mention deleting ts/node_modules in the docs https://forums.ankiweb.net/t/strange-behaviour-in-the-html-editor/5796/6 --- docs/development.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/development.md b/docs/development.md index 2319322f1..14ffca0d7 100644 --- a/docs/development.md +++ b/docs/development.md @@ -188,6 +188,17 @@ Audio playing requires `mpv` or `mplayer` to be in your system path. Recording also requires `lame` to be in your system path. +## Build errors and cleaning + +If you get errors with @npm and node_modules in the message, try deleting the +ts/node_modules folder. + +Unlike the old Make system, a "clean build" should almost never be required +unless you are debugging issues with the build system. But if you need to get +things to a fresh state, you can run `bazel clean --expunge`. Afte doing so, +make sure you remove the ts/node_modules folder, or subsequent build commands +will fail with a "no such file or directory node_modules/anki" message. + ## Tracing build problems You can run bazel with '-s' to print the commands that are being executed. @@ -212,14 +223,6 @@ in the collection2.log file will also be printed on stdout. If ANKI_PROFILE_CODE is set, Python profiling data will be written on exit. -## Cleaning - -Unlike the old Make system, a "clean build" should almost never be required -unless you are debugging issues with the build system. But if you need to get -things to a fresh state, you can run `bazel clean --expunge`. Afte doing so, -make sure you remove the ts/node_modules folder, or subsequent build commands -will fail with a "no such file or directory node_modules/anki" message. - ## Mixing development and study You may wish to create a separate profile with File>Switch Profile for use From b48451610fb94b34d7b6b0398c12a2e9e1872326 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 22 Dec 2020 10:46:50 +1000 Subject: [PATCH 031/179] fix sync indicator turning blue after startup sync https://forums.ankiweb.net/t/why-is-my-sync-button-blue/2078/26?u=dae --- rslib/src/backend/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rslib/src/backend/mod.rs b/rslib/src/backend/mod.rs index 23b124b01..db4a1802e 100644 --- a/rslib/src/backend/mod.rs +++ b/rslib/src/backend/mod.rs @@ -1541,13 +1541,19 @@ impl Backend { // fetch and cache result let rt = self.runtime_handle(); + let time_at_check_begin = TimestampSecs::now(); let remote: SyncMeta = rt.block_on(get_remote_sync_meta(input.into()))?; let response = self.with_col(|col| col.get_sync_status(remote).map(Into::into))?; { let mut guard = self.state.lock().unwrap(); - guard.remote_sync_status.last_check = TimestampSecs::now(); - guard.remote_sync_status.last_response = response; + // On startup, the sync status check will block on network access, and then automatic syncing begins, + // taking hold of the mutex. By the time we reach here, our network status may be out of date, + // so we discard it if stale. + if guard.remote_sync_status.last_check < time_at_check_begin { + guard.remote_sync_status.last_check = time_at_check_begin; + guard.remote_sync_status.last_response = response; + } } Ok(response.into()) From 0a633160c5df8b38785ead594e65220debaf346d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 22 Dec 2020 13:01:06 +1000 Subject: [PATCH 032/179] add video driver enum; allow setting angle+software on mac in prefs --- ftl/core/preferences.ftl | 1 - ftl/qt/preferences.ftl | 9 +++++ qt/aqt/__init__.py | 28 ++++++++----- qt/aqt/forms/preferences.ui | 10 ++--- qt/aqt/preferences.py | 49 +++++++++++++++------- qt/aqt/profiles.py | 81 +++++++++++++++++++++++-------------- qt/aqt/reviewer.py | 3 +- 7 files changed, 116 insertions(+), 65 deletions(-) diff --git a/ftl/core/preferences.ftl b/ftl/core/preferences.ftl index 10ee2b028..3266d489b 100644 --- a/ftl/core/preferences.ftl +++ b/ftl/core/preferences.ftl @@ -6,7 +6,6 @@ preferences-backupsanki-will-create-a-backup-of =

0 0 640 - 374 + 406 @@ -56,11 +56,7 @@ - - - PREFERENCES_HARDWARE_ACCELERATION_FASTER_MAY_CAUSE_DISPLAY - - + @@ -596,7 +592,7 @@ lang - hwAccel + video_driver showPlayButtons interrupt_audio pastePNG diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 65cba5c3c..f747acc27 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -4,11 +4,26 @@ import anki.lang import aqt from aqt import AnkiQt -from aqt.profiles import RecordingDriver +from aqt.profiles import RecordingDriver, VideoDriver from aqt.qt import * from aqt.utils import TR, askUser, openHelp, showInfo, showWarning, tr +def video_driver_name_for_platform(driver: VideoDriver) -> str: + if driver == VideoDriver.ANGLE: + return tr(TR.PREFERENCES_VIDEO_DRIVER_ANGLE) + elif driver == VideoDriver.Software: + if isMac: + return tr(TR.PREFERENCES_VIDEO_DRIVER_SOFTWARE_MAC) + else: + return tr(TR.PREFERENCES_VIDEO_DRIVER_SOFTWARE_OTHER) + else: + if isMac: + return tr(TR.PREFERENCES_VIDEO_DRIVER_OPENGL_MAC) + else: + return tr(TR.PREFERENCES_VIDEO_DRIVER_OPENGL_OTHER) + + class Preferences(QDialog): def __init__(self, mw: AnkiQt): QDialog.__init__(self, mw, Qt.Window) @@ -81,10 +96,7 @@ class Preferences(QDialog): f = self.form qc = self.mw.col.conf - if isMac: - f.hwAccel.setVisible(False) - else: - f.hwAccel.setChecked(self.mw.pm.glMode() != "software") + self.setup_video_driver() f.newSpread.addItems(list(c.newCardSchedulingLabels(self.mw.col).values())) @@ -106,19 +118,28 @@ class Preferences(QDialog): f.newSched.setChecked(True) f.new_timezone.setChecked(s.new_timezone) + def setup_video_driver(self): + self.video_drivers = VideoDriver.all_for_platform() + names = [ + tr(TR.PREFERENCES_VIDEO_DRIVER, driver=video_driver_name_for_platform(d)) + for d in self.video_drivers + ] + self.form.video_driver.addItems(names) + self.form.video_driver.setCurrentIndex( + self.video_drivers.index(self.mw.pm.video_driver()) + ) + + def update_video_driver(self): + new_driver = self.video_drivers[self.form.video_driver.currentIndex()] + if new_driver != self.mw.pm.video_driver(): + self.mw.pm.set_video_driver(new_driver) + showInfo(tr(TR.PREFERENCES_CHANGES_WILL_TAKE_EFFECT_WHEN_YOU)) + def updateCollection(self): f = self.form d = self.mw.col - if not isMac: - wasAccel = self.mw.pm.glMode() != "software" - wantAccel = f.hwAccel.isChecked() - if wasAccel != wantAccel: - if wantAccel: - self.mw.pm.setGlMode("auto") - else: - self.mw.pm.setGlMode("software") - showInfo(tr(TR.PREFERENCES_CHANGES_WILL_TAKE_EFFECT_WHEN_YOU)) + self.update_video_driver() qc = d.conf qc["addToCur"] = not f.useCurrent.currentIndex() diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index 71ff9d0d1..e90bc9f1d 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -1,6 +1,8 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +from __future__ import annotations + import enum import io import locale @@ -37,6 +39,40 @@ class RecordingDriver(Enum): QtAudioInput = "Qt" +class VideoDriver(Enum): + OpenGL = "auto" + ANGLE = "angle" + Software = "software" + + @staticmethod + def default_for_platform() -> VideoDriver: + if isMac: + return VideoDriver.OpenGL + else: + return VideoDriver.Software + + def constrained_to_platform(self) -> VideoDriver: + if self == VideoDriver.ANGLE and not isWin: + return VideoDriver.Software + return self + + def next(self) -> VideoDriver: + if self == VideoDriver.Software: + return VideoDriver.OpenGL + elif self == VideoDriver.OpenGL and isWin: + return VideoDriver.ANGLE + else: + return VideoDriver.Software + + @staticmethod + def all_for_platform() -> List[VideoDriver]: + all = [VideoDriver.OpenGL] + if isWin: + all.append(VideoDriver.ANGLE) + all.append(VideoDriver.Software) + return all + + metaConf = dict( ver=0, updates=True, @@ -535,41 +571,24 @@ create table if not exists profiles # OpenGL ###################################################################### - def _glPath(self) -> str: + def _gldriver_path(self) -> str: return os.path.join(self.base, "gldriver") - def glMode(self) -> str: - if isMac: - return "auto" + def video_driver(self) -> VideoDriver: + path = self._gldriver_path() + try: + with open(path) as file: + text = file.read().strip() + return VideoDriver(text).constrained_to_platform() + except (ValueError, OSError): + return VideoDriver.default_for_platform() - path = self._glPath() - if not os.path.exists(path): - return "software" + def set_video_driver(self, driver: VideoDriver) -> None: + with open(self._gldriver_path(), "w") as file: + file.write(driver.value) - with open(path, "r") as file: - mode = file.read().strip() - - if mode == "angle" and isWin: - return mode - elif mode == "software": - return mode - return "auto" - - def setGlMode(self, mode) -> None: - with open(self._glPath(), "w") as file: - file.write(mode) - - def nextGlMode(self) -> None: - mode = self.glMode() - if mode == "software": - self.setGlMode("auto") - elif mode == "auto": - if isWin: - self.setGlMode("angle") - else: - self.setGlMode("software") - elif mode == "angle": - self.setGlMode("software") + def set_next_video_driver(self) -> None: + self.set_video_driver(self.video_driver().next()) # Shared options ###################################################################### diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py index a9a11ec7a..51db9da75 100644 --- a/qt/aqt/reviewer.py +++ b/qt/aqt/reviewer.py @@ -16,6 +16,7 @@ from anki import hooks from anki.cards import Card from anki.utils import stripHTML from aqt import AnkiQt, gui_hooks +from aqt.profiles import VideoDriver from aqt.qt import * from aqt.sound import av_player, play_clicked_audio, record_audio from aqt.theme import theme_manager @@ -138,7 +139,7 @@ class Reviewer: def revHtml(self) -> str: extra = self.mw.col.conf.get("reviewExtra", "") fade = "" - if self.mw.pm.glMode() == "software": + if self.mw.pm.video_driver() == VideoDriver.Software: fade = "" return """

From 32093bb428f1ace09bf7244ec8bc7b99d7acaecb Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 22 Dec 2020 13:02:07 +1000 Subject: [PATCH 033/179] further decrease default q/a fade time --- qt/aqt/data/web/js/reviewer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/aqt/data/web/js/reviewer.ts b/qt/aqt/data/web/js/reviewer.ts index d1e6c8c29..de5d63b65 100644 --- a/qt/aqt/data/web/js/reviewer.ts +++ b/qt/aqt/data/web/js/reviewer.ts @@ -5,7 +5,7 @@ var ankiPlatform = "desktop"; var typeans; var _updatingQA = false; -var qFade = 100; +var qFade = 50; var aFade = 0; var onUpdateHook; From 398e7d78452e9300e56045654f279139f48a0bb7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 22 Dec 2020 13:30:39 +1000 Subject: [PATCH 034/179] update translations --- repos.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/repos.bzl b/repos.bzl index cb809e42d..0618f711d 100644 --- a/repos.bzl +++ b/repos.bzl @@ -130,11 +130,11 @@ def register_repos(): # translations ################ - core_i18n_commit = "8e844100cfb0af6e20bd2b8f2520a93ac9c4afc6" - core_i18n_shallow_since = "1608469231 +0000" + core_i18n_commit = "b1c03cebb554e8568529e293756ac36cdf62341a" + core_i18n_shallow_since = "1608607833 +1000" - qtftl_i18n_commit = "50f55f232b3cae3f113ba5a94497a7da76137156" - qtftl_i18n_shallow_since = "1608120047 +0000" + qtftl_i18n_commit = "e7dda1058c0510665f2ea8d8ffd74e506e578f7a" + qtftl_i18n_shallow_since = "1608607833 +1000" i18n_build_content = """ filegroup( From 008940026eb1592a983b41ce32e6d99f5063d6fd Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Tue, 22 Dec 2020 22:06:12 +0100 Subject: [PATCH 035/179] Pass in graphs as arguments into graphs() --- ts/graphs/GraphsPage.svelte | 24 ++++-------------------- ts/graphs/bootstrap.ts | 21 +++++++++++++++++++-- ts/graphs/graphs.html | 15 ++++++++++++++- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index 643d42a8c..c150b297a 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -6,19 +6,10 @@ import type { I18n } from "anki/i18n"; import type pb from "anki/backend_proto"; import { getGraphData, RevlogRange } from "./graph-helpers"; - import IntervalsGraph from "./IntervalsGraph.svelte"; - import EaseGraph from "./EaseGraph.svelte"; - import AddedGraph from "./AddedGraph.svelte"; - import TodayStats from "./TodayStats.svelte"; - import ButtonsGraph from "./ButtonsGraph.svelte"; - import CardCounts from "./CardCounts.svelte"; - import HourGraph from "./HourGraph.svelte"; - import FutureDue from "./FutureDue.svelte"; - import ReviewsGraph from "./ReviewsGraph.svelte"; - import CalendarGraph from "./CalendarGraph.svelte"; export let i18n: I18n; export let nightMode: boolean; + export let graphs: any[]; let sourceData: pb.BackendProto.GraphsOut | null = null; @@ -144,15 +135,8 @@
{#if sourceData} - - - - - - - - - - + {#each graphs as Graph} + + {/each} {/if}
diff --git a/ts/graphs/bootstrap.ts b/ts/graphs/bootstrap.ts index ccc63403e..12a5b6b31 100644 --- a/ts/graphs/bootstrap.ts +++ b/ts/graphs/bootstrap.ts @@ -5,11 +5,28 @@ import { setupI18n } from "anki/i18n"; import GraphsPage from "./GraphsPage.svelte"; import { checkNightMode } from "anki/nightmode"; -export function graphs(target: HTMLDivElement): void { +export { default as IntervalsGraph } from "./IntervalsGraph.svelte"; +export { default as EaseGraph } from "./EaseGraph.svelte"; +export { default as AddedGraph } from "./AddedGraph.svelte"; +export { default as TodayStats } from "./TodayStats.svelte"; +export { default as ButtonsGraph } from "./ButtonsGraph.svelte"; +export { default as CardCounts } from "./CardCounts.svelte"; +export { default as HourGraph } from "./HourGraph.svelte"; +export { default as FutureDue } from "./FutureDue.svelte"; +export { default as ReviewsGraph } from "./ReviewsGraph.svelte"; +export { default as CalendarGraph } from "./CalendarGraph.svelte"; + +export function graphs(target: HTMLDivElement, graphs: any[]): void { + const nightMode = checkNightMode(); + setupI18n().then((i18n) => { new GraphsPage({ target, - props: { i18n, nightMode: checkNightMode() }, + props: { + i18n, + graphs, + nightMode, + }, }); }); } diff --git a/ts/graphs/graphs.html b/ts/graphs/graphs.html index 43e8cb85d..403df40bc 100644 --- a/ts/graphs/graphs.html +++ b/ts/graphs/graphs.html @@ -11,6 +11,19 @@ From 5d117cf1a0564ff0245a40672b031df8321e79ff Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Tue, 22 Dec 2020 22:25:47 +0100 Subject: [PATCH 036/179] Bubble up days and search to caller --- ts/graphs/GraphsPage.svelte | 5 +++-- ts/graphs/bootstrap.ts | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index c150b297a..2312d825c 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -11,6 +11,9 @@ export let nightMode: boolean; export let graphs: any[]; + export let search: string; + export let days: number; + let sourceData: pb.BackendProto.GraphsOut | null = null; enum SearchRange { @@ -21,10 +24,8 @@ let searchRange: SearchRange = SearchRange.Deck; let revlogRange: RevlogRange = RevlogRange.Year; - let days: number = 31; let refreshing = false; - let search = "deck:current"; let displayedSearch = search; const refresh = async () => { diff --git a/ts/graphs/bootstrap.ts b/ts/graphs/bootstrap.ts index 12a5b6b31..2877fe8e2 100644 --- a/ts/graphs/bootstrap.ts +++ b/ts/graphs/bootstrap.ts @@ -16,7 +16,13 @@ export { default as FutureDue } from "./FutureDue.svelte"; export { default as ReviewsGraph } from "./ReviewsGraph.svelte"; export { default as CalendarGraph } from "./CalendarGraph.svelte"; -export function graphs(target: HTMLDivElement, graphs: any[]): void { +export function graphs( + target: HTMLDivElement, + graphs: any[], { + search = "deck:current", + days = 31, + } = {}, +): void { const nightMode = checkNightMode(); setupI18n().then((i18n) => { @@ -26,6 +32,8 @@ export function graphs(target: HTMLDivElement, graphs: any[]): void { i18n, graphs, nightMode, + search, + days, }, }); }); From ebc1a86b2ee5ba26c961770bffb30d011b4643d3 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Tue, 22 Dec 2020 22:36:39 +0100 Subject: [PATCH 037/179] Make showing of rangeBox based on parameter --- ts/graphs/GraphsPage.svelte | 69 +++++++++++++++++++------------------ ts/graphs/bootstrap.ts | 2 ++ 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index 2312d825c..5419d4cc5 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -13,6 +13,7 @@ export let search: string; export let days: number; + export let withRangeBox: boolean; let sourceData: pb.BackendProto.GraphsOut | null = null; @@ -95,44 +96,46 @@ } -
-
+{#if withRangeBox} +
+
+ +
+ + -
- - - - { + type="text" + bind:value={displayedSearch} + on:keyup={searchKeyUp} + on:focus={() => { searchRange = SearchRange.Custom; - }} - placeholder={searchLabel} /> -
+ }} + placeholder={searchLabel} /> +
-
- - +
+ + +
-
-
+
+{/if}
{#if sourceData} diff --git a/ts/graphs/bootstrap.ts b/ts/graphs/bootstrap.ts index 2877fe8e2..86ecc42d6 100644 --- a/ts/graphs/bootstrap.ts +++ b/ts/graphs/bootstrap.ts @@ -21,6 +21,7 @@ export function graphs( graphs: any[], { search = "deck:current", days = 31, + withRangeBox = true, } = {}, ): void { const nightMode = checkNightMode(); @@ -34,6 +35,7 @@ export function graphs( nightMode, search, days, + withRangeBox, }, }); }); From ecaf0d95a312e840377e1454ef5fdb5f8584a4f3 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Tue, 22 Dec 2020 22:39:22 +0100 Subject: [PATCH 038/179] Move infile to css to scss file --- ts/graphs/GraphsPage.svelte | 6 ------ ts/graphs/graphs.scss | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index 5419d4cc5..588995f1d 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -90,12 +90,6 @@ const all = i18n.tr(i18n.TR.STATISTICS_RANGE_ALL_HISTORY); - - {#if withRangeBox}
diff --git a/ts/graphs/graphs.scss b/ts/graphs/graphs.scss index a1d8f9dc6..ca940f0f7 100644 --- a/ts/graphs/graphs.scss +++ b/ts/graphs/graphs.scss @@ -189,3 +189,7 @@ .align-start { text-align: start; } + +.no-focus-outline:focus { + outline: 0; +} From 72baccd423fa245b52c7a6ef9626dffede47e63c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 10:06:35 +1000 Subject: [PATCH 039/179] update Rust deps --- Cargo.lock | 28 ++++---- cargo/crates.bzl | 70 +++++++++---------- cargo/licenses.json | 14 ++-- ...1.0.35.bazel => BUILD.anyhow-1.0.36.bazel} | 6 +- cargo/remote/BUILD.askama_derive-0.10.5.bazel | 2 +- cargo/remote/BUILD.askama_shared-0.11.1.bazel | 6 +- cargo/remote/BUILD.ctor-0.1.16.bazel | 4 +- cargo/remote/BUILD.derivative-2.1.1.bazel | 4 +- cargo/remote/BUILD.failure_derive-0.1.8.bazel | 4 +- cargo/remote/BUILD.futures-macro-0.3.8.bazel | 4 +- cargo/remote/BUILD.ghost-0.1.2.bazel | 4 +- ...eck-0.3.1.bazel => BUILD.heck-0.3.2.bazel} | 4 +- cargo/remote/BUILD.hyper-0.13.9.bazel | 2 +- .../remote/BUILD.inventory-impl-0.1.10.bazel | 4 +- .../remote/BUILD.num_enum_derive-0.5.1.bazel | 4 +- cargo/remote/BUILD.parking_lot-0.11.1.bazel | 2 +- ...zel => BUILD.parking_lot_core-0.8.2.bazel} | 2 +- .../BUILD.pin-project-internal-0.4.27.bazel | 4 +- .../BUILD.pin-project-internal-1.0.2.bazel | 4 +- .../remote/BUILD.proc-macro-crate-0.1.5.bazel | 2 +- cargo/remote/BUILD.prost-build-0.6.1.bazel | 2 +- cargo/remote/BUILD.prost-derive-0.6.1.bazel | 6 +- .../BUILD.pyo3-derive-backend-0.12.4.bazel | 4 +- cargo/remote/BUILD.pyo3cls-0.12.4.bazel | 4 +- ...te-1.0.7.bazel => BUILD.quote-1.0.8.bazel} | 2 +- cargo/remote/BUILD.rental-impl-0.5.5.bazel | 4 +- cargo/remote/BUILD.serde_derive-1.0.118.bazel | 4 +- cargo/remote/BUILD.serde_repr-0.1.6.bazel | 4 +- .../BUILD.serde_tuple_macros-0.5.0.bazel | 4 +- ....3.18.bazel => BUILD.socket2-0.3.19.bazel} | 2 +- ...yn-1.0.54.bazel => BUILD.syn-1.0.55.bazel} | 6 +- cargo/remote/BUILD.synstructure-0.12.4.bazel | 4 +- .../remote/BUILD.thiserror-impl-1.0.22.bazel | 4 +- ...oml-0.5.7.bazel => BUILD.toml-0.5.8.bazel} | 2 +- .../BUILD.unic-langid-macros-impl-0.9.0.bazel | 4 +- .../BUILD.wasm-bindgen-backend-0.2.69.bazel | 4 +- .../BUILD.wasm-bindgen-macro-0.2.69.bazel | 2 +- ...LD.wasm-bindgen-macro-support-0.2.69.bazel | 4 +- 38 files changed, 121 insertions(+), 119 deletions(-) rename cargo/remote/{BUILD.anyhow-1.0.35.bazel => BUILD.anyhow-1.0.36.bazel} (95%) rename cargo/remote/{BUILD.heck-0.3.1.bazel => BUILD.heck-0.3.2.bazel} (95%) rename cargo/remote/{BUILD.parking_lot_core-0.8.1.bazel => BUILD.parking_lot_core-0.8.2.bazel} (98%) rename cargo/remote/{BUILD.quote-1.0.7.bazel => BUILD.quote-1.0.8.bazel} (98%) rename cargo/remote/{BUILD.socket2-0.3.18.bazel => BUILD.socket2-0.3.19.bazel} (98%) rename cargo/remote/{BUILD.syn-1.0.54.bazel => BUILD.syn-1.0.55.bazel} (97%) rename cargo/remote/{BUILD.toml-0.5.7.bazel => BUILD.toml-0.5.8.bazel} (98%) diff --git a/Cargo.lock b/Cargo.lock index 97b467eed..f3196c1e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,9 +90,9 @@ version = "0.0.0" [[package]] name = "anyhow" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4" +checksum = "68803225a7b13e47191bab76f2687382b60d259e8cf37f6e1893658b84bb9479" [[package]] name = "arc-swap" @@ -823,9 +823,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" dependencies = [ "unicode-segmentation", ] @@ -1391,9 +1391,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c6d9b8427445284a09c55be860a15855ab580a417ccad9da88f5a06787ced0" +checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" dependencies = [ "cfg-if 1.0.0", "instant", @@ -1616,9 +1616,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" dependencies = [ "proc-macro2", ] @@ -2075,9 +2075,9 @@ checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75" [[package]] name = "socket2" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97e0e9fd577458a4f61fb91fcb559ea2afecc54c934119421f9f5d3d5b1a1057" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ "cfg-if 1.0.0", "libc", @@ -2110,9 +2110,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.54" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" +checksum = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a" dependencies = [ "proc-macro2", "quote", @@ -2315,9 +2315,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ "serde", ] diff --git a/cargo/crates.bzl b/cargo/crates.bzl index c320585d8..248073d13 100644 --- a/cargo/crates.bzl +++ b/cargo/crates.bzl @@ -53,12 +53,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__anyhow__1_0_35", - url = "https://crates.io/api/v1/crates/anyhow/1.0.35/download", + name = "raze__anyhow__1_0_36", + url = "https://crates.io/api/v1/crates/anyhow/1.0.36/download", type = "tar.gz", - sha256 = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4", - strip_prefix = "anyhow-1.0.35", - build_file = Label("//cargo/remote:BUILD.anyhow-1.0.35.bazel"), + sha256 = "68803225a7b13e47191bab76f2687382b60d259e8cf37f6e1893658b84bb9479", + strip_prefix = "anyhow-1.0.36", + build_file = Label("//cargo/remote:BUILD.anyhow-1.0.36.bazel"), ) maybe( @@ -843,12 +843,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__heck__0_3_1", - url = "https://crates.io/api/v1/crates/heck/0.3.1/download", + name = "raze__heck__0_3_2", + url = "https://crates.io/api/v1/crates/heck/0.3.2/download", type = "tar.gz", - sha256 = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205", - strip_prefix = "heck-0.3.1", - build_file = Label("//cargo/remote:BUILD.heck-0.3.1.bazel"), + sha256 = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac", + strip_prefix = "heck-0.3.2", + build_file = Label("//cargo/remote:BUILD.heck-0.3.2.bazel"), ) maybe( @@ -1433,12 +1433,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__parking_lot_core__0_8_1", - url = "https://crates.io/api/v1/crates/parking_lot_core/0.8.1/download", + name = "raze__parking_lot_core__0_8_2", + url = "https://crates.io/api/v1/crates/parking_lot_core/0.8.2/download", type = "tar.gz", - sha256 = "d7c6d9b8427445284a09c55be860a15855ab580a417ccad9da88f5a06787ced0", - strip_prefix = "parking_lot_core-0.8.1", - build_file = Label("//cargo/remote:BUILD.parking_lot_core-0.8.1.bazel"), + sha256 = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272", + strip_prefix = "parking_lot_core-0.8.2", + build_file = Label("//cargo/remote:BUILD.parking_lot_core-0.8.2.bazel"), ) maybe( @@ -1683,12 +1683,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__quote__1_0_7", - url = "https://crates.io/api/v1/crates/quote/1.0.7/download", + name = "raze__quote__1_0_8", + url = "https://crates.io/api/v1/crates/quote/1.0.8/download", type = "tar.gz", - sha256 = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37", - strip_prefix = "quote-1.0.7", - build_file = Label("//cargo/remote:BUILD.quote-1.0.7.bazel"), + sha256 = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df", + strip_prefix = "quote-1.0.8", + build_file = Label("//cargo/remote:BUILD.quote-1.0.8.bazel"), ) maybe( @@ -2103,12 +2103,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__socket2__0_3_18", - url = "https://crates.io/api/v1/crates/socket2/0.3.18/download", + name = "raze__socket2__0_3_19", + url = "https://crates.io/api/v1/crates/socket2/0.3.19/download", type = "tar.gz", - sha256 = "97e0e9fd577458a4f61fb91fcb559ea2afecc54c934119421f9f5d3d5b1a1057", - strip_prefix = "socket2-0.3.18", - build_file = Label("//cargo/remote:BUILD.socket2-0.3.18.bazel"), + sha256 = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e", + strip_prefix = "socket2-0.3.19", + build_file = Label("//cargo/remote:BUILD.socket2-0.3.19.bazel"), ) maybe( @@ -2153,12 +2153,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__syn__1_0_54", - url = "https://crates.io/api/v1/crates/syn/1.0.54/download", + name = "raze__syn__1_0_55", + url = "https://crates.io/api/v1/crates/syn/1.0.55/download", type = "tar.gz", - sha256 = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44", - strip_prefix = "syn-1.0.54", - build_file = Label("//cargo/remote:BUILD.syn-1.0.54.bazel"), + sha256 = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a", + strip_prefix = "syn-1.0.55", + build_file = Label("//cargo/remote:BUILD.syn-1.0.55.bazel"), ) maybe( @@ -2353,12 +2353,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__toml__0_5_7", - url = "https://crates.io/api/v1/crates/toml/0.5.7/download", + name = "raze__toml__0_5_8", + url = "https://crates.io/api/v1/crates/toml/0.5.8/download", type = "tar.gz", - sha256 = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645", - strip_prefix = "toml-0.5.7", - build_file = Label("//cargo/remote:BUILD.toml-0.5.7.bazel"), + sha256 = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa", + strip_prefix = "toml-0.5.8", + build_file = Label("//cargo/remote:BUILD.toml-0.5.8.bazel"), ) maybe( diff --git a/cargo/licenses.json b/cargo/licenses.json index f41752321..f2cc07379 100644 --- a/cargo/licenses.json +++ b/cargo/licenses.json @@ -55,7 +55,7 @@ }, { "name": "anyhow", - "version": "1.0.35", + "version": "1.0.36", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/anyhow", "license": "Apache-2.0 OR MIT", @@ -766,7 +766,7 @@ }, { "name": "heck", - "version": "0.3.1", + "version": "0.3.2", "authors": "Without Boats ", "repository": "https://github.com/withoutboats/heck", "license": "Apache-2.0 OR MIT", @@ -1297,7 +1297,7 @@ }, { "name": "parking_lot_core", - "version": "0.8.1", + "version": "0.8.2", "authors": "Amanieu d'Antras ", "repository": "https://github.com/Amanieu/parking_lot", "license": "Apache-2.0 OR MIT", @@ -1522,7 +1522,7 @@ }, { "name": "quote", - "version": "1.0.7", + "version": "1.0.8", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/quote", "license": "Apache-2.0 OR MIT", @@ -1909,7 +1909,7 @@ }, { "name": "socket2", - "version": "0.3.18", + "version": "0.3.19", "authors": "Alex Crichton ", "repository": "https://github.com/alexcrichton/socket2-rs", "license": "Apache-2.0 OR MIT", @@ -1954,7 +1954,7 @@ }, { "name": "syn", - "version": "1.0.54", + "version": "1.0.55", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/syn", "license": "Apache-2.0 OR MIT", @@ -2134,7 +2134,7 @@ }, { "name": "toml", - "version": "0.5.7", + "version": "0.5.8", "authors": "Alex Crichton ", "repository": "https://github.com/alexcrichton/toml-rs", "license": "Apache-2.0 OR MIT", diff --git a/cargo/remote/BUILD.anyhow-1.0.35.bazel b/cargo/remote/BUILD.anyhow-1.0.36.bazel similarity index 95% rename from cargo/remote/BUILD.anyhow-1.0.35.bazel rename to cargo/remote/BUILD.anyhow-1.0.36.bazel index d60beffdc..e49e4864f 100644 --- a/cargo/remote/BUILD.anyhow-1.0.35.bazel +++ b/cargo/remote/BUILD.anyhow-1.0.36.bazel @@ -54,7 +54,7 @@ cargo_build_script( "cargo-raze", "manual", ], - version = "1.0.35", + version = "1.0.36", visibility = ["//visibility:private"], deps = [ ], @@ -78,7 +78,7 @@ rust_library( "cargo-raze", "manual", ], - version = "1.0.35", + version = "1.0.36", # buildifier: leave-alone deps = [ ":anyhow_build_script", @@ -101,6 +101,8 @@ rust_library( # Unsupported target "test_downcast" with type "test" omitted +# Unsupported target "test_ffi" with type "test" omitted + # Unsupported target "test_fmt" with type "test" omitted # Unsupported target "test_macros" with type "test" omitted diff --git a/cargo/remote/BUILD.askama_derive-0.10.5.bazel b/cargo/remote/BUILD.askama_derive-0.10.5.bazel index 80e48b0ab..e78afefcf 100644 --- a/cargo/remote/BUILD.askama_derive-0.10.5.bazel +++ b/cargo/remote/BUILD.askama_derive-0.10.5.bazel @@ -51,6 +51,6 @@ rust_library( deps = [ "@raze__askama_shared__0_11_1//:askama_shared", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__syn__1_0_54//:syn", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.askama_shared-0.11.1.bazel b/cargo/remote/BUILD.askama_shared-0.11.1.bazel index 7a6c2f219..39acae264 100644 --- a/cargo/remote/BUILD.askama_shared-0.11.1.bazel +++ b/cargo/remote/BUILD.askama_shared-0.11.1.bazel @@ -61,9 +61,9 @@ rust_library( "@raze__num_traits__0_2_14//:num_traits", "@raze__percent_encoding__2_1_0//:percent_encoding", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", + "@raze__quote__1_0_8//:quote", "@raze__serde__1_0_118//:serde", - "@raze__syn__1_0_54//:syn", - "@raze__toml__0_5_7//:toml", + "@raze__syn__1_0_55//:syn", + "@raze__toml__0_5_8//:toml", ], ) diff --git a/cargo/remote/BUILD.ctor-0.1.16.bazel b/cargo/remote/BUILD.ctor-0.1.16.bazel index 9de79bfef..d5245fe81 100644 --- a/cargo/remote/BUILD.ctor-0.1.16.bazel +++ b/cargo/remote/BUILD.ctor-0.1.16.bazel @@ -51,7 +51,7 @@ rust_library( version = "0.1.16", # buildifier: leave-alone deps = [ - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.derivative-2.1.1.bazel b/cargo/remote/BUILD.derivative-2.1.1.bazel index 70dc771c1..55044bcc0 100644 --- a/cargo/remote/BUILD.derivative-2.1.1.bazel +++ b/cargo/remote/BUILD.derivative-2.1.1.bazel @@ -51,8 +51,8 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.failure_derive-0.1.8.bazel b/cargo/remote/BUILD.failure_derive-0.1.8.bazel index 7ff845f25..0bdc193c2 100644 --- a/cargo/remote/BUILD.failure_derive-0.1.8.bazel +++ b/cargo/remote/BUILD.failure_derive-0.1.8.bazel @@ -79,8 +79,8 @@ rust_library( deps = [ ":failure_derive_build_script", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", "@raze__synstructure__0_12_4//:synstructure", ], ) diff --git a/cargo/remote/BUILD.futures-macro-0.3.8.bazel b/cargo/remote/BUILD.futures-macro-0.3.8.bazel index 55406b6b7..0ce56872a 100644 --- a/cargo/remote/BUILD.futures-macro-0.3.8.bazel +++ b/cargo/remote/BUILD.futures-macro-0.3.8.bazel @@ -53,7 +53,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.ghost-0.1.2.bazel b/cargo/remote/BUILD.ghost-0.1.2.bazel index da4516c1f..ef6c68908 100644 --- a/cargo/remote/BUILD.ghost-0.1.2.bazel +++ b/cargo/remote/BUILD.ghost-0.1.2.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.heck-0.3.1.bazel b/cargo/remote/BUILD.heck-0.3.2.bazel similarity index 95% rename from cargo/remote/BUILD.heck-0.3.1.bazel rename to cargo/remote/BUILD.heck-0.3.2.bazel index 725be3d72..f982a953e 100644 --- a/cargo/remote/BUILD.heck-0.3.1.bazel +++ b/cargo/remote/BUILD.heck-0.3.2.bazel @@ -38,7 +38,7 @@ rust_library( crate_root = "src/lib.rs", crate_type = "lib", data = [], - edition = "2015", + edition = "2018", rustc_flags = [ "--cap-lints=allow", ], @@ -46,7 +46,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.3.1", + version = "0.3.2", # buildifier: leave-alone deps = [ "@raze__unicode_segmentation__1_7_1//:unicode_segmentation", diff --git a/cargo/remote/BUILD.hyper-0.13.9.bazel b/cargo/remote/BUILD.hyper-0.13.9.bazel index 97e8ccacb..4c49c54c3 100644 --- a/cargo/remote/BUILD.hyper-0.13.9.bazel +++ b/cargo/remote/BUILD.hyper-0.13.9.bazel @@ -106,7 +106,7 @@ rust_library( "@raze__httpdate__0_3_2//:httpdate", "@raze__itoa__0_4_6//:itoa", "@raze__pin_project__1_0_2//:pin_project", - "@raze__socket2__0_3_18//:socket2", + "@raze__socket2__0_3_19//:socket2", "@raze__tokio__0_2_24//:tokio", "@raze__tower_service__0_3_0//:tower_service", "@raze__tracing__0_1_22//:tracing", diff --git a/cargo/remote/BUILD.inventory-impl-0.1.10.bazel b/cargo/remote/BUILD.inventory-impl-0.1.10.bazel index 3c0740e22..f114abd04 100644 --- a/cargo/remote/BUILD.inventory-impl-0.1.10.bazel +++ b/cargo/remote/BUILD.inventory-impl-0.1.10.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.num_enum_derive-0.5.1.bazel b/cargo/remote/BUILD.num_enum_derive-0.5.1.bazel index 5e8546ed0..72fb3c202 100644 --- a/cargo/remote/BUILD.num_enum_derive-0.5.1.bazel +++ b/cargo/remote/BUILD.num_enum_derive-0.5.1.bazel @@ -53,7 +53,7 @@ rust_library( deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", "@raze__proc_macro_crate__0_1_5//:proc_macro_crate", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.parking_lot-0.11.1.bazel b/cargo/remote/BUILD.parking_lot-0.11.1.bazel index 9caa438d4..89ea3c351 100644 --- a/cargo/remote/BUILD.parking_lot-0.11.1.bazel +++ b/cargo/remote/BUILD.parking_lot-0.11.1.bazel @@ -52,7 +52,7 @@ rust_library( deps = [ "@raze__instant__0_1_9//:instant", "@raze__lock_api__0_4_2//:lock_api", - "@raze__parking_lot_core__0_8_1//:parking_lot_core", + "@raze__parking_lot_core__0_8_2//:parking_lot_core", ], ) diff --git a/cargo/remote/BUILD.parking_lot_core-0.8.1.bazel b/cargo/remote/BUILD.parking_lot_core-0.8.2.bazel similarity index 98% rename from cargo/remote/BUILD.parking_lot_core-0.8.1.bazel rename to cargo/remote/BUILD.parking_lot_core-0.8.2.bazel index c54752643..5084686c7 100644 --- a/cargo/remote/BUILD.parking_lot_core-0.8.1.bazel +++ b/cargo/remote/BUILD.parking_lot_core-0.8.2.bazel @@ -48,7 +48,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.8.1", + version = "0.8.2", # buildifier: leave-alone deps = [ "@raze__cfg_if__1_0_0//:cfg_if", diff --git a/cargo/remote/BUILD.pin-project-internal-0.4.27.bazel b/cargo/remote/BUILD.pin-project-internal-0.4.27.bazel index bb3efd253..e75143495 100644 --- a/cargo/remote/BUILD.pin-project-internal-0.4.27.bazel +++ b/cargo/remote/BUILD.pin-project-internal-0.4.27.bazel @@ -79,7 +79,7 @@ rust_library( deps = [ ":pin_project_internal_build_script", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.pin-project-internal-1.0.2.bazel b/cargo/remote/BUILD.pin-project-internal-1.0.2.bazel index b01095811..00198e1ce 100644 --- a/cargo/remote/BUILD.pin-project-internal-1.0.2.bazel +++ b/cargo/remote/BUILD.pin-project-internal-1.0.2.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.proc-macro-crate-0.1.5.bazel b/cargo/remote/BUILD.proc-macro-crate-0.1.5.bazel index a9b6911d0..de761c9ec 100644 --- a/cargo/remote/BUILD.proc-macro-crate-0.1.5.bazel +++ b/cargo/remote/BUILD.proc-macro-crate-0.1.5.bazel @@ -49,6 +49,6 @@ rust_library( version = "0.1.5", # buildifier: leave-alone deps = [ - "@raze__toml__0_5_7//:toml", + "@raze__toml__0_5_8//:toml", ], ) diff --git a/cargo/remote/BUILD.prost-build-0.6.1.bazel b/cargo/remote/BUILD.prost-build-0.6.1.bazel index fa2fb29d8..52dbf4d78 100644 --- a/cargo/remote/BUILD.prost-build-0.6.1.bazel +++ b/cargo/remote/BUILD.prost-build-0.6.1.bazel @@ -80,7 +80,7 @@ rust_library( deps = [ ":prost_build_build_script", "@raze__bytes__0_5_6//:bytes", - "@raze__heck__0_3_1//:heck", + "@raze__heck__0_3_2//:heck", "@raze__itertools__0_9_0//:itertools", "@raze__log__0_4_11//:log", "@raze__multimap__0_8_2//:multimap", diff --git a/cargo/remote/BUILD.prost-derive-0.6.1.bazel b/cargo/remote/BUILD.prost-derive-0.6.1.bazel index a1ab8d57b..42041ce5b 100644 --- a/cargo/remote/BUILD.prost-derive-0.6.1.bazel +++ b/cargo/remote/BUILD.prost-derive-0.6.1.bazel @@ -49,10 +49,10 @@ rust_library( version = "0.6.1", # buildifier: leave-alone deps = [ - "@raze__anyhow__1_0_35//:anyhow", + "@raze__anyhow__1_0_36//:anyhow", "@raze__itertools__0_9_0//:itertools", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.pyo3-derive-backend-0.12.4.bazel b/cargo/remote/BUILD.pyo3-derive-backend-0.12.4.bazel index e0b52b24a..a77574ff5 100644 --- a/cargo/remote/BUILD.pyo3-derive-backend-0.12.4.bazel +++ b/cargo/remote/BUILD.pyo3-derive-backend-0.12.4.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.pyo3cls-0.12.4.bazel b/cargo/remote/BUILD.pyo3cls-0.12.4.bazel index 5e65efba4..bc25816f1 100644 --- a/cargo/remote/BUILD.pyo3cls-0.12.4.bazel +++ b/cargo/remote/BUILD.pyo3cls-0.12.4.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__pyo3_derive_backend__0_12_4//:pyo3_derive_backend", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.quote-1.0.7.bazel b/cargo/remote/BUILD.quote-1.0.8.bazel similarity index 98% rename from cargo/remote/BUILD.quote-1.0.7.bazel rename to cargo/remote/BUILD.quote-1.0.8.bazel index e9b8e1fad..a3018c978 100644 --- a/cargo/remote/BUILD.quote-1.0.7.bazel +++ b/cargo/remote/BUILD.quote-1.0.8.bazel @@ -48,7 +48,7 @@ rust_library( "cargo-raze", "manual", ], - version = "1.0.7", + version = "1.0.8", # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", diff --git a/cargo/remote/BUILD.rental-impl-0.5.5.bazel b/cargo/remote/BUILD.rental-impl-0.5.5.bazel index eaeb66526..0790a572a 100644 --- a/cargo/remote/BUILD.rental-impl-0.5.5.bazel +++ b/cargo/remote/BUILD.rental-impl-0.5.5.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.serde_derive-1.0.118.bazel b/cargo/remote/BUILD.serde_derive-1.0.118.bazel index 9cfa5677a..165bbdedf 100644 --- a/cargo/remote/BUILD.serde_derive-1.0.118.bazel +++ b/cargo/remote/BUILD.serde_derive-1.0.118.bazel @@ -81,7 +81,7 @@ rust_library( deps = [ ":serde_derive_build_script", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.serde_repr-0.1.6.bazel b/cargo/remote/BUILD.serde_repr-0.1.6.bazel index 9cd257713..a331ba165 100644 --- a/cargo/remote/BUILD.serde_repr-0.1.6.bazel +++ b/cargo/remote/BUILD.serde_repr-0.1.6.bazel @@ -50,8 +50,8 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.serde_tuple_macros-0.5.0.bazel b/cargo/remote/BUILD.serde_tuple_macros-0.5.0.bazel index b7bb789d8..54e0a068f 100644 --- a/cargo/remote/BUILD.serde_tuple_macros-0.5.0.bazel +++ b/cargo/remote/BUILD.serde_tuple_macros-0.5.0.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.socket2-0.3.18.bazel b/cargo/remote/BUILD.socket2-0.3.19.bazel similarity index 98% rename from cargo/remote/BUILD.socket2-0.3.18.bazel rename to cargo/remote/BUILD.socket2-0.3.19.bazel index a260a6c5f..a28ed11d8 100644 --- a/cargo/remote/BUILD.socket2-0.3.18.bazel +++ b/cargo/remote/BUILD.socket2-0.3.19.bazel @@ -48,7 +48,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.3.18", + version = "0.3.19", # buildifier: leave-alone deps = [ ] + selects.with_or({ diff --git a/cargo/remote/BUILD.syn-1.0.54.bazel b/cargo/remote/BUILD.syn-1.0.55.bazel similarity index 97% rename from cargo/remote/BUILD.syn-1.0.54.bazel rename to cargo/remote/BUILD.syn-1.0.55.bazel index 9336ce05b..93fc513fc 100644 --- a/cargo/remote/BUILD.syn-1.0.54.bazel +++ b/cargo/remote/BUILD.syn-1.0.55.bazel @@ -64,7 +64,7 @@ cargo_build_script( "cargo-raze", "manual", ], - version = "1.0.54", + version = "1.0.55", visibility = ["//visibility:private"], deps = [ ], @@ -102,12 +102,12 @@ rust_library( "cargo-raze", "manual", ], - version = "1.0.54", + version = "1.0.55", # buildifier: leave-alone deps = [ ":syn_build_script", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", + "@raze__quote__1_0_8//:quote", "@raze__unicode_xid__0_2_1//:unicode_xid", ], ) diff --git a/cargo/remote/BUILD.synstructure-0.12.4.bazel b/cargo/remote/BUILD.synstructure-0.12.4.bazel index 6204e8672..dfdf5a266 100644 --- a/cargo/remote/BUILD.synstructure-0.12.4.bazel +++ b/cargo/remote/BUILD.synstructure-0.12.4.bazel @@ -52,8 +52,8 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", "@raze__unicode_xid__0_2_1//:unicode_xid", ], ) diff --git a/cargo/remote/BUILD.thiserror-impl-1.0.22.bazel b/cargo/remote/BUILD.thiserror-impl-1.0.22.bazel index f5ccf8239..db5025db1 100644 --- a/cargo/remote/BUILD.thiserror-impl-1.0.22.bazel +++ b/cargo/remote/BUILD.thiserror-impl-1.0.22.bazel @@ -50,7 +50,7 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", ], ) diff --git a/cargo/remote/BUILD.toml-0.5.7.bazel b/cargo/remote/BUILD.toml-0.5.8.bazel similarity index 98% rename from cargo/remote/BUILD.toml-0.5.7.bazel rename to cargo/remote/BUILD.toml-0.5.8.bazel index bd08226aa..fd227be9b 100644 --- a/cargo/remote/BUILD.toml-0.5.7.bazel +++ b/cargo/remote/BUILD.toml-0.5.8.bazel @@ -53,7 +53,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.5.7", + version = "0.5.8", # buildifier: leave-alone deps = [ "@raze__serde__1_0_118//:serde", diff --git a/cargo/remote/BUILD.unic-langid-macros-impl-0.9.0.bazel b/cargo/remote/BUILD.unic-langid-macros-impl-0.9.0.bazel index 5c099766f..91d5a4a90 100644 --- a/cargo/remote/BUILD.unic-langid-macros-impl-0.9.0.bazel +++ b/cargo/remote/BUILD.unic-langid-macros-impl-0.9.0.bazel @@ -52,8 +52,8 @@ rust_library( version = "0.9.0", # buildifier: leave-alone deps = [ - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", "@raze__unic_langid_impl__0_9_0//:unic_langid_impl", ], ) diff --git a/cargo/remote/BUILD.wasm-bindgen-backend-0.2.69.bazel b/cargo/remote/BUILD.wasm-bindgen-backend-0.2.69.bazel index f03126fbc..de854b05a 100644 --- a/cargo/remote/BUILD.wasm-bindgen-backend-0.2.69.bazel +++ b/cargo/remote/BUILD.wasm-bindgen-backend-0.2.69.bazel @@ -54,8 +54,8 @@ rust_library( "@raze__lazy_static__1_4_0//:lazy_static", "@raze__log__0_4_11//:log", "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", "@raze__wasm_bindgen_shared__0_2_69//:wasm_bindgen_shared", ], ) diff --git a/cargo/remote/BUILD.wasm-bindgen-macro-0.2.69.bazel b/cargo/remote/BUILD.wasm-bindgen-macro-0.2.69.bazel index eea980a0d..ecf60cef3 100644 --- a/cargo/remote/BUILD.wasm-bindgen-macro-0.2.69.bazel +++ b/cargo/remote/BUILD.wasm-bindgen-macro-0.2.69.bazel @@ -50,7 +50,7 @@ rust_library( version = "0.2.69", # buildifier: leave-alone deps = [ - "@raze__quote__1_0_7//:quote", + "@raze__quote__1_0_8//:quote", "@raze__wasm_bindgen_macro_support__0_2_69//:wasm_bindgen_macro_support", ], ) diff --git a/cargo/remote/BUILD.wasm-bindgen-macro-support-0.2.69.bazel b/cargo/remote/BUILD.wasm-bindgen-macro-support-0.2.69.bazel index d7e40c6d4..7f3078bfa 100644 --- a/cargo/remote/BUILD.wasm-bindgen-macro-support-0.2.69.bazel +++ b/cargo/remote/BUILD.wasm-bindgen-macro-support-0.2.69.bazel @@ -51,8 +51,8 @@ rust_library( # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", - "@raze__quote__1_0_7//:quote", - "@raze__syn__1_0_54//:syn", + "@raze__quote__1_0_8//:quote", + "@raze__syn__1_0_55//:syn", "@raze__wasm_bindgen_backend__0_2_69//:wasm_bindgen_backend", "@raze__wasm_bindgen_shared__0_2_69//:wasm_bindgen_shared", ], From c4382e38a1f281733e203bc02c6e367f99bd9150 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 10:08:38 +1000 Subject: [PATCH 040/179] update to stable pyo3 0.13 release --- Cargo.lock | 25 ++++++----- cargo/crates.bzl | 42 +++++++++---------- cargo/licenses.json | 24 +++++------ ...3-0.12.4.bazel => BUILD.pyo3-0.13.0.bazel} | 10 ++--- ...4.bazel => BUILD.pyo3-macros-0.13.0.bazel} | 8 ++-- ...=> BUILD.pyo3-macros-backend-0.13.0.bazel} | 6 +-- cargo/update.py | 2 - pylib/rsbridge/Cargo.toml | 3 +- pylib/rsbridge/cargo/BUILD.bazel | 2 +- 9 files changed, 61 insertions(+), 61 deletions(-) rename cargo/remote/{BUILD.pyo3-0.12.4.bazel => BUILD.pyo3-0.13.0.bazel} (96%) rename cargo/remote/{BUILD.pyo3cls-0.12.4.bazel => BUILD.pyo3-macros-0.13.0.bazel} (87%) rename cargo/remote/{BUILD.pyo3-derive-backend-0.12.4.bazel => BUILD.pyo3-macros-backend-0.13.0.bazel} (90%) diff --git a/Cargo.lock b/Cargo.lock index f3196c1e2..af6316b80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1580,8 +1580,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.12.4" -source = "git+https://github.com/PyO3/pyo3.git?rev=92b7a9736c9585883df5ec5bc01004caa7f65106#92b7a9736c9585883df5ec5bc01004caa7f65106" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdd01a4c2719dd1f3ceab0875fa1a2c2cd3c619477349d78f43cd716b345436" dependencies = [ "cfg-if 1.0.0", "ctor", @@ -1590,26 +1591,28 @@ dependencies = [ "libc", "parking_lot", "paste", - "pyo3cls", + "pyo3-macros", "unindent", ] [[package]] -name = "pyo3-derive-backend" -version = "0.12.4" -source = "git+https://github.com/PyO3/pyo3.git?rev=92b7a9736c9585883df5ec5bc01004caa7f65106#92b7a9736c9585883df5ec5bc01004caa7f65106" +name = "pyo3-macros" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8218769d13e354f841d559a19b0cf22cfd55959c7046ef594e5f34dbe46d16" dependencies = [ - "proc-macro2", + "pyo3-macros-backend", "quote", "syn", ] [[package]] -name = "pyo3cls" -version = "0.12.4" -source = "git+https://github.com/PyO3/pyo3.git?rev=92b7a9736c9585883df5ec5bc01004caa7f65106#92b7a9736c9585883df5ec5bc01004caa7f65106" +name = "pyo3-macros-backend" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc4da0bfdf76f0a5971c698f2cb6b3f832a6f80f16dedeeb3f123eb0431ecce2" dependencies = [ - "pyo3-derive-backend", + "proc-macro2", "quote", "syn", ] diff --git a/cargo/crates.bzl b/cargo/crates.bzl index 248073d13..43c2364e0 100644 --- a/cargo/crates.bzl +++ b/cargo/crates.bzl @@ -1652,33 +1652,33 @@ def raze_fetch_remote_crates(): ) maybe( - new_git_repository, - name = "raze__pyo3__0_12_4", - remote = "https://github.com/PyO3/pyo3.git", - shallow_since = "1606725379 +0000", - commit = "92b7a9736c9585883df5ec5bc01004caa7f65106", - build_file = Label("//cargo/remote:BUILD.pyo3-0.12.4.bazel"), - init_submodules = True, + http_archive, + name = "raze__pyo3__0_13_0", + url = "https://crates.io/api/v1/crates/pyo3/0.13.0/download", + type = "tar.gz", + sha256 = "5cdd01a4c2719dd1f3ceab0875fa1a2c2cd3c619477349d78f43cd716b345436", + strip_prefix = "pyo3-0.13.0", + build_file = Label("//cargo/remote:BUILD.pyo3-0.13.0.bazel"), ) maybe( - new_git_repository, - name = "raze__pyo3_derive_backend__0_12_4", - remote = "https://github.com/PyO3/pyo3.git", - shallow_since = "1606725379 +0000", - commit = "92b7a9736c9585883df5ec5bc01004caa7f65106", - build_file = Label("//cargo/remote:BUILD.pyo3-derive-backend-0.12.4.bazel"), - init_submodules = True, + http_archive, + name = "raze__pyo3_macros__0_13_0", + url = "https://crates.io/api/v1/crates/pyo3-macros/0.13.0/download", + type = "tar.gz", + sha256 = "7f8218769d13e354f841d559a19b0cf22cfd55959c7046ef594e5f34dbe46d16", + strip_prefix = "pyo3-macros-0.13.0", + build_file = Label("//cargo/remote:BUILD.pyo3-macros-0.13.0.bazel"), ) maybe( - new_git_repository, - name = "raze__pyo3cls__0_12_4", - remote = "https://github.com/PyO3/pyo3.git", - shallow_since = "1606725379 +0000", - commit = "92b7a9736c9585883df5ec5bc01004caa7f65106", - build_file = Label("//cargo/remote:BUILD.pyo3cls-0.12.4.bazel"), - init_submodules = True, + http_archive, + name = "raze__pyo3_macros_backend__0_13_0", + url = "https://crates.io/api/v1/crates/pyo3-macros-backend/0.13.0/download", + type = "tar.gz", + sha256 = "fc4da0bfdf76f0a5971c698f2cb6b3f832a6f80f16dedeeb3f123eb0431ecce2", + strip_prefix = "pyo3-macros-backend-0.13.0", + build_file = Label("//cargo/remote:BUILD.pyo3-macros-backend-0.13.0.bazel"), ) maybe( diff --git a/cargo/licenses.json b/cargo/licenses.json index f2cc07379..cce9f5a47 100644 --- a/cargo/licenses.json +++ b/cargo/licenses.json @@ -1495,7 +1495,7 @@ }, { "name": "pyo3", - "version": "0.12.4", + "version": "0.13.0", "authors": "PyO3 Project and Contributors ", "repository": "https://github.com/pyo3/pyo3", "license": "Apache-2.0", @@ -1503,23 +1503,23 @@ "description": "Bindings to Python interpreter" }, { - "name": "pyo3-derive-backend", - "version": "0.12.4", - "authors": "PyO3 Project and Contributors ", - "repository": "https://github.com/pyo3/pyo3", - "license": "Apache-2.0", - "license_file": null, - "description": "Code generation for PyO3 package" - }, - { - "name": "pyo3cls", - "version": "0.12.4", + "name": "pyo3-macros", + "version": "0.13.0", "authors": "PyO3 Project and Contributors ", "repository": "https://github.com/pyo3/pyo3", "license": "Apache-2.0", "license_file": null, "description": "Proc macros for PyO3 package" }, + { + "name": "pyo3-macros-backend", + "version": "0.13.0", + "authors": "PyO3 Project and Contributors ", + "repository": "https://github.com/pyo3/pyo3", + "license": "Apache-2.0", + "license_file": null, + "description": "Code generation for PyO3 package" + }, { "name": "quote", "version": "1.0.8", diff --git a/cargo/remote/BUILD.pyo3-0.12.4.bazel b/cargo/remote/BUILD.pyo3-0.13.0.bazel similarity index 96% rename from cargo/remote/BUILD.pyo3-0.12.4.bazel rename to cargo/remote/BUILD.pyo3-0.13.0.bazel index 1a6878e8c..6a688ea2b 100644 --- a/cargo/remote/BUILD.pyo3-0.12.4.bazel +++ b/cargo/remote/BUILD.pyo3-0.13.0.bazel @@ -49,7 +49,7 @@ cargo_build_script( "inventory", "macros", "paste", - "pyo3cls", + "pyo3-macros", "unindent", ], crate_root = "build.rs", @@ -62,7 +62,7 @@ cargo_build_script( "cargo-raze", "manual", ], - version = "0.12.4", + version = "0.13.0", visibility = ["//visibility:private"], deps = [ ], @@ -92,7 +92,7 @@ rust_library( "inventory", "macros", "paste", - "pyo3cls", + "pyo3-macros", "unindent", ], crate_root = "src/lib.rs", @@ -104,7 +104,7 @@ rust_library( "@raze__ctor__0_1_16//:ctor", "@raze__indoc__1_0_3//:indoc", "@raze__paste__1_0_4//:paste", - "@raze__pyo3cls__0_12_4//:pyo3cls", + "@raze__pyo3_macros__0_13_0//:pyo3_macros", ], rustc_flags = [ "--cap-lints=allow", @@ -113,7 +113,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.12.4", + version = "0.13.0", # buildifier: leave-alone deps = [ ":pyo3_build_script", diff --git a/cargo/remote/BUILD.pyo3cls-0.12.4.bazel b/cargo/remote/BUILD.pyo3-macros-0.13.0.bazel similarity index 87% rename from cargo/remote/BUILD.pyo3cls-0.12.4.bazel rename to cargo/remote/BUILD.pyo3-macros-0.13.0.bazel index bc25816f1..043634b82 100644 --- a/cargo/remote/BUILD.pyo3cls-0.12.4.bazel +++ b/cargo/remote/BUILD.pyo3-macros-0.13.0.bazel @@ -31,11 +31,11 @@ licenses([ # Generated Targets rust_library( - name = "pyo3cls", + name = "pyo3_macros", srcs = glob(["**/*.rs"]), crate_features = [ ], - crate_root = "pyo3cls/src/lib.rs", + crate_root = "src/lib.rs", crate_type = "proc-macro", data = [], edition = "2018", @@ -46,10 +46,10 @@ rust_library( "cargo-raze", "manual", ], - version = "0.12.4", + version = "0.13.0", # buildifier: leave-alone deps = [ - "@raze__pyo3_derive_backend__0_12_4//:pyo3_derive_backend", + "@raze__pyo3_macros_backend__0_13_0//:pyo3_macros_backend", "@raze__quote__1_0_8//:quote", "@raze__syn__1_0_55//:syn", ], diff --git a/cargo/remote/BUILD.pyo3-derive-backend-0.12.4.bazel b/cargo/remote/BUILD.pyo3-macros-backend-0.13.0.bazel similarity index 90% rename from cargo/remote/BUILD.pyo3-derive-backend-0.12.4.bazel rename to cargo/remote/BUILD.pyo3-macros-backend-0.13.0.bazel index a77574ff5..1545f8a56 100644 --- a/cargo/remote/BUILD.pyo3-derive-backend-0.12.4.bazel +++ b/cargo/remote/BUILD.pyo3-macros-backend-0.13.0.bazel @@ -31,11 +31,11 @@ licenses([ # Generated Targets rust_library( - name = "pyo3_derive_backend", + name = "pyo3_macros_backend", srcs = glob(["**/*.rs"]), crate_features = [ ], - crate_root = "pyo3-derive-backend/src/lib.rs", + crate_root = "src/lib.rs", crate_type = "lib", data = [], edition = "2018", @@ -46,7 +46,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.12.4", + version = "0.13.0", # buildifier: leave-alone deps = [ "@raze__proc_macro2__1_0_24//:proc_macro2", diff --git a/cargo/update.py b/cargo/update.py index 7ab683d67..62958b7c3 100644 --- a/cargo/update.py +++ b/cargo/update.py @@ -19,8 +19,6 @@ COMMITS_SHALLOW_SINCE = { "96e1358555c49905de89170f2b1102a7d8b6c4c2": "1598411535 +1000", # prost "4ded4a98ef339da0b7babd4efee3fbe8adaf746b": "1598739849 -0700", - # pyo3 - "92b7a9736c9585883df5ec5bc01004caa7f65106": "1606725379 +0000", } import os diff --git a/pylib/rsbridge/Cargo.toml b/pylib/rsbridge/Cargo.toml index 0bccffb81..bc76b4cd3 100644 --- a/pylib/rsbridge/Cargo.toml +++ b/pylib/rsbridge/Cargo.toml @@ -11,8 +11,7 @@ anki = { path = "../../rslib" } # /cargo/update.py needs to be run if updating the version below [dependencies.pyo3] -git = "https://github.com/PyO3/pyo3.git" -rev = "92b7a9736c9585883df5ec5bc01004caa7f65106" +version = "0.13" features = ["extension-module", "abi3"] [lib] diff --git a/pylib/rsbridge/cargo/BUILD.bazel b/pylib/rsbridge/cargo/BUILD.bazel index 61ed03e85..f4c169ae5 100644 --- a/pylib/rsbridge/cargo/BUILD.bazel +++ b/pylib/rsbridge/cargo/BUILD.bazel @@ -14,7 +14,7 @@ licenses([ # Aliased targets alias( name = "pyo3", - actual = "@raze__pyo3__0_12_4//:pyo3", + actual = "@raze__pyo3__0_13_0//:pyo3", tags = [ "cargo-raze", "manual", From 02d7e55f9b726fc6559e4ea957dc33f26961b610 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 16:05:15 +1000 Subject: [PATCH 041/179] update to rules_nodejs 3.0.0 Seems to fix the rollup issues on Windows. --- docs/windows.md | 6 +- repos.bzl | 37 +++--- ts/package.json | 6 +- ...bs+2.2.2.patch => @bazel+labs+3.0.0.patch} | 2 +- ts/yarn.lock | 108 +++++++++--------- 5 files changed, 84 insertions(+), 75 deletions(-) rename ts/patches/{@bazel+labs+2.2.2.patch => @bazel+labs+3.0.0.patch} (98%) diff --git a/docs/windows.md b/docs/windows.md index 6502475d4..3b53a377d 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -63,9 +63,9 @@ problems. ## Build failures -The Javascript bundling on Windows is currently a bit flaky, so the initial -build will likely fail with an error about a missing rollup module. If you -get an error when running the commands below, try repeating them once or twice. +The Javascript rules have been a bit flaky on Windows in the past. If you +experience a build failure, try running the same command again, as there's +a good chance the build will succeed the second time. ## Running Anki during development diff --git a/repos.bzl b/repos.bzl index 0618f711d..68da262b9 100644 --- a/repos.bzl +++ b/repos.bzl @@ -28,7 +28,7 @@ def register_repos(): maybe( http_archive, name = "com_google_protobuf", - sha256 = "6dd0f6b20094910fbb7f1f7908688df01af2d4f6c5c21331b9f636048674aebf", + sha256 = "6dd0f6b20094910fbb7f1f7908688df01af2d4f6c5c21331b9f636048674aebf", strip_prefix = "protobuf-3.14.0", urls = [ "https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protobuf-all-3.14.0.tar.gz", @@ -86,8 +86,8 @@ def register_repos(): maybe( http_archive, name = "build_bazel_rules_nodejs", - sha256 = "cd6c9880292fc83f1fd16ba33000974544b0fe0fccf3d5e15b2e3071ba011266", - urls = ["https://github.com/ankitects/rules_nodejs/releases/download/runfiles-fix-release/release.tar.gz"], + sha256 = "6142e9586162b179fdd570a55e50d1332e7d9c030efd853453438d607569721d", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.0.0/rules_nodejs-3.0.0.tar.gz"], ) # maybe( @@ -103,30 +103,39 @@ def register_repos(): # sass ############ + # native.local_repository( + # name = "io_bazel_rules_sass", + # path = "../rules_sass", + # ) + maybe( http_archive, name = "io_bazel_rules_sass", - sha256 = "6e60fc1cf0805af2cdcce727a5eed3f238fb4df41b35ce581c57996947c0202c", - strip_prefix = "rules_sass-1.26.12", - url = "https://github.com/bazelbuild/rules_sass/archive/1.26.12.zip", + strip_prefix = "rules_sass-anki-2020-12-23", + urls = [ + "https://github.com/ankitects/rules_sass/archive/anki-2020-12-23.tar.gz", + ], + sha256 = "224ae14b8d2166b3ab4c5fa9b2ae1828f30620ac628dc152e6c0859c7853bb97", ) # svelte ########## - maybe( - git_repository, - name = "build_bazel_rules_svelte", - commit = "c28cd9e5d251a0ce47c68a6a2a11b075f3df8899", - remote = "https://github.com/ankitects/rules_svelte", - shallow_since = "1603950453 +1000", - ) - # native.local_repository( # name = "build_bazel_rules_svelte", # path = "../rules_svelte", # ) + maybe( + http_archive, + name = "build_bazel_rules_svelte", + strip_prefix = "rules_svelte-anki-2020-12-23", + urls = [ + "https://github.com/ankitects/rules_svelte/archive/anki-2020-12-23.tar.gz", + ], + sha256 = "eb0e910579b71242b44480b5dcc34c63d9a530d6fb7913139759ef397ff30bb2", + ) + # translations ################ diff --git a/ts/package.json b/ts/package.json index 89841291f..7726ddad8 100644 --- a/ts/package.json +++ b/ts/package.json @@ -6,9 +6,9 @@ "license": "AGPL-3.0-or-later", "description": "Anki JS support files", "devDependencies": { - "@bazel/labs": "=2.2.2", - "@bazel/rollup": "=2.2.2", - "@bazel/typescript": "=2.2.2", + "@bazel/labs": "^3.0.0", + "@bazel/rollup": "^3.0.0", + "@bazel/typescript": "^3.0.0", "@pyoner/svelte-types": "^3.4.4-2", "@rollup/plugin-commonjs": "^15.1.0", "@rollup/plugin-node-resolve": "^9.0.0", diff --git a/ts/patches/@bazel+labs+2.2.2.patch b/ts/patches/@bazel+labs+3.0.0.patch similarity index 98% rename from ts/patches/@bazel+labs+2.2.2.patch rename to ts/patches/@bazel+labs+3.0.0.patch index e84b49f9f..94504f721 100644 --- a/ts/patches/@bazel+labs+2.2.2.patch +++ b/ts/patches/@bazel+labs+3.0.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@bazel/labs/protobufjs/ts_proto_library.bzl b/node_modules/@bazel/labs/protobufjs/ts_proto_library.bzl -index 3de013c..2ef1c84 100755 +index fec29b6..fc77192 100755 --- a/node_modules/@bazel/labs/protobufjs/ts_proto_library.bzl +++ b/node_modules/@bazel/labs/protobufjs/ts_proto_library.bzl @@ -15,7 +15,16 @@ diff --git a/ts/yarn.lock b/ts/yarn.lock index ac53cb7ac..61ae4a25d 100644 --- a/ts/yarn.lock +++ b/ts/yarn.lock @@ -3,16 +3,16 @@ "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" - integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" "@babel/helper-validator-identifier@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" - integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" + integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== "@babel/highlight@^7.10.4": version "7.10.4" @@ -24,24 +24,24 @@ js-tokens "^4.0.0" "@babel/parser@^7.9.4": - version "7.12.7" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.7.tgz#fee7b39fe809d0e73e5b25eecaf5780ef3d73056" - integrity sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg== + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.11.tgz#9ce3595bcd74bc5c466905e86c535b8b25011e79" + integrity sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg== -"@bazel/labs@=2.2.2": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@bazel/labs/-/labs-2.2.2.tgz#0f57547d845bf3539c629b912ce74fc1391a7e20" - integrity sha512-epthtuksxNc1Rr5vHQQmUYnLCmhu3tt8NadFf1G7Bvu3yi+BkfdxUSo7NXt+2YN7KqZlqx901YGKLy0z0jxjmw== +"@bazel/labs@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@bazel/labs/-/labs-3.0.0.tgz#1e7f22acee029aee27b01bef018656ad31c20c35" + integrity sha512-+3k2GDGvZ4lrP9wuP7Vqnsy1wU1Zlw6Kub0c8hNfuwc9oWxlobIDQx1hXCBjf0UaThnHoAzQDrRc1tviNQqnyg== -"@bazel/rollup@=2.2.2": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-2.2.2.tgz#1abfc5cbf5eb65db2aa145e584d225684d961055" - integrity sha512-z3sK0dt7pftjxlLuo66e3PMMGyjq6vD/8B+OEFN3LD3GjE34e8X0/KeRX5lXWs1ecVlrnTroiBxLCJSHwqBrEA== +"@bazel/rollup@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-3.0.0.tgz#6e424966d5ec41f6fcdbfbe25ec88d714f081b06" + integrity sha512-IEq+zbbzWC1hRsdCD/9UocznDJ5aNXlg+XcChM3+VJaloBCKoqAiGf337T6AkPZs3HuAlEHYMvqsRyEHxEQmtg== -"@bazel/typescript@=2.2.2": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-2.2.2.tgz#c7cd49cb630ca3720c04c94046ba8ca4c0d5b0aa" - integrity sha512-hkx/7L3s8q5gIgaSFmkUZWPqdKmdJmQ04GaLnsI/YEp9EhPObqATSKnOHeDdT7bzqLO7giDAwAiXhEmsO1Smcw== +"@bazel/typescript@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.0.0.tgz#7cb3bcf405c590228888be78b9e49d1dc298dfea" + integrity sha512-qYsfyi/+7QOFP9uVAv3gKaqkxo+fIamFrdQ71K85FlJSowxAkwj51pxOPnIWBcMzFVNv1p2ZyfM3ZctKqGye2g== dependencies: protobufjs "6.8.8" semver "5.6.0" @@ -243,9 +243,9 @@ "@types/sizzle" "*" "@types/jqueryui@^1.12.13": - version "1.12.13" - resolved "https://registry.yarnpkg.com/@types/jqueryui/-/jqueryui-1.12.13.tgz#1aa0507b4d1a75b03592d2126fbd6d2ea8e8c284" - integrity sha512-IIOytTkwN6mBcJqi5SP8T8zqDGKy9hIpifQ0aGj1/ZjqshOoMo0yZdLp2uLIg7mQDJOwMCSC3EY1QZC/qZzvLQ== + version "1.12.14" + resolved "https://registry.yarnpkg.com/@types/jqueryui/-/jqueryui-1.12.14.tgz#33559cd1024bfc56bc18aeca8c8939fbb48e3418" + integrity sha512-fR9PoOI0yauBS0sjGaU3ao0s2pJWjBi0yVYnPdYbllNoimaPUlHMOh0Ubq+hy8OB258hRSlK2hWCJk40kNhrZQ== dependencies: "@types/jquery" "*" @@ -265,19 +265,19 @@ integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== "@types/node@*": - version "14.14.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.11.tgz#fc25a4248a5e8d0837019b1d170146d07334abe0" - integrity sha512-BJ97wAUuU3NUiUCp44xzUFquQEvnk1wu7q4CMEUYKJWjdkr0YWYDsm4RFtAvxYsNjLsKcrFt6RvK8r+mnzMbEQ== + version "14.14.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.14.tgz#f7fd5f3cc8521301119f63910f0fb965c7d761ae" + integrity sha512-UHnOPWVWV1z+VV8k6L1HhG7UbGBgIdghqF3l9Ny9ApPghbjICXkUJSd/b9gOgQfjM1r+37cipdw/HJ3F6ICEnQ== "@types/node@^10.1.0": - version "10.17.48" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.48.tgz#726e7f25d00bf58d79c8f00dd586dd9a10d06a4f" - integrity sha512-Agl6xbYP6FOMDeAsr3QVZ+g7Yzg0uhPHWx0j5g4LFdUBHVtqtU+gH660k/lCEe506jJLOGbEzsnqPDTZGJQLag== + version "10.17.49" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.49.tgz#ecf0b67bab4b84d0ec9b0709db4aac3824a51c4a" + integrity sha512-PGaJNs5IZz5XgzwJvL/1zRfZB7iaJ5BydZ8/Picm+lUNYoNO9iVTQkVy5eUh0dZDrx3rBOIs3GCbCRmMuYyqwg== "@types/node@^13.7.0": - version "13.13.35" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.35.tgz#d417b48313d691f5c8ff9c52cbc19cdecd306b5e" - integrity sha512-q9aeOGwv+RRou/ca4aJVUM/jD5u7LBexu+rq9PkA/NhHNn8JifcMo94soKm0b6JGSfw/PSNdqtc428OscMvEYA== + version "13.13.36" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.36.tgz#0c4d3c4e365396c84b1c595524e2faff7dd45b26" + integrity sha512-ctzZJ+XsmHQwe3xp07gFUq4JxBaRSYzKHPgblR76//UanGST7vfFNF0+ty5eEbgTqsENopzoDK090xlha9dccQ== "@types/prop-types@*": version "15.7.3" @@ -569,9 +569,9 @@ buffer-from@^1.0.0: integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== builtin-modules@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" - integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== + version "3.2.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" + integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA== cache-base@^1.0.1: version "1.0.1" @@ -1400,9 +1400,9 @@ ignore@^4.0.6: integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== import-fresh@^3.0.0, import-fresh@^3.2.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.2.tgz#fc129c160c5d68235507f4331a6baad186bdbc3e" - integrity sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw== + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" @@ -2353,9 +2353,9 @@ rollup-plugin-terser@^7.0.2: terser "^5.0.0" rollup@^2.32.1: - version "2.34.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.34.2.tgz#fa73e05c64df587e9ed4dc80d7d4e7d4a43f8908" - integrity sha512-mvtQLqu3cNeoctS+kZ09iOPxrc1P1/Bt1z15enuQ5feyKOdM3MJAVFjjsygurDpSWn530xB4AlA83TWIzRstXA== + version "2.35.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.35.1.tgz#e6bc8d10893556a638066f89e8c97f422d03968c" + integrity sha512-q5KxEyWpprAIcainhVy6HfRttD9kutQpHbeqDTWnqAFNJotiojetK6uqmcydNMymBEtC4I8bCYR+J3mTMqeaUA== optionalDependencies: fsevents "~2.1.2" @@ -2685,9 +2685,9 @@ supports-color@^7.0.0, supports-color@^7.1.0: has-flag "^4.0.0" svelte-check@^1.0.61: - version "1.1.20" - resolved "https://registry.yarnpkg.com/svelte-check/-/svelte-check-1.1.20.tgz#a7faae78c6af490e2b88d7da2706c132cfa82c0f" - integrity sha512-+fNEROQTlfRxMZTpOZjuaal1Ola1T0b7ji+8pOoLmdeUe32maX8zCPnOnM9vuT1xee9kzhQCbOUKvXBCPB/eCw== + version "1.1.23" + resolved "https://registry.yarnpkg.com/svelte-check/-/svelte-check-1.1.23.tgz#9540f65b3dabc82a394185329e1b2d8bd94c0e04" + integrity sha512-mPIUStnwCn1PUG9Ps4shy5w46IbPXMhKigWlrfyNwV6SyDYGM+qT/DEf7+J30v47DzW3iTeR70cQu/C72IOh2g== dependencies: chalk "^4.0.0" chokidar "^3.4.1" @@ -2709,9 +2709,9 @@ svelte-preprocess@^4.0.0: strip-indent "^3.0.0" svelte2tsx@^0.1.133: - version "0.1.152" - resolved "https://registry.yarnpkg.com/svelte2tsx/-/svelte2tsx-0.1.152.tgz#ba5a7bafb5a34fad3ede7cdc8b9f2c0474ca9262" - integrity sha512-QTBAhIoDp1x8D+BmInXGuVvWWu3X++umD3BJVM/jktaFXd7awJoqz3W23THP+zkgeeEOuG5esOKDvtRqeCIXjA== + version "0.1.156" + resolved "https://registry.yarnpkg.com/svelte2tsx/-/svelte2tsx-0.1.156.tgz#896478339529f219283c9df001aff56cb7b93d71" + integrity sha512-EknwZyHHt97eON2vTwuZ1ZK0Djo54BcMASDgv0VrTpXsllQCALlHMa89e0sCongxPhAa+11ctWAPVTvbx9KYWw== dependencies: dedent-js "^1.0.1" pascal-case "^3.1.1" @@ -2848,9 +2848,9 @@ type-fest@^0.8.1: integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== typescript@*: - version "4.1.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9" - integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== + version "4.1.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" + integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== typescript@^3.9.7: version "3.9.7" @@ -2863,9 +2863,9 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== uglify-js@^3.3.25: - version "3.12.1" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.12.1.tgz#78307f539f7b9ca5557babb186ea78ad30cc0375" - integrity sha512-o8lHP20KjIiQe5b/67Rh68xEGRrc2SRsCuuoYclXXoC74AfSRGblU1HKzJWH3HxPZ+Ort85fWHpSX7KwBUC9CQ== + version "3.12.3" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.12.3.tgz#bb26c4abe0e68c55e9776bca9bed99a4df73facf" + integrity sha512-feZzR+kIcSVuLi3s/0x0b2Tx4Iokwqt+8PJM7yRHKuldg4MLdam4TCFeICv+lgDtuYiCtdmrtIP+uN9LWvDasw== underscore@~1.10.2: version "1.10.2" From 7a3e21daad8129e18a8879c6b6fe72f9a877efef Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 16:27:45 +1000 Subject: [PATCH 042/179] revert docs change; rollup issues occurred again in CI --- docs/windows.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/windows.md b/docs/windows.md index 3b53a377d..6502475d4 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -63,9 +63,9 @@ problems. ## Build failures -The Javascript rules have been a bit flaky on Windows in the past. If you -experience a build failure, try running the same command again, as there's -a good chance the build will succeed the second time. +The Javascript bundling on Windows is currently a bit flaky, so the initial +build will likely fail with an error about a missing rollup module. If you +get an error when running the commands below, try repeating them once or twice. ## Running Anki during development From 9f1bd145272f109e0453bccab8107367a93abdcd Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 17:10:37 +1000 Subject: [PATCH 043/179] use protobuf binaries to reduce initial compile times --- defs.bzl | 6 ++--- platforms/README.md | 4 +-- protobuf.bzl | 63 +++++++++++++++++++++++++++++++++++++++++++++ repos.bzl | 13 ---------- 4 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 protobuf.bzl diff --git a/defs.bzl b/defs.bzl index ce6577804..a2c3ed872 100644 --- a/defs.bzl +++ b/defs.bzl @@ -3,10 +3,10 @@ load("@bazel_skylib//lib:versions.bzl", "versions") load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") load("@net_ankiweb_anki//cargo:crates.bzl", "raze_fetch_remote_crates") load(":python.bzl", "setup_local_python") +load(":protobuf.bzl", "setup_protobuf_binary") load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories") load("@build_bazel_rules_svelte//:defs.bzl", "rules_svelte_dependencies") -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") load("@com_github_ali5h_rules_pip//:defs.bzl", "pip_import") load("//pip/pyqt5:defs.bzl", "install_pyqt5") @@ -26,6 +26,8 @@ def setup_deps(): setup_local_python(name = "python") + setup_protobuf_binary(name = "com_google_protobuf") + native.register_toolchains("@python//:python3_toolchain") pip_import( @@ -50,5 +52,3 @@ def setup_deps(): sass_repositories() rules_svelte_dependencies() - - protobuf_deps() diff --git a/platforms/README.md b/platforms/README.md index 651ff8de4..c55b72f75 100644 --- a/platforms/README.md +++ b/platforms/README.md @@ -1,2 +1,2 @@ -Platform constraints. Currently only used to control wheel filenames -on a per-platform basis. +Platform constraints, used for things like controlling wheel filenames +on a per-platform basis, and selecting the correct protobuf binary. diff --git a/protobuf.bzl b/protobuf.bzl new file mode 100644 index 000000000..13cd957c0 --- /dev/null +++ b/protobuf.bzl @@ -0,0 +1,63 @@ +""" +Replace @com_google_protobuf with a platform binary. + +Avoids the long initial compile, but will fail if anything depends on the protobuf library. +""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +def _impl(rctx): + rctx.file("BUILD.bazel", """ +alias( + name = "protoc", + actual = select({ + "@net_ankiweb_anki//platforms:windows_x86_64": "@protoc_bin_windows//:bin/protoc.exe", + "@net_ankiweb_anki//platforms:macos_x86_64": "@protoc_bin_macos//:bin/protoc", + "@net_ankiweb_anki//platforms:linux_x86_64": "@protoc_bin_linux//:bin/protoc" + }), + visibility = ["//visibility:public"] +) +""") + +_setup_protoc = repository_rule( + implementation = _impl, + local = True, + attrs = {}, +) + +def setup_protobuf_binary(name): + maybe( + http_archive, + name = "protoc_bin_macos", + urls = [ + "https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-osx-x86_64.zip", + ], + sha256 = "699ceee7ef0988ecf72bf1c146dee5d9d89351a19d4093d30ebea3c04008bb8c", + build_file_content = """exports_files(["bin/protoc"])""", + ) + + maybe( + http_archive, + name = "protoc_bin_linux", + urls = [ + "https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-linux-x86_64.zip", + ], + sha256 = "a2900100ef9cda17d9c0bbf6a3c3592e809f9842f2d9f0d50e3fba7f3fc864f0", + build_file_content = """exports_files(["bin/protoc"])""", + ) + + maybe( + http_archive, + name = "protoc_bin_windows", + urls = [ + "https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-win64.zip", + ], + sha256 = "642554ed4dd2dba94e1afddcccdd7d832999cea309299cc5952f13db389894f8", + build_file_content = """exports_files(["bin/protoc.exe"])""", + ) + + if not native.existing_rule(name): + _setup_protoc( + name = name, + ) diff --git a/repos.bzl b/repos.bzl index 68da262b9..1464287ff 100644 --- a/repos.bzl +++ b/repos.bzl @@ -22,19 +22,6 @@ def register_repos(): ], ) - # protobuf - ############ - - maybe( - http_archive, - name = "com_google_protobuf", - sha256 = "6dd0f6b20094910fbb7f1f7908688df01af2d4f6c5c21331b9f636048674aebf", - strip_prefix = "protobuf-3.14.0", - urls = [ - "https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protobuf-all-3.14.0.tar.gz", - ], - ) - # rust ######## From 38614ab0477ca99505877b18c68d905fd2f17daf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 20:27:31 +1000 Subject: [PATCH 044/179] winrt 1.0.20239.1 isn't available for python 3.9 --- pip/requirements.in | 4 ++-- pip/requirements.txt | 7 +++++-- qt/aqt/BUILD.bazel | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pip/requirements.in b/pip/requirements.in index 72af7bc87..c68cfdd8e 100644 --- a/pip/requirements.in +++ b/pip/requirements.in @@ -26,8 +26,8 @@ fluent-syntax psutil; sys.platform == "win32" pywin32; sys.platform == "win32" # pinned due to https://github.com/microsoft/xlang/issues/717 -# the latest version apparently works on python3.9 -winrt==1.0.20239.1; sys.platform == "win32" and platform_release == "10" +winrt==1.0.20239.1; sys.platform == "win32" and platform_release == "10" and python_version == "3.8" +winrt; sys.platform == "win32" and platform_release == "10" and python_version >= "3.9" # transitive windows dependencies atomicwrites; sys.platform == "win32" # via pytest diff --git a/pip/requirements.txt b/pip/requirements.txt index eddaa4008..51d1ce444 100644 --- a/pip/requirements.txt +++ b/pip/requirements.txt @@ -55,9 +55,12 @@ typing-extensions==3.7.4.3 # via black, mypy urllib3==1.26.2 # via requests waitress==2.0.0b1 # via -r requirements.in werkzeug==1.0.1 # via flask -winrt==1.0.20239.1 ; sys_platform == "win32" and platform_release == "10" # via -r requirements.in +winrt==1.0.20239.1 ; sys_platform == "win32" and platform_release == "10" and python_version == "3.8" # via -r requirements.in wrapt==1.12.1 # via astroid # The following packages are considered to be unsafe in a requirements file: pip==20.3.3 # via pip-tools -setuptools==51.1.0.post20201221 # via jsonschema +setuptools==51.1.0 # via jsonschema + +# manually added for now; ensure it and the earlier winrt are not removed on update +winrt==1.0.20330.1; sys.platform == "win32" and platform_release == "10" and python_version >= "3.9" diff --git a/qt/aqt/BUILD.bazel b/qt/aqt/BUILD.bazel index ad75b8f39..7bfa5f261 100644 --- a/qt/aqt/BUILD.bazel +++ b/qt/aqt/BUILD.bazel @@ -113,7 +113,8 @@ py_wheel( "pyqtwebengine", 'psutil; sys.platform == "win32"', 'pywin32; sys.platform == "win32"', - 'winrt==1.0.20239.1 ; sys_platform == "win32" and platform_release == "10"', + 'winrt==1.0.20239.1; sys.platform == "win32" and platform_release == "10" and python_version == "3.8"', + 'winrt; sys.platform == "win32" and platform_release == "10" and python_version >= "3.9"', "anki==" + anki_version, ], strip_path_prefixes = [ From f6318af59b0ab23db6b542f680bbfda09b651a71 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 20:42:45 +1000 Subject: [PATCH 045/179] convert some more git repositories to HTTP archives Faster to download, and can be cached. Archives are from the same commits as before. --- repos.bzl | 59 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/repos.bzl b/repos.bzl index 1464287ff..b10f34a1a 100644 --- a/repos.bzl +++ b/repos.bzl @@ -31,35 +31,31 @@ def register_repos(): # ) maybe( - git_repository, + http_archive, name = "io_bazel_rules_rust", - commit = "dfd1200fcdcc0d56d725818ed3a66316517f20a6", - remote = "https://github.com/ankitects/rules_rust", - shallow_since = "1607578413 +1000", + strip_prefix = "rules_rust-anki-2020-12-10", + urls = [ + "https://github.com/ankitects/rules_rust/archive/anki-2020-12-10.tar.gz", + ], + sha256 = "80a7647c3c1992c434a462bf424b9138c3c9af6c794ac112f636ca7c8c53180e", ) # python ########## - maybe( - git_repository, - name = "rules_python", - commit = "3927c9bce90f629eb5ab08bbc99a3d3bda1d95c0", - remote = "https://github.com/ankitects/rules_python", - shallow_since = "1604408056 +1000", - ) - # native.local_repository( # name = "rules_python", # path = "../rules_python", # ) maybe( - git_repository, - name = "com_github_ali5h_rules_pip", - commit = "73953e06fdacb565f224c66f0683a7d8d0ede223", - remote = "https://github.com/ankitects/rules_pip", - shallow_since = "1606453171 +1000", + http_archive, + name = "rules_python", + strip_prefix = "rules_python-anki-2020-11-04", + urls = [ + "https://github.com/ankitects/rules_python/archive/anki-2020-11-04.tar.gz", + ], + sha256 = "00e444dc3872a87838c2cb0cf50a15d92ca669385b72998f796d2fd6814356a3", ) # native.local_repository( @@ -67,9 +63,28 @@ def register_repos(): # path = "../rules_pip", # ) + maybe( + http_archive, + name = "com_github_ali5h_rules_pip", + strip_prefix = "rules_pip-anki-2020-11-30", + urls = [ + "https://github.com/ankitects/rules_pip/archive/anki-2020-11-30.tar.gz", + ], + sha256 = "ab4f10967eb87985383a4172d4533dde568b3ff502aa550239eeccead249325b", + ) + # javascript ############## + # maybe( + # http_archive, + # name = "build_bazel_rules_nodejs", + # urls = [ + # "file:///c:/anki/release.tar.gz", + # "file:///Users/dae/Work/code/dtop/release.tar.gz", + # ], + # ) + maybe( http_archive, name = "build_bazel_rules_nodejs", @@ -77,16 +92,6 @@ def register_repos(): urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.0.0/rules_nodejs-3.0.0.tar.gz"], ) - # maybe( - # http_archive, - # name = "build_bazel_rules_nodejs", - # # sha256 = "64a71a64ac58b8969bb19b1c9258a973b6433913e958964da698943fb5521d98", - # urls = [ - # "file:///c:/anki/release.tar.gz", - # "file:///Users/dae/Work/code/dtop/release.tar.gz", - # ], - # ) - # sass ############ From 5dd0eaf0a23cf612f119963f1a149b9ba7dca661 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 21:27:35 +1000 Subject: [PATCH 046/179] update translations; use http_archive --- ftl/sync.py | 32 ++++++++++++++++++++++++-------- repos.bzl | 34 +++++++++++++++++++++++----------- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/ftl/sync.py b/ftl/sync.py index f929ce935..0696d99f6 100644 --- a/ftl/sync.py +++ b/ftl/sync.py @@ -9,6 +9,8 @@ import re import os import sys from typing import Optional, Tuple +import requests +from hashlib import sha256 root = os.environ["BUILD_WORKSPACE_DIRECTORY"] repos_bzl = os.path.join(root, "repos.bzl") @@ -64,18 +66,32 @@ def update_git_repos(): @dataclass class GitInfo: sha1: str - shallow_since: str + zip_sha256: str + + +def git_url_to_zip_url(repo: str, commit: str) -> str: + repo = repo.replace("git@github.com:", "https://github.com/") + return f"{repo}/archive/{commit}.zip" + + +def get_zip_sha(zip_url: str) -> str: + resp = requests.get(zip_url) + resp.raise_for_status() + return sha256(resp.content).hexdigest() def module_git_info(module: Module) -> GitInfo: folder = module.folder() - sha = subprocess.check_output( + sha1 = subprocess.check_output( ["git", "log", "-n", "1", "--pretty=format:%H"], cwd=folder + ).decode("utf8") + zip_url = git_url_to_zip_url(module.repo, sha1) + zip_sha = get_zip_sha(zip_url) + + return GitInfo( + sha1=sha1, + zip_sha256=zip_sha, ) - shallow = subprocess.check_output( - ["git", "log", "-n", "1", "--pretty=format:%cd", "--date=raw"], cwd=folder - ) - return GitInfo(sha1=sha.decode("utf8"), shallow_since=shallow.decode("utf8")) def update_repos_bzl(): @@ -85,12 +101,12 @@ def update_repos_bzl(): git = module_git_info(module) prefix = f"{module.name}_i18n_" entries[prefix + "commit"] = git.sha1 - entries[prefix + "shallow_since"] = git.shallow_since + entries[prefix + "zip_csum"] = git.zip_sha256 # apply out = [] path = repos_bzl - reg = re.compile(r'(\s+)(\S+_(?:commit|shallow_since)) = "(.*)"') + reg = re.compile(r'(\s+)(\S+_(?:commit|zip_csum)) = "(.*)"') for line in open(path).readlines(): if m := reg.match(line): (indent, key, _oldvalue) = m.groups() diff --git a/repos.bzl b/repos.bzl index b10f34a1a..a4ebd492d 100644 --- a/repos.bzl +++ b/repos.bzl @@ -131,11 +131,13 @@ def register_repos(): # translations ################ + core_i18n_repo = "anki-core-i18n" core_i18n_commit = "b1c03cebb554e8568529e293756ac36cdf62341a" - core_i18n_shallow_since = "1608607833 +1000" + core_i18n_zip_csum = "ce9c846e6985af9bda2d51390df4dd8a65e91ce9f8f217a0ef46565271303e43" - qtftl_i18n_commit = "e7dda1058c0510665f2ea8d8ffd74e506e578f7a" - qtftl_i18n_shallow_since = "1608607833 +1000" + qtftl_i18n_repo = "anki-desktop-ftl" + qtftl_i18n_commit = "e8fa8cb9a9a5eb4d6f9b4c14111aa2c48ac62cc9" + qtftl_i18n_zip_csum = "557b7ae01324e38d23009805c7bef87d32413682a8bb68726df8724fbb9424c7" i18n_build_content = """ filegroup( @@ -147,19 +149,29 @@ exports_files(["l10n.toml"]) """ maybe( - new_git_repository, + http_archive, name = "rslib_ftl", build_file_content = i18n_build_content, - commit = core_i18n_commit, - shallow_since = core_i18n_shallow_since, - remote = "https://github.com/ankitects/anki-core-i18n", + strip_prefix = core_i18n_repo + "-" + core_i18n_commit, + urls = [ + "https://github.com/ankitects/{}/archive/{}.zip".format( + core_i18n_repo, + core_i18n_commit, + ), + ], + sha256 = core_i18n_zip_csum, ) maybe( - new_git_repository, + http_archive, name = "extra_ftl", build_file_content = i18n_build_content, - commit = qtftl_i18n_commit, - shallow_since = qtftl_i18n_shallow_since, - remote = "https://github.com/ankitects/anki-desktop-ftl", + strip_prefix = qtftl_i18n_repo + "-" + qtftl_i18n_commit, + urls = [ + "https://github.com/ankitects/{}/archive/{}.zip".format( + qtftl_i18n_repo, + qtftl_i18n_commit, + ), + ], + sha256 = qtftl_i18n_zip_csum, ) From 355e4cd5195c8421a35ded67a4d6e7d5a18b4075 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 23 Dec 2020 21:51:26 +1000 Subject: [PATCH 047/179] use PYTHON_SYS_EXECUTABLE for setting path to Python --- .bazelrc | 3 ++- docs/linux.md | 2 +- python.bzl | 13 ++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.bazelrc b/.bazelrc index 4f9c63927..8718efc26 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,8 +1,9 @@ common --enable_platform_specific_config common --experimental_repository_cache_hardlinks -# specify python path on Windows for pyo3 compile +# specify python path for pyo3 compile build:windows --action_env="PYTHON_SYS_EXECUTABLE=c:\\python\\python.exe" +#build:linux --action_env="PYTHON_SYS_EXECUTABLE=/usr/local/bin/python3.8" # runfiles are off by default on Windows, and we need them build --enable_runfiles diff --git a/docs/linux.md b/docs/linux.md index d5bfc0178..7729b667b 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -31,7 +31,7 @@ other than /usr/bin, you'll need to put the following into a file called user.ba at the top of this repo before proceeding: ``` -build --action_env=PYTHON_SYS_EXECUTABLE=/usr/local/bin/python +build --action_env=PYTHON_SYS_EXECUTABLE=/usr/local/bin/python3.8 ``` If you're building Anki from a docker container or distro that has no `python` command in diff --git a/python.bzl b/python.bzl index 67b7d72c1..8926cb672 100644 --- a/python.bzl +++ b/python.bzl @@ -8,13 +8,16 @@ def _impl(rctx): "python.exe", ] path = None - for name in names: - path = rctx.which(name) - if path: - break + if rctx.os.environ.get("PYTHON_SYS_EXECUTABLE"): + path = rctx.os.environ.get("PYTHON_SYS_EXECUTABLE") + else: + for name in names: + path = rctx.which(name) + if path: + break if not path: - fail("python3 or python.exe not found on path") + fail("python3 or python.exe not found on path, and PYTHON_SYS_EXECUTABLE not set") rctx.symlink(path, "python") rctx.file("BUILD.bazel", """ From d51def9d6ef9e05f5d64d4254836add64158a896 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Wed, 23 Dec 2020 16:15:46 +0100 Subject: [PATCH 048/179] Making `days` settable does not make sense, as it will be overwritten --- ts/graphs/GraphsPage.svelte | 4 ++-- ts/graphs/bootstrap.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index 588995f1d..48fcf9947 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -12,10 +12,11 @@ export let graphs: any[]; export let search: string; - export let days: number; + export let revlogRange: RevlogRange; export let withRangeBox: boolean; let sourceData: pb.BackendProto.GraphsOut | null = null; + let days; enum SearchRange { Deck = 1, @@ -24,7 +25,6 @@ } let searchRange: SearchRange = SearchRange.Deck; - let revlogRange: RevlogRange = RevlogRange.Year; let refreshing = false; let displayedSearch = search; diff --git a/ts/graphs/bootstrap.ts b/ts/graphs/bootstrap.ts index 86ecc42d6..6d6271e60 100644 --- a/ts/graphs/bootstrap.ts +++ b/ts/graphs/bootstrap.ts @@ -4,6 +4,7 @@ import { setupI18n } from "anki/i18n"; import GraphsPage from "./GraphsPage.svelte"; import { checkNightMode } from "anki/nightmode"; +import { RevlogRange } from "./graph-helpers"; export { default as IntervalsGraph } from "./IntervalsGraph.svelte"; export { default as EaseGraph } from "./EaseGraph.svelte"; @@ -15,12 +16,13 @@ export { default as HourGraph } from "./HourGraph.svelte"; export { default as FutureDue } from "./FutureDue.svelte"; export { default as ReviewsGraph } from "./ReviewsGraph.svelte"; export { default as CalendarGraph } from "./CalendarGraph.svelte"; +export { RevlogRange } from "./graph-helpers"; export function graphs( target: HTMLDivElement, graphs: any[], { search = "deck:current", - days = 31, + revlogRange = RevlogRange.Year, withRangeBox = true, } = {}, ): void { @@ -34,7 +36,7 @@ export function graphs( graphs, nightMode, search, - days, + revlogRange, withRangeBox, }, }); From bd1505bdca9481cd4b9bd031bf62201005b9e533 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Wed, 23 Dec 2020 16:45:00 +0100 Subject: [PATCH 049/179] Turn async function into svelte statement --- ts/graphs/GraphsPage.svelte | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index 48fcf9947..5aea90a1b 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -15,7 +15,7 @@ export let revlogRange: RevlogRange; export let withRangeBox: boolean; - let sourceData: pb.BackendProto.GraphsOut | null = null; + let dataPromise; let days; enum SearchRange { @@ -24,27 +24,24 @@ Custom = 3, } - let searchRange: SearchRange = SearchRange.Deck; - let refreshing = false; - let displayedSearch = search; + let searchRange: SearchRange = SearchRange.Deck; - const refresh = async () => { - refreshing = true; - try { - sourceData = await getGraphData(search, days); - } catch (e) { - sourceData = null; - alert(i18n.tr(i18n.TR.STATISTICS_ERROR_FETCHING)); + let refreshing = true; + + $: { + if (refreshing) { + dataPromise = getGraphData(search, days); + console.log(dataPromise) + refreshing = false; } - refreshing = false; - }; + } $: { // refresh if either of these change search; days; - refresh(); + refreshing = true; } $: { @@ -78,7 +75,7 @@ search = displayedSearch; if (wasSame) { // force a refresh (user may have changed current deck, etc) - refresh(); + refreshing = true; } } }; @@ -92,8 +89,6 @@ {#if withRangeBox}
-
-