mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
tweaks for Windows package
- move audio tools into subfolder - add buildmanifest.py
This commit is contained in:
parent
dc56b43c32
commit
ba86502a27
2 changed files with 34 additions and 10 deletions
|
@ -234,16 +234,14 @@ def _packagedCmd(cmd: list[str]) -> tuple[Any, dict[str, str]]:
|
|||
env = os.environ.copy()
|
||||
if "LD_LIBRARY_PATH" in env:
|
||||
del env["LD_LIBRARY_PATH"]
|
||||
if isMac:
|
||||
path = Path(sys.prefix).joinpath("audio").joinpath(cmd[0])
|
||||
if path.exists():
|
||||
cmd[0] = str(path)
|
||||
return cmd, env
|
||||
adjusted_path = os.path.join(sys.prefix, cmd[0])
|
||||
if isWin and not adjusted_path.endswith(".exe"):
|
||||
adjusted_path += ".exe"
|
||||
if os.path.exists(adjusted_path):
|
||||
cmd[0] = adjusted_path
|
||||
|
||||
packaged_path = (
|
||||
Path(sys.prefix).joinpath("audio").joinpath(cmd[0] + ".exe" if isWin else "")
|
||||
)
|
||||
if packaged_path.exists():
|
||||
cmd[0] = str(packaged_path)
|
||||
return cmd, env
|
||||
|
||||
return cmd, env
|
||||
|
||||
|
||||
|
|
26
qt/package/buildmanifest.py
Normal file
26
qt/package/buildmanifest.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Copyright: Ankitects Pty Ltd and contributors
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def build_manifest(top: Path) -> None:
|
||||
manifest = []
|
||||
for root, dirnames, fnames in os.walk(top, topdown=True):
|
||||
relroot = root[len(str(top)) + 1 :]
|
||||
# if not top level, add folder
|
||||
if relroot:
|
||||
manifest.append(relroot)
|
||||
# then the files
|
||||
for fname in fnames:
|
||||
path = os.path.join(relroot, fname)
|
||||
manifest.append(path)
|
||||
|
||||
with open(top / "anki.install-manifest", "w") as file:
|
||||
file.write("\n".join(manifest) + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
build_manifest(Path(sys.argv[1]))
|
Loading…
Reference in a new issue