Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "build-aux/flatpak/flatpak-builder-tools"]
path = build-aux/flatpak/flatpak-builder-tools
url = https://github.com/flatpak/flatpak-builder-tools.git
112 changes: 64 additions & 48 deletions build-aux/flatpak/dev.mufeed.Wordbook.Devel.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"sdk": "org.gnome.Sdk",
"command": "wordbook",
"finish-args": [
"--share=network",
"--socket=pulseaudio",
"--share=ipc",
"--device=dri",
Expand Down Expand Up @@ -52,84 +51,77 @@
"name": "python3-modules",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"wn\" \"pydantic\" \"rapidfuzz\" --no-build-isolation"
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"wn\" \"pydantic\" \"rapidfuzz\" \"backports.zstd\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/a1/ee/48ca1a7c89ffec8b6a0c5d02b89c305671d5ffd8d3c94acf8b8c408575bb/anyio-4.9.0-py3-none-any.whl",
"sha256": "9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/84/ae/320161bd181fc06471eed047ecce67b693fd7515b16d495d8932db763426/certifi-2025.6.15-py3-none-any.whl",
"sha256": "2e0c7ce7cb5d8f8634ca55d2ba7e6ec2689a2fd6537d8dec1296a477a4910057"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl",
"sha256": "63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"
"type": "file",
"url": "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl",
"sha256": "1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl",
"sha256": "2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"
"type": "file",
"url": "https://files.pythonhosted.org/packages/7f/9c/36c5c37947ebfb8c7f22e0eb6e4d188ee2d53aa3880f3f2744fb894f0cb1/anyio-4.12.0-py3-none-any.whl",
"sha256": "dad2376a628f98eeca4881fc56cd06affd18f659b17a747d3ff0307ced94b1bb"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl",
"sha256": "d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"
"type": "file",
"url": "https://files.pythonhosted.org/packages/44/08/bda420a2d13be0d6aa8323b735207de46bb01c08575e3a6810e01a20501f/backports_zstd-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl",
"sha256": "9478c04e285da26ce1198d5ec1e43905531049c9e0f74169a39df5876f44643e",
"only-arches": ["aarch64"]
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl",
"sha256": "946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"
"type": "file",
"url": "https://files.pythonhosted.org/packages/2c/74/a7ae8e421ccb779130d64745d3191daf6da02f37bf7cf099dc10d688d14e/backports_zstd-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl",
"sha256": "4e7340a7fb7bac7607382554b138ae8dbffda0b8af72ce5c639fb86b49a3b2e4",
"only-arches": ["x86_64"]
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl",
"sha256": "2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"
"type": "file",
"url": "https://files.pythonhosted.org/packages/70/7d/9bc192684cea499815ff478dfcdc13835ddf401365057044fb721ec6bddb/certifi-2025.11.12-py3-none-any.whl",
"sha256": "97de8790030bbd5c2d96b7ec782fc2f7820ef8dba6db909ccf95449f2d062d4b"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/6e/c2/61d3e0f47e2b74ef40a68b9e6ad5984f6241a942f7cd3bbfbdbd03861ea9/tomli-2.2.1-py3-none-any.whl",
"sha256": "cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"
"type": "file",
"url": "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl",
"sha256": "63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/65/a8/d6cc78f0cb30434207be11f09e0b2f1271eac6acac935807a0d23896b9d5/wn-0.13.0-py3-none-any.whl",
"sha256": "ee1f2574078b592faa44ee254d4d8115ec951036800537f8915f201cb4d02541"
"type": "file",
"url": "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl",
"sha256": "2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl",
"sha256": "1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"
"url": "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl",
"sha256": "d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/69/e0/552843e0d356fbb5256d21449fa957fa4eff3bbc135a74a691ee70c7c5da/typing_extensions-4.14.0-py3-none-any.whl",
"sha256": "a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af"
"url": "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl",
"sha256": "771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/17/69/cd203477f944c353c31bade965f880aa1061fd6bf05ded0726ca845b6ff7/typing_inspection-0.4.1-py3-none-any.whl",
"sha256": "389055682238f53b04f7badcb49b989835495a96700ced5dab2d8feae4b26f51"
"url": "https://files.pythonhosted.org/packages/5a/87/b70ad306ebb6f9b585f114d0ac2137d792b48be34d732d60e597c2f8465a/pydantic-2.12.5-py3-none-any.whl",
"sha256": "e561593fccf61e8a20fc46dfc2dfe075b8be7d0188df33f221ad1f0139180f9d"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/6a/c0/ec2b1c8712ca690e5d61979dee872603e92b8a32f94cc1b72d53beab008a/pydantic-2.11.7-py3-none-any.whl",
"sha256": "dde5df002701f6de26248661f6835bbe296a47bf73990135c7d07ce741b9623b"
"url": "https://files.pythonhosted.org/packages/15/df/a4c740c0943e93e6500f9eb23f4ca7ec9bf71b19e608ae5b579678c8d02f/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"sha256": "0cbaad15cb0c90aa221d43c00e77bb33c93e8d36e0bf74760cd00e732d10a6a0",
"only-arches": ["aarch64"]
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/eb/3c/f4abd740877a35abade05e437245b192f9d0ffb48bbbbd708df33d3cda37/pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"sha256": "9fdac5d6ffa1b5a83bca06ffe7583f5576555e6c8b3a91fbd25ea7780f825f7d",
"url": "https://files.pythonhosted.org/packages/cf/4e/35a80cae583a37cf15604b44240e45c05e04e86f9cfd766623149297e971/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"sha256": "406bf18d345822d6c21366031003612b9c77b3e29ffdb0f612367352aab7d586",
"only-arches": ["x86_64"]
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/6f/5e/a0a7b8885c98889a18b6e376f344da1ef323d270b44edf8174d6bce4d622/pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"sha256": "0a9f2c9dd19656823cb8250b0724ee9c60a82f3cdf68a080979d13092a3b0fef",
"url": "https://files.pythonhosted.org/packages/59/cf/c3ac8c80d8ced6c1f99b5d9674d397ce5d0e9d0939d788d67c010e19c65f/rapidfuzz-3.13.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"sha256": "0da54aa8547b3c2c188db3d1c7eb4d1bb6dd80baa8cdaeaec3d1da3346ec9caa",
"only-arches": ["aarch64"]
},
{
Expand All @@ -140,9 +132,33 @@
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/59/cf/c3ac8c80d8ced6c1f99b5d9674d397ce5d0e9d0939d788d67c010e19c65f/rapidfuzz-3.13.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"sha256": "0da54aa8547b3c2c188db3d1c7eb4d1bb6dd80baa8cdaeaec3d1da3346ec9caa",
"only-arches": ["aarch64"]
"url": "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl",
"sha256": "f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl",
"sha256": "4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/25/0e/0655e4f0d8ffdf8216c17a7278eaad04a1a3fa7a0545ca293d5cf5ce4f0c/wn-0.14.0-py3-none-any.whl",
"sha256": "535dd9731f24c8cea8ec661744ac7575d05a5607258f5fcc56d1b18bf3164b7f"
}
]
},
{
"name": "wordnet-database",
"buildsystem": "simple",
"build-commands": [
"install -Dm644 wn-oewn-2024.db.zst /app/share/wordbook/wn-oewn-2024.db.zst"
],
"sources": [
{
"type": "file",
"url": "https://github.com/mufeedali/Wordbook/releases/download/0.6.0/wn.db.zst",
"sha256": "2b0a58348621016652e70985baf6de992875162e0f5d3ffe62e9c26185a28d68",
"dest-filename": "wn-oewn-2024.db.zst"
}
]
},
Expand Down
1 change: 0 additions & 1 deletion build-aux/flatpak/flatpak-builder-tools
Submodule flatpak-builder-tools deleted from ebf116
117 changes: 117 additions & 0 deletions build-aux/flatpak/flatpak-wheel-gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/usr/bin/env python3

import hashlib
import json
import subprocess
import sys
import tempfile
import urllib.request
from pathlib import Path

PACKAGES = ["wn", "pydantic", "rapidfuzz", "backports.zstd"]
PYTHON_VERSION = "3.13"
ABI = "cp313"
ARCHES = {
"x86_64": "manylinux_2_17_x86_64",
"aarch64": "manylinux_2_17_aarch64",
}


def get_sha256(filepath):
with open(filepath, "rb") as f:
return hashlib.sha256(f.read()).hexdigest()


def find_pypi_url(filename):
guess_name = filename.split("-")[0]
candidates = {guess_name, guess_name.replace("_", "-"), guess_name.replace(".", "-")}

for name in candidates:
try:
url = f"https://pypi.org/pypi/{name}/json"
with urllib.request.urlopen(url) as r:
data = json.load(r)

for version in data.get("releases", {}).values():
for file_info in version:
if file_info["filename"] == filename:
return file_info["url"]
except Exception:
continue

return None


def download_wheels(temp_dir, arch, platform_tag):
print(f"--> Resolving and downloading for {arch} ({platform_tag})...", file=sys.stderr)
dest = Path(temp_dir) / arch
dest.mkdir()

cmd = [
sys.executable,
"-m",
"pip",
"download",
"--dest",
str(dest),
"--only-binary=:all:",
"--python-version",
PYTHON_VERSION,
"--implementation",
"cp",
"--abi",
ABI,
"--platform",
platform_tag,
] + PACKAGES

try:
subprocess.run(cmd, check=True, capture_output=True)
except subprocess.CalledProcessError as e:
print(f"Error downloading for {arch}:", file=sys.stderr)
print(e.stderr.decode(), file=sys.stderr)
sys.exit(1)

return {f.name: f for f in dest.glob("*.whl")}


def generate_sources():
with tempfile.TemporaryDirectory() as temp_dir:
results = {}
for arch, tag in ARCHES.items():
results[arch] = download_wheels(temp_dir, arch, tag)

all_filenames = set()
for arch in ARCHES:
all_filenames.update(results[arch].keys())

sources = []
for filename in sorted(all_filenames):
arches_with_file = [arch for arch in ARCHES if filename in results[arch]]
if not arches_with_file:
continue

first_arch = arches_with_file[0]
filepath = results[first_arch][filename]
sha256 = get_sha256(filepath)
url = find_pypi_url(filename)
if url is None:
print(f"Warning: Could not find PyPI URL for {filename}", file=sys.stderr)
url = f"FIXME_COULD_NOT_FIND_URL_FOR_{filename}"

source = {
"type": "file",
"url": url,
"sha256": sha256,
}

if len(arches_with_file) < len(ARCHES):
source["only-arches"] = arches_with_file

sources.append(source)

print(json.dumps(sources, indent=4))


if __name__ == "__main__":
generate_sources()
50 changes: 10 additions & 40 deletions data/resources/ui/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,6 @@ template $WordbookWindow: Adw.ApplicationWindow {
tightening-threshold: 500;

Adw.ViewStack main_stack {
Adw.ViewStackPage {
name: "download_page";

child: Adw.StatusPage download_status_page {
title: _("Setting things up…");
description: _("Downloading WordNet…");

child: Adw.Clamp {
tightening-threshold: 200;

ProgressBar loading_progress {
ellipsize: end;
}
};
};
}

Adw.ViewStackPage {
name: "welcome_page";

Expand Down Expand Up @@ -309,32 +292,19 @@ template $WordbookWindow: Adw.ApplicationWindow {
}

Adw.ViewStackPage {
name: "network_fail_page";

child: Adw.StatusPage network_fail_status_page {
icon-name: "network-error-symbolic";
title: _("Download failed");
name: "db_error_page";

child: Box {
spacing: 12;
halign: center;
child: Adw.StatusPage db_error_status_page {
icon-name: "dialog-error-symbolic";
title: _("Database not found");
description: _("Installation is incomplete. Please reinstall Wordbook.");

Button retry_button {
label: _("Retry");
child: Button exit_button {
label: _("Exit");

styles [
"pill",
"suggested-action",
]
}

Button exit_button {
label: _("Exit");

styles [
"pill",
]
}
styles [
"pill",
]
};
};
}
Expand Down
2 changes: 1 addition & 1 deletion data/search_provider.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ localedir = "@localedir@"
from wordbook import base, utils
import wn

wn.config.data_directory = os.path.join(utils.WN_DIR)
wn.config.data_directory = base.WN_DIR
wn.config.allow_multithreading = True

dbus_interface_description = """
Expand Down
Loading
Loading