push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
diff --git a/aab/builder.py b/aab/builder.py
index 5c3805c..7dfe595 100644
--- a/aab/builder.py
+++ b/aab/builder.py
@@ -77,7 +77,7 @@ class AddonBuilder:
self._config = Config()
self._path_dist_module = PATH_DIST / "src" / self._config["module_name"]
- def build(self, qt_versions: List[QtVersion], disttype="local", pyenv=None):
+ def build(self, qt_versions: List[QtVersion], disttype="local", pyenv=None, modtime=None):
logging.info(
"\n--- Building %s %s for %s ---\n",
self._config["display_name"],
@@ -86,7 +86,7 @@ class AddonBuilder:
)
self.create_dist()
- self.build_dist(qt_versions=qt_versions, disttype=disttype, pyenv=pyenv)
+ self.build_dist(qt_versions=qt_versions, disttype=disttype, pyenv=pyenv, modtime=modtime)
return self.package_dist(qt_versions=qt_versions, disttype=disttype)
@@ -102,7 +102,7 @@ class AddonBuilder:
PATH_DIST.mkdir(parents=True)
Git().archive(self._version, PATH_DIST)
- def build_dist(self, qt_versions: List[QtVersion], disttype="local", pyenv=None):
+ def build_dist(self, qt_versions: List[QtVersion], disttype="local", pyenv=None, modtime=None):
self._copy_licenses()
if self._path_changelog.exists():
self._copy_changelog()
@@ -111,7 +111,7 @@ class AddonBuilder:
if self._callback_archive:
self._callback_archive()
- self._write_manifest(disttype)
+ self._write_manifest(disttype, modtime=modtime)
ui_builder = UIBuilder(dist=PATH_DIST, config=self._config)
@@ -162,12 +162,13 @@ class AddonBuilder:
return out_path
- def _write_manifest(self, disttype):
+ def _write_manifest(self, disttype, modtime=None):
ManifestUtils.generate_and_write_manifest(
addon_properties=self._config,
version=self._version,
dist_type=disttype,
target_dir=self._path_dist_module,
+ modtime=modtime,
)
def _copy_licenses(self):
diff --git a/aab/cli.py b/aab/cli.py
index 2ce6425..0956e98 100644
--- a/aab/cli.py
+++ b/aab/cli.py
@@ -89,7 +89,7 @@ def build(args):
total = len(dists)
for dist in dists:
logging.info("\n=== Build task %s/%s ===", cnt, total)
- builder.build(qt_versions=qt_versions, disttype=dist)
+ builder.build(qt_versions=qt_versions, disttype=dist, modtime=args.modtime)
cnt += 1
@@ -146,7 +146,7 @@ def build_dist(args):
total = len(dists)
for dist in dists:
logging.info("\n=== Build task %s/%s ===", cnt, total)
- builder.build_dist(qt_versions=qt_versions, disttype=dist)
+ builder.build_dist(qt_versions=qt_versions, disttype=dist, modtime=args.modtime)
cnt += 1
@@ -204,6 +204,12 @@ def construct_parser():
default="local",
choices=["local", "ankiweb", "all"],
)
+ dist_parent.add_argument(
+ "--modtime",
+ help="Last modified timestamp",
+ type=int,
+ required=False,
+ )
build_parent = argparse.ArgumentParser(add_help=False)
build_parent.add_argument(
diff --git a/aab/manifest.py b/aab/manifest.py
index fc0038d..355e370 100644
--- a/aab/manifest.py
+++ b/aab/manifest.py
@@ -49,10 +49,11 @@ class ManifestUtils:
version: str,
dist_type: DistType,
target_dir: Path,
+ modtime=None,
):
logging.info("Writing manifest...")
manifest = cls.generate_manifest_from_properties(
- addon_properties=addon_properties, version=version, dist_type=dist_type
+ addon_properties=addon_properties, version=version, dist_type=dist_type, modtime=modtime
)
cls.write_manifest(manifest=manifest, target_dir=target_dir)
@@ -62,6 +63,7 @@ class ManifestUtils:
addon_properties: Config,
version: str,
dist_type: DistType,
+ modtime=None,
) -> Dict[str, Any]:
manifest = {
"name": addon_properties["display_name"],
@@ -71,7 +73,7 @@ class ManifestUtils:
"version": version,
"homepage": addon_properties.get("homepage", ""),
"conflicts": deepcopy(addon_properties["conflicts"]),
- "mod": Git().modtime(version),
+ "mod": modtime if modtime is not None else Git().modtime(version),
}
# Add version specifiers:

View File

@@ -0,0 +1,75 @@
diff --git a/tests/test_legacy.py b/tests/test_legacy.py
index 33790b9..0577262 100644
--- a/tests/test_legacy.py
+++ b/tests/test_legacy.py
@@ -101,8 +101,8 @@ gui/
sample-project/
icons/
coffee.svg
- heart.svg
email.svg
+ heart.svg
help.svg\
"""
diff --git a/tests/test_ui.py b/tests/test_ui.py
index 0774672..3764fda 100644
--- a/tests/test_ui.py
+++ b/tests/test_ui.py
@@ -60,22 +60,22 @@ def test_ui_builder(tmp_path: Path):
expected_file_structure = """\
gui/
+ forms/
+ __init__.py
+ qt5/
+ __init__.py
+ dialog.py
+ qt6/
+ __init__.py
+ dialog.py
resources/
__init__.py
sample-project/
icons/
coffee.svg
- heart.svg
email.svg
- help.svg
- forms/
- __init__.py
- qt6/
- __init__.py
- dialog.py
- qt5/
- __init__.py
- dialog.py\
+ heart.svg
+ help.svg\
"""
config = Config(test_project_root / "addon.json")
@@ -136,8 +136,8 @@ gui/
sample-project/
icons/
coffee.svg
- heart.svg
email.svg
+ heart.svg
help.svg\
"""
diff --git a/tests/util.py b/tests/util.py
index a682bcd..a4aa7de 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -40,6 +40,9 @@ def list_files(startpath: Path):
ret = []
for root, dirs, files in os.walk(path):
+ dirs.sort()
+ files.sort()
+
level = root.replace(path, "").count(os.sep)
indent = " " * 4 * (level)
ret.append("{}{}/".format(indent, os.path.basename(root)))

View File

@@ -0,0 +1,14 @@
diff --git a/aab/builder.py b/aab/builder.py
index 5c3805c..a181b27 100644
--- a/aab/builder.py
+++ b/aab/builder.py
@@ -67,8 +67,7 @@ class AddonBuilder:
self._version = Git().parse_version(version)
# git stash create comes up empty when no changes were made since the
# last commit. Don't use 'dev' as version in these cases.
- git_status = call_shell("git status --porcelain")
- if self._version == "dev" and git_status == "":
+ if self._version == "dev" and call_shell("git status --porcelain") == "":
self._version = Git().parse_version("current")
if not self._version:
logging.error("Error: Version could not be determined through Git")

View File

@@ -0,0 +1,48 @@
{
lib,
fetchFromGitHub,
python3,
}:
python3.pkgs.buildPythonApplication rec {
pname = "aab";
version = "1.0.0-dev.5";
pyproject = true;
src = fetchFromGitHub {
owner = "glutanimate";
repo = "anki-addon-builder";
tag = "v${version}";
hash = "sha256-92Xqxgb9MLhSIa5EN3Rdk4aJlRfzEWqKmXFe604Q354=";
};
patches = [
./fix-flaky-tests.patch
./only-call-git-when-necessary.patch
./allow-manually-setting-modtime.patch
];
build-system = [ python3.pkgs.poetry-core ];
dependencies = with python3.pkgs; [
jsonschema
whichcraft
pyqt5
pyqt6
];
nativeCheckInputs = [
python3.pkgs.pytestCheckHook
python3.pkgs.pyqt5
python3.pkgs.pyqt6
];
pythonImportsCheck = [ "aab" ];
meta = {
description = "Build tool for Anki add-ons";
homepage = "https://github.com/glutanimate/anki-addon-builder";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ eljamm ];
};
}