txa 1.4.0__tar.gz → 1.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {txa-1.4.0 → txa-1.4.2}/PKG-INFO +1 -1
  2. {txa-1.4.0 → txa-1.4.2}/src/txa/__init__.py +1 -1
  3. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/steps.py +10 -2
  4. {txa-1.4.0 → txa-1.4.2}/src/txa/cli.py +2 -1
  5. {txa-1.4.0 → txa-1.4.2}/src/txa/core/i18n.py +16 -0
  6. txa-1.4.2/src/txa/core/updatecheck.py +115 -0
  7. {txa-1.4.0 → txa-1.4.2}/src/txa/create/cli.py +2 -1
  8. {txa-1.4.0 → txa-1.4.2}/src/txa/create/winget.py +39 -7
  9. {txa-1.4.0 → txa-1.4.2}/src/txa/pm/cli.py +2 -1
  10. {txa-1.4.0 → txa-1.4.2}/src/txa.egg-info/PKG-INFO +1 -1
  11. {txa-1.4.0 → txa-1.4.2}/src/txa.egg-info/SOURCES.txt +1 -0
  12. {txa-1.4.0 → txa-1.4.2}/README.md +0 -0
  13. {txa-1.4.0 → txa-1.4.2}/pyproject.toml +0 -0
  14. {txa-1.4.0 → txa-1.4.2}/setup.cfg +0 -0
  15. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/__init__.py +0 -0
  16. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/agreement.py +0 -0
  17. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/api.py +0 -0
  18. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/checks.py +0 -0
  19. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/cli.py +0 -0
  20. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/context.py +0 -0
  21. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/gate.py +0 -0
  22. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/pending.py +0 -0
  23. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/progress.py +0 -0
  24. {txa-1.4.0 → txa-1.4.2}/src/txa/ci/report.py +0 -0
  25. {txa-1.4.0 → txa-1.4.2}/src/txa/constants.py +0 -0
  26. {txa-1.4.0 → txa-1.4.2}/src/txa/core/__init__.py +0 -0
  27. {txa-1.4.0 → txa-1.4.2}/src/txa/core/config.py +0 -0
  28. {txa-1.4.0 → txa-1.4.2}/src/txa/core/console.py +0 -0
  29. {txa-1.4.0 → txa-1.4.2}/src/txa/core/credentials.py +0 -0
  30. {txa-1.4.0 → txa-1.4.2}/src/txa/core/engines.py +0 -0
  31. {txa-1.4.0 → txa-1.4.2}/src/txa/core/github.py +0 -0
  32. {txa-1.4.0 → txa-1.4.2}/src/txa/core/licenses.py +0 -0
  33. {txa-1.4.0 → txa-1.4.2}/src/txa/core/manifest.py +0 -0
  34. {txa-1.4.0 → txa-1.4.2}/src/txa/core/net.py +0 -0
  35. {txa-1.4.0 → txa-1.4.2}/src/txa/core/pe.py +0 -0
  36. {txa-1.4.0 → txa-1.4.2}/src/txa/core/portable.py +0 -0
  37. {txa-1.4.0 → txa-1.4.2}/src/txa/core/retention.py +0 -0
  38. {txa-1.4.0 → txa-1.4.2}/src/txa/core/semver.py +0 -0
  39. {txa-1.4.0 → txa-1.4.2}/src/txa/core/signing.py +0 -0
  40. {txa-1.4.0 → txa-1.4.2}/src/txa/core/userpath.py +0 -0
  41. {txa-1.4.0 → txa-1.4.2}/src/txa/core/winos.py +0 -0
  42. {txa-1.4.0 → txa-1.4.2}/src/txa/create/__init__.py +0 -0
  43. {txa-1.4.0 → txa-1.4.2}/src/txa/create/draft.py +0 -0
  44. {txa-1.4.0 → txa-1.4.2}/src/txa/create/ghmeta.py +0 -0
  45. {txa-1.4.0 → txa-1.4.2}/src/txa/create/submit.py +0 -0
  46. {txa-1.4.0 → txa-1.4.2}/src/txa/create/wizard.py +0 -0
  47. {txa-1.4.0 → txa-1.4.2}/src/txa/pm/__init__.py +0 -0
  48. {txa-1.4.0 → txa-1.4.2}/src/txa/pm/installer.py +0 -0
  49. {txa-1.4.0 → txa-1.4.2}/src/txa/pm/source.py +0 -0
  50. {txa-1.4.0 → txa-1.4.2}/src/txa/pm/uninstall.py +0 -0
  51. {txa-1.4.0 → txa-1.4.2}/src/txa/schemas/about.schema.json +0 -0
  52. {txa-1.4.0 → txa-1.4.2}/src/txa/schemas/build.schema.json +0 -0
  53. {txa-1.4.0 → txa-1.4.2}/src/txa/schemas/core.schema.json +0 -0
  54. {txa-1.4.0 → txa-1.4.2}/src/txa.egg-info/dependency_links.txt +0 -0
  55. {txa-1.4.0 → txa-1.4.2}/src/txa.egg-info/entry_points.txt +0 -0
  56. {txa-1.4.0 → txa-1.4.2}/src/txa.egg-info/requires.txt +0 -0
  57. {txa-1.4.0 → txa-1.4.2}/src/txa.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txa
3
- Version: 1.4.0
3
+ Version: 1.4.2
4
4
  Summary: TXA package manager toolchain: txapm (install), txacreate (publish), txaci (16-step validator), txacli (WinGet & repo CLI)
5
5
  Author: TXA Software Dev
6
6
  License: MIT
@@ -1,3 +1,3 @@
1
1
  """TXA package manager toolchain."""
2
2
 
3
- __version__ = "1.4.0"
3
+ __version__ = "1.4.2"
@@ -9,7 +9,7 @@ from pathlib import Path
9
9
  from typing import Callable
10
10
 
11
11
  from txa.ci.context import Context
12
- from txa.core import engines, net, pe, portable, semver, signing, winos
12
+ from txa.core import engines, net, pe, portable, retention, semver, signing, winos
13
13
  from txa.core.licenses import NEEDS_URL, SPDX
14
14
  from txa.core.manifest import (
15
15
  ABOUT_RE, BUILD_FILE, CORE_FILE, ID_RE, LANG_RE, ManifestError, about_file, kind_of, parse_card, ref_of,
@@ -354,7 +354,15 @@ def versioning(ctx: Context, target: dict, out: Outcome) -> None:
354
354
  elif not newest:
355
355
  out.ok(f"first release {version}")
356
356
  elif semver.parse(version) <= semver.parse(newest):
357
- out.fail(f"{version} must be greater than the newest published version {newest}")
357
+ others = [v for v in existing if v != version]
358
+ newer = sum(1 for v in others if semver.parse(v) > semver.parse(version))
359
+ if version in existing and ctx.mode == "ci":
360
+ out.fail(f"{version} is already published - edit it as an update or pick a new version")
361
+ elif newer < retention.KEEP:
362
+ # the repository keeps the newest KEEP versions, so an older release that still fits is fine
363
+ out.ok(f"older release {version} (newest is {newest}; {newer} newer version(s), the newest {retention.KEEP} are kept)")
364
+ else:
365
+ out.fail(f"{version} is older than the {retention.KEEP} newest versions (newest {newest}) and would be dropped at once")
358
366
  else:
359
367
  old, new = semver.parse(newest), semver.parse(version)
360
368
  bump = "major" if new[0] > old[0] else "minor" if new[1] > old[1] else "patch"
@@ -18,7 +18,7 @@ import sys
18
18
  from pathlib import Path
19
19
 
20
20
  from txa import __version__
21
- from txa.core import config, console
21
+ from txa.core import config, console, updatecheck
22
22
  from txa.core.manifest import find_repo_root
23
23
  from txa.create import winget as wg
24
24
 
@@ -165,6 +165,7 @@ def do_import(args) -> int:
165
165
 
166
166
  def main(argv: list[str] | None = None) -> int:
167
167
  console.setup()
168
+ updatecheck.register()
168
169
  args_list = list(sys.argv[1:] if argv is None else argv)
169
170
 
170
171
  # Support explicit subcommands cleanly while keeping flag-based invocation 100% compatible
@@ -565,6 +565,22 @@ _SUMMARIES_VI: dict[str, str] = {
565
565
  "vlc": "Trình phát đa phương tiện mã nguồn mở miễn phí, chơi được hầu hết mọi định dạng video và âm thanh.",
566
566
  "warframe": "Tựa game bắn súng hành động góc nhìn thứ ba khoa học viễn tưởng miễn phí (Free-to-Play).",
567
567
  "winscp": "Trình quản lý và truyền tải file qua giao thức SFTP, FTP, WebDAV, S3 và SCP trên Windows.",
568
+ "dockerdesktop": "Xây dựng, chạy và chia sẻ ứng dụng container (Docker) ngay trên Windows.",
569
+ "cmake": "Bộ công cụ mã nguồn mở đa nền tảng để biên dịch, kiểm thử và đóng gói phần mềm.",
570
+ "go": "Ngôn ngữ lập trình Go của Google: đơn giản, nhanh, xây phần mềm đáng tin cậy.",
571
+ "neovim": "Trình soạn thảo văn bản dựa trên Vim, dễ mở rộng và dễ dùng hơn.",
572
+ "jetbrainstoolbox": "Cài đặt, cập nhật và mở mọi IDE của JetBrains từ một nơi.",
573
+ "dbeaver": "Công cụ quản lý nhiều loại cơ sở dữ liệu, miễn phí, dành cho lập trình viên và DBA.",
574
+ "wireshark": "Phần mềm phân tích giao thức mạng phổ biến nhất thế giới.",
575
+ "bitwarden": "Trình quản lý mật khẩu an toàn, miễn phí cho mọi thiết bị.",
576
+ "keepassxc": "Trình quản lý mật khẩu hiện đại, mã nguồn mở, lưu hoàn toàn trên máy bạn.",
577
+ "qbittorrent": "Trình tải torrent mã nguồn mở, miễn phí và không quảng cáo.",
578
+ "sumatrapdf": "Trình đọc PDF, ePub, Mobi, truyện tranh... nhỏ gọn và rất nhanh.",
579
+ "handbrake": "Phần mềm chuyển đổi video mã nguồn mở, xuất ra định dạng phát được trên mọi thiết bị.",
580
+ "zoom": "Ứng dụng họp video, nhắn tin và gọi điện Zoom Workplace cho máy tính.",
581
+ "inkscape": "Phần mềm thiết kế đồ hoạ vector mã nguồn mở, miễn phí.",
582
+ "blender": "Bộ phần mềm dựng hình 3D mã nguồn mở: mô hình hoá, hoạt hình, kết xuất.",
583
+ "windirstat": "Xem dung lượng ổ đĩa dưới dạng sơ đồ và dọn dẹp: biết cái gì đang chiếm chỗ.",
568
584
  }
569
585
 
570
586
  _SUMMARIES_EN: dict[str, str] = {
@@ -0,0 +1,115 @@
1
+ """Tell the user, once in a while, that a newer txapm / txacreate / txacli exists - and how to get it.
2
+
3
+ The notice goes to stderr after the command finished, only in an interactive terminal, at most one
4
+ network lookup every 6 hours (cached), and a slow or offline network never delays or breaks a command.
5
+ Disable with TXA_NO_UPDATE_CHECK=1.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import atexit
10
+ import json
11
+ import os
12
+ import sys
13
+ import time
14
+ from pathlib import Path
15
+
16
+ import requests
17
+
18
+ from txa import __version__
19
+ from txa.core import config, semver
20
+
21
+ CACHE_SECONDS = 6 * 3600
22
+ TIMEOUT = 2.0
23
+ INSTALL_PS1 = "irm https://raw.githubusercontent.com/TXAVL/txa-repo/main/install.ps1 | iex"
24
+ _registered = False
25
+
26
+
27
+ def install_method() -> str:
28
+ """How this copy of TXA was installed: "powershell" (the .exe from install.ps1), "pipx" or "pip"."""
29
+ if getattr(sys, "frozen", False):
30
+ return "powershell"
31
+ prefix = str(Path(sys.prefix)).lower().replace("\\", "/")
32
+ home = os.environ.get("PIPX_HOME", "").lower().replace("\\", "/")
33
+ if "/pipx/" in prefix or (home and prefix.startswith(home)):
34
+ return "pipx"
35
+ return "pip"
36
+
37
+
38
+ def update_command(method: str | None = None) -> str:
39
+ return {"powershell": INSTALL_PS1, "pipx": "pipx upgrade txa"}.get(method or install_method(), "python -m pip install --upgrade txa")
40
+
41
+
42
+ def _cache_file() -> Path:
43
+ return config.txa_home() / "state" / "update-check.json"
44
+
45
+
46
+ def _read_cache() -> dict:
47
+ try:
48
+ return json.loads(_cache_file().read_text("utf-8"))
49
+ except (OSError, ValueError):
50
+ return {}
51
+
52
+
53
+ def _write_cache(data: dict) -> None:
54
+ try:
55
+ path = _cache_file()
56
+ path.parent.mkdir(parents=True, exist_ok=True)
57
+ path.write_text(json.dumps(data), "utf-8")
58
+ except OSError:
59
+ pass
60
+
61
+
62
+ def _lookup(method: str) -> str | None:
63
+ """Newest published version: the GitHub release for the .exe install, PyPI for pip/pipx."""
64
+ headers = {"User-Agent": f"txa/{__version__}", "Accept": "application/json", "Accept-Encoding": "identity"}
65
+ try:
66
+ if method == "powershell":
67
+ data = requests.get(f"https://api.github.com/repos/{config.get('upstream')}/releases/latest", headers=headers, timeout=TIMEOUT).json()
68
+ return str(data.get("tag_name", "")).lstrip("v") or None
69
+ return requests.get("https://pypi.org/pypi/txa/json", headers=headers, timeout=TIMEOUT).json()["info"]["version"]
70
+ except (requests.RequestException, ValueError, KeyError):
71
+ return None
72
+
73
+
74
+ def newer_version(now: float | None = None, lookup=_lookup) -> str | None:
75
+ """The newer version to announce, or None (up to date, offline, or checked recently without news)."""
76
+ method = install_method()
77
+ cache = _read_cache()
78
+ now = time.time() if now is None else now
79
+ latest = cache.get("latest")
80
+ if not latest or now - float(cache.get("checked", 0)) > CACHE_SECONDS or cache.get("method") != method:
81
+ latest = lookup(method) or latest
82
+ _write_cache({"checked": now, "latest": latest, "method": method})
83
+ if latest and semver.is_valid(latest) and semver.is_valid(__version__) and semver.parse(latest) > semver.parse(__version__):
84
+ return latest
85
+ return None
86
+
87
+
88
+ def message(latest: str, method: str | None = None) -> str:
89
+ from txa.core import winos
90
+
91
+ command = update_command(method)
92
+ if winos.ui_language() == "vi":
93
+ return f"! Có bản TXA mới {latest} (đang dùng {__version__}). Cập nhật bằng lệnh: {command}"
94
+ return f"! A new TXA version {latest} is available (you have {__version__}). Update with: {command}"
95
+
96
+
97
+ def notify() -> None:
98
+ if os.environ.get("TXA_NO_UPDATE_CHECK") or os.environ.get("CI") or not (sys.stderr.isatty() and sys.stdin.isatty()):
99
+ return
100
+ try:
101
+ latest = newer_version()
102
+ if latest:
103
+ from txa.core import console
104
+
105
+ print(console.paint(message(latest), "yellow"), file=sys.stderr)
106
+ except Exception: # noqa: BLE001 - never let the courtesy notice break a command
107
+ pass
108
+
109
+
110
+ def register() -> None:
111
+ """Call once at the start of an entry point: the notice is printed when the process exits."""
112
+ global _registered
113
+ if not _registered:
114
+ _registered = True
115
+ atexit.register(notify)
@@ -21,7 +21,7 @@ from txa import __version__
21
21
  from txa.ci import steps
22
22
  from txa.ci.context import init_local
23
23
  from txa.ci.report import build_report, quick_check, render_console, run_live
24
- from txa.core import config, console, credentials, engines, licenses, net, semver, winos
24
+ from txa.core import config, console, credentials, engines, licenses, net, semver, updatecheck, winos
25
25
  from txa.core.i18n import is_vi
26
26
  from txa.core.github import GitHub, GitHubError, device_flow
27
27
  from txa.core.manifest import ManifestError, split_id
@@ -884,6 +884,7 @@ def _release_options(p: argparse.ArgumentParser) -> None:
884
884
 
885
885
  def main(argv: list[str] | None = None) -> int:
886
886
  console.setup()
887
+ updatecheck.register()
887
888
  parser = console.SmartArgumentParser(
888
889
  prog="txacreate",
889
890
  description="Publish installers to the TXA repository",
@@ -8,6 +8,7 @@ from __future__ import annotations
8
8
 
9
9
  import re
10
10
  import subprocess
11
+ import time
11
12
  from typing import Any
12
13
 
13
14
  import yaml
@@ -716,12 +717,22 @@ def save_draft_manifests(draft, root_dir, dry_run: bool = False):
716
717
 
717
718
 
718
719
  def _real_size(url: str) -> int:
719
- """The installer's real byte size (the validator compares it with what the server reports); 1 only if the server hides it."""
720
- try:
721
- length = net.probe(net.session(), url).length
722
- except Exception: # noqa: BLE001 - an unreachable server must not stop the sync
723
- length = None
724
- return length or 1
720
+ """The installer's real byte size (the validator compares it with what the server reports).
721
+
722
+ Retried a few times; if the size still cannot be read this raises, so the package is
723
+ skipped instead of being published with a made-up size (STEP 07 would reject it)."""
724
+ from txa.core import net
725
+
726
+ last: Exception | str = "the server reported no size"
727
+ for attempt in range(3):
728
+ try:
729
+ length = net.probe(net.session(), url).length
730
+ if length:
731
+ return length
732
+ except Exception as exc: # noqa: BLE001 - reported below after the retries
733
+ last = exc
734
+ time.sleep(2 * (attempt + 1))
735
+ raise RuntimeError(f"cannot read the installer size of {url}: {last}")
725
736
 
726
737
 
727
738
  # Hand-written / non-WinGet packages that must NEVER be overwritten by automatic WinGet sync
@@ -784,6 +795,22 @@ _TXAVL_WINGET_MAP: dict[str, str] = {
784
795
  "VisualStudioCommunity2026": "Microsoft.VisualStudio.Community",
785
796
  "VLC": "VideoLAN.VLC",
786
797
  "WinSCP": "WinSCP.WinSCP",
798
+ "DockerDesktop": "Docker.DockerDesktop",
799
+ "CMake": "Kitware.CMake",
800
+ "Go": "GoLang.Go",
801
+ "Neovim": "Neovim.Neovim",
802
+ "JetBrainsToolbox": "JetBrains.Toolbox",
803
+ "DBeaver": "DBeaver.DBeaver.Community",
804
+ "Wireshark": "WiresharkFoundation.Wireshark",
805
+ "Bitwarden": "Bitwarden.Bitwarden",
806
+ "KeePassXC": "KeePassXCTeam.KeePassXC",
807
+ "QBittorrent": "qBittorrent.qBittorrent",
808
+ "SumatraPDF": "SumatraPDF.SumatraPDF",
809
+ "HandBrake": "HandBrake.HandBrake",
810
+ "Zoom": "Zoom.Zoom",
811
+ "Inkscape": "Inkscape.Inkscape",
812
+ "Blender": "BlenderFoundation.Blender",
813
+ "WinDirStat": "WinDirStat.WinDirStat",
787
814
  }
788
815
 
789
816
 
@@ -939,7 +966,12 @@ def sync_txavl_packages(
939
966
  up_to_date.append(pkg_id)
940
967
  continue
941
968
 
942
- draft = convert_winget_to_draft(data, namespace=namespace, override_id=pkg_id)
969
+ try:
970
+ draft = convert_winget_to_draft(data, namespace=namespace, override_id=pkg_id)
971
+ except RuntimeError as exc: # e.g. the installer size could not be read: skip, never publish a guess
972
+ console.say(f" {console.paint('[FAIL]', 'red')} {pkg_id}@{new_ver}: {exc}")
973
+ failed.append(pkg_id)
974
+ continue
943
975
  # Preserve curated metadata from the existing TXAVL manifest
944
976
  if prev_pkg.get("alias"):
945
977
  draft.alias = prev_pkg["alias"]
@@ -24,7 +24,7 @@ from datetime import datetime, timezone
24
24
  from pathlib import Path
25
25
 
26
26
  from txa import __version__
27
- from txa.core import config, console, net, retention, semver, winos
27
+ from txa.core import config, console, net, retention, semver, updatecheck, winos
28
28
  from txa.pm import installer, uninstall
29
29
  from txa.pm.installer import InstallError
30
30
  from txa.pm.source import LocalRelease, NotFound, Source, SourceError, Sources, check_url
@@ -953,6 +953,7 @@ def _install_options(p: argparse.ArgumentParser) -> None:
953
953
 
954
954
  def main(argv: list[str] | None = None) -> int:
955
955
  console.setup()
956
+ updatecheck.register()
956
957
  parser = console.SmartArgumentParser(
957
958
  prog="txapm",
958
959
  description="TXA package manager",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txa
3
- Version: 1.4.0
3
+ Version: 1.4.2
4
4
  Summary: TXA package manager toolchain: txapm (install), txacreate (publish), txaci (16-step validator), txacli (WinGet & repo CLI)
5
5
  Author: TXA Software Dev
6
6
  License: MIT
@@ -35,6 +35,7 @@ src/txa/core/portable.py
35
35
  src/txa/core/retention.py
36
36
  src/txa/core/semver.py
37
37
  src/txa/core/signing.py
38
+ src/txa/core/updatecheck.py
38
39
  src/txa/core/userpath.py
39
40
  src/txa/core/winos.py
40
41
  src/txa/create/__init__.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes