publisher, deployer: same path logic as the originals
build / build (push) Successful in 21m27s

The packaged copies use config.default_path() and pipeline._history_path():
files next to the sources in a checkout, ~/.config/<name> and
~/.local/state/<name> when installed. The copies now differ from the
originals only in the neutral defaults.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
das
2026-10-25 14:55:40 +02:00
co-authored by Claude Sonnet 5.5
parent 396986aaf4
commit 60af93df74
7 changed files with 41 additions and 7 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ Live ISO без графіки з консольним інсталятором:
- [x] Значки Wi-Fi і Bluetooth у треї лишались блідими: панельні значки Papirus (`#dfdfdf`) зроблені для темних панелей, а CSS їх не перефарбовує. Світла тема тепер на `Papirus-Light` (`#444`): `xsettings.xml`, `index.theme`, екран входу; `das-theme` 0.3.0, `das-settings` 0.6.0, 0.9.5; перевірити на ISO. - [x] Значки Wi-Fi і Bluetooth у треї лишались блідими: панельні значки Papirus (`#dfdfdf`) зроблені для темних панелей, а CSS їх не перефарбовує. Світла тема тепер на `Papirus-Light` (`#444`): `xsettings.xml`, `index.theme`, екран входу; `das-theme` 0.3.0, `das-settings` 0.6.0, 0.9.5; перевірити на ISO.
- [x] `das-panel-icon help` (`-h`, `--help`) показує підказку, а не ставить значок «?»; невідомі `-ключі` відхиляються. - [x] `das-panel-icon help` (`-h`, `--help`) показує підказку, а не ставить значок «?»; невідомі `-ключі` відхиляються.
- [x] На десктопний образ додано `publisher` (`publish`) і `deployer` (`deploy`): копії проєктів з `~/Dev/Projects/Python`, конфіг у `~/.config/<назва>/` (створюється з прикладу при першому запуску), історія в `~/.local/state/<назва>/`; перевірити на ISO. - [x] На десктопний образ додано `publisher` (`publish`) і `deployer` (`deploy`): копії проєктів з `~/Dev/Projects/Python`, конфіг у `~/.config/<назва>/` (створюється з прикладу при першому запуску), історія в `~/.local/state/<назва>/`; перевірити на ISO.
- [ ] Перенести в оригінальні `publisher` і `deployer` зміну шляхів конфігу та `history.log` (зараз вони лише в копіях пакетів), щоб копії не розходились. - [x] Зміну шляхів конфігу та `history.log` перенесено в оригінальні `publisher` і `deployer` (`config.default_path()`, `pipeline._history_path()`): у checkout усе як було, у пакеті — `~/.config` і `~/.local/state`. Копії пакетів відрізняються від оригіналів лише значеннями за замовчуванням (localhost, user).
- [ ] Прибрати значки томів live-носія («Том 6,6 ГБ») з робочого столу live-сесії. - [ ] Прибрати значки томів live-носія («Том 6,6 ГБ») з робочого столу live-сесії.
- [ ] Тема GRUB у встановленій системі (зараз стандартний чорний екран). - [ ] Тема GRUB у встановленій системі (зараз стандартний чорний екран).
- [ ] Перевірити меню Whisker вручну. - [ ] Перевірити меню Whisker вручну.
@@ -148,7 +148,7 @@ def main(argv=None) -> int:
args = p.parse_args(argv) args = p.parse_args(argv)
color(sys.stdout.isatty() and not args.no_color) color(sys.stdout.isatty() and not args.no_color)
cfg_path = Path(args.config) if args.config else Path(__file__).resolve().parent.parent / "deploy.toml" cfg_path = Path(args.config) if args.config else config.default_path()
try: try:
cfg = config.load(cfg_path) cfg = config.load(cfg_path)
except (OSError, config.ConfigError) as e: except (OSError, config.ConfigError) as e:
@@ -211,3 +211,11 @@ def append_apps(path: Path, apps: list[App], drafts: list[App] = ()) -> None:
block = "".join(f"# {line}\n" for line in app_to_toml(a).splitlines()) block = "".join(f"# {line}\n" for line in app_to_toml(a).splitlines())
text = text.rstrip("\n") + "\n\n# TODO: check src / build / dest, then uncomment\n" + block text = text.rstrip("\n") + "\n\n# TODO: check src / build / dest, then uncomment\n" + block
path.write_text(text) path.write_text(text)
def default_path() -> Path:
"""deploy.toml next to the sources (a checkout), else ~/.config/deployer/deploy.toml (an installed package)."""
local = Path(__file__).resolve().parent.parent / "deploy.toml"
if local.exists():
return local
return Path(os.environ.get("XDG_CONFIG_HOME") or Path.home() / ".config") / "deployer" / "deploy.toml"
@@ -13,8 +13,17 @@ from . import kinds, remote, snapshots
from .config import App, Config from .config import App, Config
from .kinds import Options, Plan from .kinds import Options, Plan
# Das OS package: /usr/lib is read-only, so the history goes to the user's state dir
HISTORY = Path(os.environ.get("XDG_STATE_HOME") or Path.home() / ".local/state") / "deployer" / "history.log"
def _history_path() -> Path:
"""history.log next to the sources (a checkout), else ~/.local/state/deployer/ (an installed package)."""
local = Path(__file__).resolve().parent.parent
if os.access(local, os.W_OK):
return local / "history.log"
return Path(os.environ.get("XDG_STATE_HOME") or Path.home() / ".local/state") / "deployer" / "history.log"
HISTORY = _history_path()
class DeployError(RuntimeError): class DeployError(RuntimeError):
@@ -150,7 +150,7 @@ def main(argv=None) -> int:
args = p.parse_args(argv) args = p.parse_args(argv)
global COLOR global COLOR
COLOR = sys.stdout.isatty() and not args.no_color COLOR = sys.stdout.isatty() and not args.no_color
cfg_path = Path(args.config) if args.config else Path(__file__).resolve().parent.parent / "publish.toml" cfg_path = Path(args.config) if args.config else config.default_path()
try: try:
cfg = config.load(cfg_path) cfg = config.load(cfg_path)
except (OSError, config.ConfigError) as e: except (OSError, config.ConfigError) as e:
@@ -185,3 +185,11 @@ def append_apps(path: Path, apps: list[App]) -> None:
validate_app(a) validate_app(a)
text = text.rstrip("\n") + "\n\n" + app_to_toml(a) text = text.rstrip("\n") + "\n\n" + app_to_toml(a)
path.write_text(text) path.write_text(text)
def default_path() -> Path:
"""publish.toml next to the sources (a checkout), else ~/.config/publisher/publish.toml (an installed package)."""
local = Path(__file__).resolve().parent.parent / "publish.toml"
if local.exists():
return local
return Path(os.environ.get("XDG_CONFIG_HOME") or Path.home() / ".config") / "publisher" / "publish.toml"
@@ -13,8 +13,17 @@ from . import packages, remote
from .config import App, Config from .config import App, Config
from .packages import Kind, Local, Published, version_key from .packages import Kind, Local, Published, version_key
# Das OS package: /usr/lib is read-only, so the history goes to the user's state dir
HISTORY = Path(os.environ.get("XDG_STATE_HOME") or Path.home() / ".local/state") / "publisher" / "history.log"
def _history_path() -> Path:
"""history.log next to the sources (a checkout), else ~/.local/state/publisher/ (an installed package)."""
local = Path(__file__).resolve().parent.parent
if os.access(local, os.W_OK):
return local / "history.log"
return Path(os.environ.get("XDG_STATE_HOME") or Path.home() / ".local/state") / "publisher" / "history.log"
HISTORY = _history_path()
# Plan item actions; the first five change the server # Plan item actions; the first five change the server
NEW, REPLACE, META, NOTES, DELETE, SAME, SKIP = "new", "replace", "meta", "notes", "delete", "same", "skip" NEW, REPLACE, META, NOTES, DELETE, SAME, SKIP = "new", "replace", "meta", "notes", "delete", "same", "skip"