-
-
Notifications
You must be signed in to change notification settings - Fork 4
Update for modern Anki versions #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rmunn
wants to merge
10
commits into
sillsdev:master
Choose a base branch
from
rmunn:fix/anki2.1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
40db423
Update for modern Python versions (Anki has 3.13)
rmunn dce64e5
Update for Qt6 changes in PyQt
rmunn d4cd886
Anki now wants a manifest.json file
rmunn b9cef7e
Update CopyFilesToAddons batch file with new files
rmunn 61950e7
Use encoding=utf8 when reading and writing
rmunn cbb9ad0
Add zip-building scripts for Windows and Linux
rmunn 2c22ced
Fix sample cards not being removed on first import
rmunn de841f6
Fix Python warning about invalid syntax
rmunn 2ffe2d2
Exclude __pycache__ folder from addon package
rmunn e8ed756
Update CopyFilesToAddons scripts for Anki 2.1
rmunn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| @ECHO OFF | ||
| REM A Windows 'build' script. | ||
|
|
||
| IF NOT EXIST "C:\Program Files/7-Zip/7z.exe" ( | ||
| ECHO This script uses 7-Zip to build the .zip file, but 7-Zip does not seem to be installed, so the script will fail. | ||
| ECHO The script also assumes that 7-Zip is installed in its default location, C:\Program Files/7-Zip/7z.exe | ||
| ECHO So please do not change the default install location of 7-zip when you install it. | ||
| EXIT /B 1 | ||
| ) | ||
|
|
||
| REM Delete and recreate temporary folder so we don't end up copying old files | ||
| RMDIR /S /Q %TEMP%\FlashGrabBuild | ||
| MKDIR %TEMP%\FlashGrabBuild | ||
|
|
||
| REM Copy files into folder | ||
| xcopy /D /E /Y /exclude:ExcludedFilesWindows.txt xml\*.* %TEMP%\FlashGrabBuild\xml\ | ||
| xcopy /D /E /Y /exclude:ExcludedFilesWindows.txt xpath\*.* %TEMP%\FlashGrabBuild\xpath\ | ||
| REM No /E for syncxml since we don't want to include docsrc or samples directories | ||
| xcopy /D /Y /exclude:ExcludedFilesWindows.txt syncxml\*.* %TEMP%\FlashGrabBuild\syncxml\ | ||
| REM We do want one file from samples, but it should be in a top-level folder in the zip file | ||
| xcopy /D /E /Y /exclude:ExcludedFilesWindows.txt syncxml\samples\lift-dictionary.apkg %TEMP%\FlashGrabBuild\samples\ | ||
| REM The default config also needs to live in the top-level folder | ||
| move %TEMP%\FlashGrabBuild\syncxml\SyncFromXML_config_default.txt %TEMP%\FlashGrabBuild\ | ||
| xcopy /D /Y /exclude:ExcludedFilesWindows.txt __init__.py %TEMP%\FlashGrabBuild\ | ||
| xcopy /D /Y /exclude:ExcludedFilesWindows.txt manifest.json %TEMP%\FlashGrabBuild\ | ||
|
|
||
| PUSHD %TEMP%\FlashGrabBuild | ||
| "C:\Program Files/7-Zip/7z.exe" a FlashGrab.zip syncxml samples xml xpath __init__.py manifest.json SyncFromXML_config_default.txt | ||
| POPD | ||
|
|
||
| MOVE %TEMP%\FlashGrabBuild\FlashGrab.zip . | ||
|
|
||
| ECHO FlashGrab.zip file created! | ||
| DIR FlashGrab.zip | ||
| PAUSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/usr/bin/env bash | ||
| # A Linux build script | ||
|
|
||
| which 7z || ( | ||
| echo 7zip not found. Please install the 7zip package, e.g. sudo apt install 7zip or sudo pacman -S 7zip | ||
| exit 1 | ||
| ) | ||
|
|
||
| # Delete and recreate temporary folder so we don't end up copying old files | ||
| rm -rf /tmp/FlashGrabBuild | ||
| mkdir /tmp/FlashGrabBuild | ||
|
|
||
| # Copy files into folder | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt xml /tmp/FlashGrabBuild | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt xpath /tmp/FlashGrabBuild | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt syncxml /tmp/FlashGrabBuild | ||
|
|
||
| cp -u -v __init__.py /tmp/FlashGrabBuild | ||
| cp -u -v manifest.json /tmp/FlashGrabBuild | ||
|
|
||
| # Some files under syncxml need to live in top-level directory | ||
| mv /tmp/FlashGrabBuild/syncxml/SyncFromXML_config_default.txt /tmp/FlashGrabBuild | ||
| mkdir -p /tmp/FlashGrabBuild/samples | ||
| mv /tmp/FlashGrabBuild/syncxml/samples/lift-dictionary.apkg /tmp/FlashGrabBuild/samples | ||
|
|
||
| # Rest of samples and docsrc from syncxml dir doesn't need to be in the addon, to save file size | ||
| rm -rf /tmp/FlashGrabBuild/syncxml/docsrc | ||
| rm -rf /tmp/FlashGrabBuild/syncxml/samples | ||
|
|
||
| pushd /tmp/FlashGrabBuild | ||
| 7z a FlashGrab.zip syncxml samples xml xpath __init__.py manifest.json SyncFromXML_config_default.txt | ||
| popd | ||
|
|
||
| mv /tmp/FlashGrabBuild/FlashGrab.zip . | ||
| ls -l FlashGrab.zip | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,31 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # To run this script from the terminal command line: ./CopyFilesToAddons.sh | ||
| # A Linux 'build' script. Run this after editing the addon's files. Then restart Anki. | ||
| # A Linux 'build' script. Run this after editing the addon's files. Then restart Anki. | ||
| # Don't make edits over there in addons directly, as VCS won't see them, and an Anki or addon upgrade might destroy them. | ||
|
|
||
| # IMPORTANT: If you change the plugin package in manifest.json, make the same change to PLUGIN_NAME below | ||
| PLUGIN_NAME=FlashGrab | ||
|
|
||
| # Copy recursively (-r) all modified files and folders, except the excluded ones | ||
| # (Like Anki's own deployment, this does NOT remove any files. The simplest way to do so manually here is to delete the addons folder, then re-run.) | ||
|
|
||
| mkdir -p ~/Anki/addons | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt xml ~/Anki/addons/ | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt xpath ~/Anki/addons/ | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt distutils ~/Anki/addons/ | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt syncxml ~/Anki/addons/ | ||
| cp -r -u -v syncx.py ~/Anki/addons/ | ||
| # Use XDG_DATA_HOME if present, otherwise default to ~/.local/share | ||
| DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" | ||
| PLUGIN_HOME="${DATA_HOME}/Anki2/addons21/${PLUGIN_NAME}" | ||
|
|
||
| mkdir -p "${PLUGIN_HOME}" | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt xml "${PLUGIN_HOME}/" | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt xpath "${PLUGIN_HOME}/" | ||
| rsync -r -u -v --exclude-from ExcludedFilesLinux.txt syncxml "${PLUGIN_HOME}/" | ||
| # No -r for syncxml since we don't want to include docsrc or samples directories | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is followed by an apparently incorrect |
||
| # syncxml samples dir should be at the top level of the plugin directory and only contain one file | ||
| mkdir -p "${PLUGIN_HOME}/samples" | ||
| mv "${PLUGIN_HOME}/syncxml/samples/lift-dictionary.apkg" "${PLUGIN_HOME}/samples/" | ||
| # Default config should also be in plugin root | ||
| mv "${PLUGIN_HOME}/syncxml/SyncFromXML_config_default.txt" "${PLUGIN_HOME}/" | ||
| # Rest of samples, as well as docsrc folder, not needed | ||
| rm -rf "${PLUGIN_HOME}/syncxml/samples" | ||
| rm -rf "${PLUGIN_HOME}/syncxml/docsrc" | ||
| cp -u -v __init__.py "${PLUGIN_HOME}/" | ||
| cp -u -v manifest.json "${PLUGIN_HOME}/" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| - *.pyc | ||
| - __pycache__/ | ||
| - local_launch.py | ||
| - syncx_local.py | ||
| - SyncFromXML_config.txt | ||
| - SyncFromXML_log.txt | ||
| - SyncFromXML_configB* | ||
| - SyncFromXML_configB* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| .pyc\ | ||
| \__pycache__\ | ||
| \local_launch.py\ | ||
| \syncx_local.py\ | ||
| \SyncFromXML_config.txt\ | ||
| \SyncFromXML_log.txt\ | ||
| \SyncFromXML_configB | ||
| \SyncFromXML_configB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "package": "FlashGrab", | ||
| "name": "FlashGrab: import LIFT XML from FieldWorks or WeSay" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For maintainability, may need to add a comment to keep BuildZip.bat in sync. and vice-versa