From e95a23bc209371c480ac0a8ec379ceabd6c60c0a Mon Sep 17 00:00:00 2001 From: Sebastian Palencsar Date: Sat, 27 Jun 2026 10:26:41 +0200 Subject: [PATCH] M3 namespace migration: complete Phase B, partial Phase D, docs and tests - Native runtime under bearhub/ (api, commons, gems, view/util, view/core, view/qt) - bauh/ compatibility re-export shims for legacy imports - Phase D: canonical __version__/__app_name__ in bearhub/__init__.py; pyproject.toml and setup.py point at bearhub package - Native gem loader at bearhub/view/core/gems.py - Namespace compatibility tests (159 tests passing) - Documentation: CHANGELOG [Unreleased], NAMESPACE_MIGRATION, ROADMAP, README, CONTRIBUTING, docs/qt6-migration.md, packaging/aur/README.md --- CHANGELOG.md | 46 +++ CONTRIBUTING.md | 12 +- NAMESPACE_MIGRATION.md | 386 +++++++++++++++++++++--- README.md | 17 +- ROADMAP.md | 18 +- bauh/__init__.py | 11 +- bauh/api/__init__.py | 1 + bauh/api/abstract/__init__.py | 1 + bauh/api/abstract/cache.py | 1 + bauh/api/abstract/context.py | 1 + bauh/api/abstract/controller.py | 1 + bauh/api/abstract/disk.py | 1 + bauh/api/abstract/download.py | 1 + bauh/api/abstract/handler.py | 1 + bauh/api/abstract/model.py | 1 + bauh/api/abstract/view.py | 1 + bauh/api/exception.py | 1 + bauh/api/http.py | 1 + bauh/api/paths.py | 1 + bauh/api/user.py | 1 + bauh/commons/__init__.py | 1 + bauh/commons/boot.py | 1 + bauh/commons/category.py | 1 + bauh/commons/config.py | 1 + bauh/commons/custom_types.py | 1 + bauh/commons/html.py | 1 + bauh/commons/internet.py | 1 + bauh/commons/regex.py | 1 + bauh/commons/resource.py | 1 + bauh/commons/singleton.py | 1 + bauh/commons/suggestions.py | 1 + bauh/commons/system.py | 1 + bauh/commons/util.py | 1 + bauh/commons/version_util.py | 1 + bauh/commons/view_utils.py | 1 + bauh/gems/appimage/__init__.py | 1 + bauh/gems/appimage/config.py | 1 + bauh/gems/appimage/controller.py | 1 + bauh/gems/appimage/model.py | 1 + bauh/gems/appimage/query.py | 1 + bauh/gems/appimage/util.py | 1 + bauh/gems/appimage/worker.py | 1 + bauh/gems/arch/__init__.py | 1 + bauh/gems/arch/aur.py | 1 + bauh/gems/arch/config.py | 1 + bauh/gems/arch/confirmation.py | 1 + bauh/gems/arch/controller.py | 1 + bauh/gems/arch/cpu_manager.py | 1 + bauh/gems/arch/database.py | 1 + bauh/gems/arch/dependencies.py | 1 + bauh/gems/arch/disk.py | 1 + bauh/gems/arch/download.py | 1 + bauh/gems/arch/exceptions.py | 1 + bauh/gems/arch/git.py | 1 + bauh/gems/arch/gpg.py | 1 + bauh/gems/arch/makepkg.py | 1 + bauh/gems/arch/mapper.py | 1 + bauh/gems/arch/message.py | 1 + bauh/gems/arch/mirrors.py | 1 + bauh/gems/arch/model.py | 1 + bauh/gems/arch/output.py | 1 + bauh/gems/arch/pacman.py | 1 + bauh/gems/arch/pkgbuild.py | 1 + bauh/gems/arch/proc_util.py | 1 + bauh/gems/arch/rebuild_detector.py | 1 + bauh/gems/arch/sorting.py | 1 + bauh/gems/arch/sshell.py | 1 + bauh/gems/arch/suggestions.py | 1 + bauh/gems/arch/updates.py | 1 + bauh/gems/arch/worker.py | 1 + bauh/gems/flatpak/__init__.py | 1 + bauh/gems/flatpak/config.py | 1 + bauh/gems/flatpak/constants.py | 1 + bauh/gems/flatpak/controller.py | 1 + bauh/gems/flatpak/flatpak.py | 1 + bauh/gems/flatpak/model.py | 1 + bauh/gems/flatpak/worker.py | 1 + bauh/gems/web/__init__.py | 1 + bauh/gems/web/config.py | 1 + bauh/gems/web/controller.py | 1 + bauh/gems/web/environment.py | 1 + bauh/gems/web/model.py | 1 + bauh/gems/web/nativefier.py | 1 + bauh/gems/web/search.py | 1 + bauh/gems/web/suggestions.py | 1 + bauh/gems/web/worker.py | 1 + bauh/stylesheet.py | 259 +--------------- bauh/view/core/__init__.py | 1 + bauh/view/core/controller.py | 1 + bauh/view/core/downloader.py | 1 + bauh/view/core/gems.py | 82 +---- bauh/view/core/settings.py | 1 + bauh/view/core/suggestions.py | 1 + bauh/view/core/timeshift.py | 1 + bauh/view/core/tray_client.py | 1 + bauh/view/core/update.py | 1 + bauh/view/qt/__init__.py | 1 + bauh/view/qt/about.py | 1 + bauh/view/qt/apps_table.py | 1 + bauh/view/qt/commons.py | 1 + bauh/view/qt/components.py | 1 + bauh/view/qt/dialog.py | 1 + bauh/view/qt/history.py | 1 + bauh/view/qt/info.py | 1 + bauh/view/qt/prepare.py | 1 + bauh/view/qt/qt_utils.py | 1 + bauh/view/qt/root.py | 1 + bauh/view/qt/screenshots.py | 1 + bauh/view/qt/settings.py | 1 + bauh/view/qt/systray.py | 1 + bauh/view/qt/thread.py | 1 + bauh/view/qt/view_index.py | 1 + bauh/view/qt/view_model.py | 1 + bauh/view/qt/window.py | 1 + bauh/view/util/__init__.py | 1 + bauh/view/util/cache.py | 1 + bauh/view/util/disk.py | 1 + bauh/view/util/logs.py | 1 + bauh/view/util/resource.py | 1 + bauh/view/util/translation.py | 1 + bauh/view/util/util.py | 1 + bearhub/__init__.py | 9 +- bearhub/api/abstract/context.py | 12 +- bearhub/api/abstract/controller.py | 10 +- bearhub/api/abstract/disk.py | 4 +- bearhub/api/abstract/download.py | 2 +- bearhub/api/abstract/handler.py | 2 +- bearhub/api/abstract/model.py | 4 +- bearhub/api/http.py | 4 +- bearhub/api/paths.py | 4 +- bearhub/commons/boot.py | 6 +- bearhub/commons/category.py | 8 +- bearhub/commons/config.py | 4 +- bearhub/commons/suggestions.py | 2 +- bearhub/commons/system.py | 2 +- bearhub/commons/view_utils.py | 2 +- bearhub/gems/__init__.py | 0 bearhub/gems/appimage/__init__.py | 4 +- bearhub/gems/appimage/config.py | 4 +- bearhub/gems/appimage/controller.py | 36 +-- bearhub/gems/appimage/model.py | 8 +- bearhub/gems/appimage/worker.py | 14 +- bearhub/gems/arch/__init__.py | 4 +- bearhub/gems/arch/aur.py | 6 +- bearhub/gems/arch/config.py | 4 +- bearhub/gems/arch/confirmation.py | 14 +- bearhub/gems/arch/controller.py | 62 ++-- bearhub/gems/arch/cpu_manager.py | 4 +- bearhub/gems/arch/database.py | 4 +- bearhub/gems/arch/dependencies.py | 12 +- bearhub/gems/arch/disk.py | 4 +- bearhub/gems/arch/download.py | 16 +- bearhub/gems/arch/git.py | 4 +- bearhub/gems/arch/gpg.py | 2 +- bearhub/gems/arch/makepkg.py | 8 +- bearhub/gems/arch/mapper.py | 10 +- bearhub/gems/arch/message.py | 8 +- bearhub/gems/arch/mirrors.py | 2 +- bearhub/gems/arch/model.py | 8 +- bearhub/gems/arch/output.py | 6 +- bearhub/gems/arch/pacman.py | 8 +- bearhub/gems/arch/rebuild_detector.py | 4 +- bearhub/gems/arch/sshell.py | 2 +- bearhub/gems/arch/suggestions.py | 14 +- bearhub/gems/arch/updates.py | 20 +- bearhub/gems/arch/worker.py | 20 +- bearhub/gems/flatpak/__init__.py | 8 +- bearhub/gems/flatpak/config.py | 4 +- bearhub/gems/flatpak/controller.py | 30 +- bearhub/gems/flatpak/flatpak.py | 14 +- bearhub/gems/flatpak/model.py | 8 +- bearhub/gems/flatpak/worker.py | 12 +- bearhub/gems/web/__init__.py | 8 +- bearhub/gems/web/config.py | 4 +- bearhub/gems/web/controller.py | 38 +-- bearhub/gems/web/environment.py | 20 +- bearhub/gems/web/model.py | 12 +- bearhub/gems/web/nativefier.py | 4 +- bearhub/gems/web/search.py | 2 +- bearhub/gems/web/suggestions.py | 8 +- bearhub/gems/web/worker.py | 16 +- bearhub/view/core/__init__.py | 3 - bearhub/view/core/controller.py | 32 +- bearhub/view/core/downloader.py | 14 +- bearhub/view/core/gems.py | 101 ++++++- bearhub/view/core/settings.py | 18 +- bearhub/view/core/suggestions.py | 2 +- bearhub/view/core/timeshift.py | 4 +- bearhub/view/core/tray_client.py | 2 +- bearhub/view/core/update.py | 12 +- bearhub/view/qt/about.py | 6 +- bearhub/view/qt/apps_table.py | 22 +- bearhub/view/qt/commons.py | 4 +- bearhub/view/qt/components.py | 4 +- bearhub/view/qt/dialog.py | 8 +- bearhub/view/qt/history.py | 8 +- bearhub/view/qt/info.py | 10 +- bearhub/view/qt/prepare.py | 20 +- bearhub/view/qt/qt_utils.py | 2 +- bearhub/view/qt/root.py | 12 +- bearhub/view/qt/screenshots.py | 14 +- bearhub/view/qt/settings.py | 20 +- bearhub/view/qt/systray.py | 22 +- bearhub/view/qt/thread.py | 42 +-- bearhub/view/qt/view_index.py | 4 +- bearhub/view/qt/view_model.py | 4 +- bearhub/view/qt/window.py | 60 ++-- bearhub/view/util/cache.py | 2 +- bearhub/view/util/disk.py | 6 +- bearhub/view/util/translation.py | 2 +- bearhub/view/util/util.py | 10 +- docs/qt6-migration.md | 12 +- packaging/aur/README.md | 8 +- pyproject.toml | 7 +- setup.py | 11 +- tests/api/abstract/test_model.py | 2 +- tests/api/test_namespace.py | 17 ++ tests/common/test_util.py | 2 +- tests/common/test_version_util.py | 2 +- tests/common/test_view_utils.py | 2 +- tests/gems/appimage/test_namespace.py | 22 ++ tests/gems/appimage/test_util.py | 2 +- tests/gems/arch/test_aur.py | 2 +- tests/gems/arch/test_aur_data_mapper.py | 4 +- tests/gems/arch/test_namespace.py | 22 ++ tests/gems/arch/test_pacman.py | 12 +- tests/gems/arch/test_sorting.py | 2 +- tests/gems/arch/test_updates.py | 62 ++-- tests/gems/flatpak/test_controller.py | 4 +- tests/gems/flatpak/test_flatpak.py | 6 +- tests/gems/flatpak/test_namespace.py | 22 ++ tests/gems/flatpak/test_worker.py | 2 +- tests/gems/web/test_controller.py | 6 +- tests/gems/web/test_namespace.py | 22 ++ tests/test_namespace_phase_d.py | 21 ++ tests/view/core/test_namespace.py | 23 ++ tests/view/qt/__init__.py | 0 tests/view/qt/test_namespace.py | 19 ++ tests/view/util/__init__.py | 0 tests/view/util/test_namespace.py | 20 ++ 240 files changed, 1382 insertions(+), 943 deletions(-) create mode 100644 bauh/api/__init__.py create mode 100644 bauh/api/abstract/__init__.py create mode 100644 bauh/api/abstract/cache.py create mode 100644 bauh/api/abstract/context.py create mode 100644 bauh/api/abstract/controller.py create mode 100644 bauh/api/abstract/disk.py create mode 100644 bauh/api/abstract/download.py create mode 100644 bauh/api/abstract/handler.py create mode 100644 bauh/api/abstract/model.py create mode 100644 bauh/api/abstract/view.py create mode 100644 bauh/api/exception.py create mode 100644 bauh/api/http.py create mode 100644 bauh/api/paths.py create mode 100644 bauh/api/user.py create mode 100644 bauh/commons/__init__.py create mode 100644 bauh/commons/boot.py create mode 100644 bauh/commons/category.py create mode 100644 bauh/commons/config.py create mode 100644 bauh/commons/custom_types.py create mode 100644 bauh/commons/html.py create mode 100644 bauh/commons/internet.py create mode 100644 bauh/commons/regex.py create mode 100644 bauh/commons/resource.py create mode 100644 bauh/commons/singleton.py create mode 100644 bauh/commons/suggestions.py create mode 100644 bauh/commons/system.py create mode 100644 bauh/commons/util.py create mode 100644 bauh/commons/version_util.py create mode 100644 bauh/commons/view_utils.py create mode 100644 bauh/gems/appimage/__init__.py create mode 100644 bauh/gems/appimage/config.py create mode 100644 bauh/gems/appimage/controller.py create mode 100644 bauh/gems/appimage/model.py create mode 100644 bauh/gems/appimage/query.py create mode 100644 bauh/gems/appimage/util.py create mode 100644 bauh/gems/appimage/worker.py create mode 100644 bauh/gems/arch/__init__.py create mode 100644 bauh/gems/arch/aur.py create mode 100644 bauh/gems/arch/config.py create mode 100644 bauh/gems/arch/confirmation.py create mode 100644 bauh/gems/arch/controller.py create mode 100644 bauh/gems/arch/cpu_manager.py create mode 100644 bauh/gems/arch/database.py create mode 100644 bauh/gems/arch/dependencies.py create mode 100644 bauh/gems/arch/disk.py create mode 100644 bauh/gems/arch/download.py create mode 100644 bauh/gems/arch/exceptions.py create mode 100644 bauh/gems/arch/git.py create mode 100644 bauh/gems/arch/gpg.py create mode 100644 bauh/gems/arch/makepkg.py create mode 100644 bauh/gems/arch/mapper.py create mode 100644 bauh/gems/arch/message.py create mode 100644 bauh/gems/arch/mirrors.py create mode 100644 bauh/gems/arch/model.py create mode 100644 bauh/gems/arch/output.py create mode 100644 bauh/gems/arch/pacman.py create mode 100644 bauh/gems/arch/pkgbuild.py create mode 100644 bauh/gems/arch/proc_util.py create mode 100644 bauh/gems/arch/rebuild_detector.py create mode 100644 bauh/gems/arch/sorting.py create mode 100644 bauh/gems/arch/sshell.py create mode 100644 bauh/gems/arch/suggestions.py create mode 100644 bauh/gems/arch/updates.py create mode 100644 bauh/gems/arch/worker.py create mode 100644 bauh/gems/flatpak/__init__.py create mode 100644 bauh/gems/flatpak/config.py create mode 100644 bauh/gems/flatpak/constants.py create mode 100644 bauh/gems/flatpak/controller.py create mode 100644 bauh/gems/flatpak/flatpak.py create mode 100644 bauh/gems/flatpak/model.py create mode 100644 bauh/gems/flatpak/worker.py create mode 100644 bauh/gems/web/__init__.py create mode 100644 bauh/gems/web/config.py create mode 100644 bauh/gems/web/controller.py create mode 100644 bauh/gems/web/environment.py create mode 100644 bauh/gems/web/model.py create mode 100644 bauh/gems/web/nativefier.py create mode 100644 bauh/gems/web/search.py create mode 100644 bauh/gems/web/suggestions.py create mode 100644 bauh/gems/web/worker.py mode change 100755 => 100644 bauh/view/core/__init__.py create mode 100644 bauh/view/core/controller.py create mode 100644 bauh/view/core/downloader.py create mode 100644 bauh/view/core/settings.py create mode 100644 bauh/view/core/suggestions.py create mode 100644 bauh/view/core/timeshift.py create mode 100644 bauh/view/core/tray_client.py create mode 100644 bauh/view/core/update.py create mode 100644 bauh/view/qt/__init__.py create mode 100644 bauh/view/qt/about.py create mode 100644 bauh/view/qt/apps_table.py create mode 100644 bauh/view/qt/commons.py create mode 100644 bauh/view/qt/components.py create mode 100644 bauh/view/qt/dialog.py create mode 100644 bauh/view/qt/history.py create mode 100644 bauh/view/qt/info.py create mode 100644 bauh/view/qt/prepare.py create mode 100644 bauh/view/qt/qt_utils.py create mode 100644 bauh/view/qt/root.py create mode 100644 bauh/view/qt/screenshots.py create mode 100644 bauh/view/qt/settings.py create mode 100644 bauh/view/qt/systray.py create mode 100644 bauh/view/qt/thread.py create mode 100644 bauh/view/qt/view_index.py create mode 100644 bauh/view/qt/view_model.py create mode 100644 bauh/view/qt/window.py create mode 100644 bauh/view/util/__init__.py create mode 100644 bauh/view/util/cache.py create mode 100644 bauh/view/util/disk.py create mode 100644 bauh/view/util/logs.py create mode 100644 bauh/view/util/resource.py create mode 100644 bauh/view/util/translation.py create mode 100644 bauh/view/util/util.py create mode 100644 bearhub/gems/__init__.py create mode 100644 tests/api/test_namespace.py create mode 100644 tests/gems/appimage/test_namespace.py create mode 100644 tests/gems/arch/test_namespace.py create mode 100644 tests/gems/flatpak/test_namespace.py create mode 100644 tests/gems/web/test_namespace.py create mode 100644 tests/test_namespace_phase_d.py create mode 100644 tests/view/core/test_namespace.py create mode 100644 tests/view/qt/__init__.py create mode 100644 tests/view/qt/test_namespace.py create mode 100644 tests/view/util/__init__.py create mode 100644 tests/view/util/test_namespace.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b61de68..f02b934b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,52 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Added +- Native gem loader at `bearhub/view/core/gems.py` (scans `bearhub/gems/` first, falls back to `bauh/gems/` during transition) +- Namespace compatibility tests for migrated packages: + - `tests/gems/appimage/test_namespace.py` + - `tests/gems/flatpak/test_namespace.py` + - `tests/gems/web/test_namespace.py` + - `tests/gems/arch/test_namespace.py` + - `tests/api/test_namespace.py` + - `tests/view/util/test_namespace.py` + - `tests/view/core/test_namespace.py` + - `tests/view/qt/test_namespace.py` + - `tests/test_namespace_phase_d.py` + +### Changed +- **M3 namespace migration (Phase B):** all runtime implementation moved from `bauh/` to `bearhub/`: + - `bearhub/gems/` — AppImage, Flatpak, Web, Arch/AUR (28+ modules per backend) + - `bearhub/api/` and `bearhub/commons/` — full API and shared utility layer + - `bearhub/view/util/` — cache, disk, logs, translation, util (`resource.py` already Bearhub-native) + - `bearhub/view/core/` — controller, downloader, settings, suggestions, timeshift, tray_client, update (`config`, `gems` already native) + - `bearhub/view/qt/` — all 18 Qt UI modules (window, thread, systray, components, …) +- **M3 namespace migration (Phase D, partial):** + - `__version__` and `__app_name__` canonical in `bearhub/__init__.py` + - `bauh/__init__.py` and `bauh/stylesheet.py` reduced to compatibility shims + - `pyproject.toml` reads version from `bearhub.__version__` + - `setup.py` uses `APP_PACKAGE = 'bearhub'` and ships resources only from `bearhub/` +- Unit tests updated to import from `bearhub.*` where modules were migrated (gems, api, commons, arch patches) +- Test suite expanded from 132 to 159 tests (all passing locally) + +### Deprecated +- `import bauh` and `import bauh.*` — still supported via re-export shims under `bauh/`, but `bearhub` is the canonical namespace for new code +- `bauh/view/resources/` — kept in `MANIFEST.in` only as legacy fallback for `bearhub/view/util/resource.py`; scheduled for removal after shim deprecation window + +### Documentation +- `NAMESPACE_MIGRATION.md` rewritten and kept current through G.1–G.4, B.3–B.6, and Phase D slices +- Gem migration plan documented (G.1 AppImage → G.4 Arch order) +- Phase D completion criteria and remaining shim-removal steps documented +- `docs/qt6-migration.md`, `ROADMAP.md` M6, and `NAMESPACE_MIGRATION.md` history sections updated to `bearhub/*` paths +- `packaging/aur/README.md` release checklist aligned with next tag after `[Unreleased]` + +### Compatibility +- `bauh/api/*`, `bauh/commons/*`, `bauh/gems/*`, `bauh/view/*` remain installable as thin re-export shims (`from bearhub. import *`) +- `bauh/app.py`, `bauh/manage.py`, `bauh/tray.py`, `bauh/context.py`, `bauh/app_args.py` continue to delegate to `bearhub` entry modules +- No intentional user-facing behavior changes; migration is import-path and packaging structure only + ## [0.10.7-bearhub.6] 2026-06-26 ### Fixed - Arch metadata URLs no longer point to non-existent `bearhub-files` (restored `bauh-files` data sources) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 222035b0..814e26c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,8 +23,10 @@ The way to go here is to ask yourself if the improvement would be useful for mor # Adding a new translation * To add a new translation, you will have to create a file in each directory listed below named as the first two letters of the language in the ISO format (e.g: for 'english' would be 'en'): -- `bearhub/view/resources/locale` (or `bauh/view/resources/locale` during namespace migration) -- `bauh/gems/appimage/resources/locale` -- `bauh/gems/arch/resources/locale` -- `bauh/gems/flatpak/resources/locale` -- `bauh/gems/web/resources/locale` +- `bearhub/view/resources/locale` +- `bearhub/gems/appimage/resources/locale` +- `bearhub/gems/arch/resources/locale` +- `bearhub/gems/flatpak/resources/locale` +- `bearhub/gems/web/resources/locale` + +New code should use `bearhub.*` imports. Legacy `bauh.*` imports still work via compatibility shims (see `NAMESPACE_MIGRATION.md`). diff --git a/NAMESPACE_MIGRATION.md b/NAMESPACE_MIGRATION.md index 1b092434..50101eb2 100644 --- a/NAMESPACE_MIGRATION.md +++ b/NAMESPACE_MIGRATION.md @@ -2,64 +2,380 @@ This document defines the technical migration strategy for moving the Python package namespace from `bauh` to `bearhub` safely. +Last updated: 2026-06-27 (Phase D slice: version flip + packaging canonicalization). + ## Current State -- Runtime implementation still lives under `bauh/`. -- Project/package identity is already `bearhub` (metadata, binaries, releases). -- Entry points still target `bauh.*` modules. +| Area | Status | +|------|--------| +| Project identity | `bearhub` (PyPI name, binaries, AUR, docs, desktop files) | +| Version source | `bearhub/__init__.py` (`pyproject.toml` → `bearhub.__version__`) | +| Entry points | **Flipped** — `bearhub`, `bearhub-tray`, `bearhub-cli` target `bearhub.*` | +| Runtime implementation | **Native under `bearhub/`** — `api/*`, `commons/*`, `gems/*`, `view/*`, app shell, CLI | +| Legacy `bauh/` tree | Compatibility re-export shims only (+ `bauh/view/resources/` fallback data) | +| `gems/` backends | AppImage, Flatpak, Web, Arch/AUR — all under `bearhub/gems/` | +| Gem loader | Native `bearhub/view/core/gems.py` (dual-root scan + import fallback) | +| Tests | 159 unit tests, all passing (CI: Python 3.11, 3.12) | +| Compatibility shims | `bauh/*` re-exports `bearhub.*`; documented in `CHANGELOG.md` `[Unreleased]` | + +### Progress Overview (~95 % of M3 — Phase B complete, Phase D in progress) + +``` +Phase A [████████████████████] 100 % skeleton + wrappers +Phase B [████████████████████] 100 % all runtime modules native under `bearhub/` (shims in `bauh/`) +Phase C [████████████████████] 100 % entry points on bearhub.* +Phase D [██████████░░░░░░░░░░] 50 % version flip done; full shim removal after stable release +``` + +### Native vs Shim Modules + +**Native (implemented in `bearhub/`):** + +- App shell: `app_main.py`, `manage.py`, `tray.py`, `context.py`, `stylesheet.py`, `app_args.py`, `app.py` +- CLI: `cli/*` +- `api/*`, `commons/*`, `gems/*` +- `view/util/*`, `view/core/*`, `view/qt/*` +- `view/util/resource.py` prefers `bearhub/view/resources`, falls back to `bauh/view/resources` + +**Legacy `bauh/` tree (compatibility shims only):** + +- `bauh/api/*`, `bauh/commons/*`, `bauh/gems/*`, `bauh/view/*` — all re-export from `bearhub.*` +- `bauh/app.py`, `bauh/stylesheet.py`, `bauh/context.py` (partial) — thin redirects to `bearhub` + +**Still only in `bauh/` (shim-only, pending removal):** + +- `bauh/__init__.py`, `bauh/stylesheet.py`, `bauh/app*.py`, `bauh/context.py`, `bauh/manage.py`, `bauh/tray.py` +- `bauh/api/*`, `bauh/commons/*`, `bauh/gems/*`, `bauh/view/*` — re-export shims +- `bauh/view/resources/` — legacy resource fallback (still in `MANIFEST.in`) + +**Dead upstream backends (only `__pycache__` left, no `.py` sources):** + +- `bauh/gems/debian/`, `bauh/gems/snap/` — skip migration; remove cache dirs during M4 cleanup. ## Migration Goals - Make `bearhub` the canonical Python namespace. - Keep temporary compatibility for legacy `bauh` imports. - Avoid breaking AUR/PyPI/runtime while migration is in progress. +- Complete `gems/` migration before starting M6 (Qt6) to avoid dual refactors. ## Phase Plan -### Phase A: Introduce target namespace skeleton (current) +### Phase A: Introduce target namespace skeleton — DONE -- Add `bearhub/` package wrappers that delegate to `bauh/`. -- Keep behavior unchanged. -- Do not switch entry points yet. +- [x] Add `bearhub/` package wrappers that delegate to `bauh/`. +- [x] Add native resource tree at `bearhub/view/resources/`. +- [x] Add desktop integration under `bearhub/desktop/`. +- [x] Keep behavior unchanged during wrapper phase. -### Phase B: Move core modules +### Phase B: Move core modules — DONE -Order: -1. `api`, `commons`, `context` -2. `view` / `qt` -3. `gems` -4. CLI + app entry modules +Original order (adjusted based on actual progress): + +| Step | Module group | Status | Notes | +|------|-------------|--------|-------| +| B.1 | CLI + app entry | **Done** | `bearhub/app_main.py`, `cli/app_main.py`, `manage.py`, `tray.py` | +| B.2 | `context`, `stylesheet`, `view/core/config`, `view/util/resource` | **Done** | Native implementations | +| B.3 | `api`, `commons` | **Done** | Native under `bearhub/`; `bauh/api` + `bauh/commons` are shims | +| B.4 | `view/util` | **Done** | Native under `bearhub/view/util/`; `bauh/view/util` are shims | +| B.5 | `view/core` | **Done** | Native under `bearhub/view/core/`; `bauh/view/core` are shims | +| B.6 | `view/qt` | **Done** | Native under `bearhub/view/qt/`; `bauh/view/qt` are shims | +| B.7 | `gems/` | **Done** | G.1–G.4 complete | + +Rules (unchanged): -Rules: - Move one group at a time. -- After each move, keep compatibility imports in `bauh`. -- Run smoke test: start, search, install, uninstall, update. +- After each move, keep compatibility imports in `bauh/`. +- Run smoke test after every slice: start, search, install, uninstall, update. +- One release per backend migration slice is acceptable (`0.10.7-bearhub.N`). -### Phase C: Flip entry points +### Phase C: Flip entry points — DONE -- Change project scripts to: - - `bearhub = bearhub.app:main` - - `bearhub-tray = bearhub.app:tray` - - `bearhub-cli = bearhub.cli.app:main` -- Keep compatibility layer for one deprecation window. +```toml +# pyproject.toml / setup.py +bearhub = "bearhub.app:main" +bearhub-tray = "bearhub.app:tray" +bearhub-cli = "bearhub.cli.app:main" +``` -### Phase D: Remove legacy compatibility +Legacy redirect: `bauh/app.py` re-exports from `bearhub.app_main`. -- Remove `bauh` wrappers only after: - - one stable release cycle without namespace-related regressions - - migration completion is documented in changelog +Compatibility window: keep `bauh` import path until **Phase D** (target: one stable release after full Phase B). + +### Phase D: Remove legacy compatibility — IN PROGRESS + +Prerequisites: + +- [x] All Phase B groups moved (no `from bauh` in `bearhub/` runtime paths). +- [ ] One stable release cycle (`bearhub` + `bearhub-git`) without namespace regressions. +- [ ] Changelog documents shim removal. + +Completed (2026-06-27): + +1. [x] `__version__` / `__app_name__` canonical in `bearhub/__init__.py` +2. [x] `bauh/__init__.py` → shim re-exporting from `bearhub` +3. [x] `bauh/stylesheet.py` → shim re-exporting from `bearhub.stylesheet` +4. [x] `pyproject.toml` → `version = {attr = "bearhub.__version__"}` +5. [x] `setup.py` → `APP_PACKAGE = 'bearhub'`, `package_data` only under `bearhub` +6. [x] Tests: `tests/test_namespace_phase_d.py` + +Remaining (after one stable release): + +1. Delete `bauh/*` compatibility re-export shims (or reduce to minimal stub package). +2. Remove legacy `bauh/view/resources` from `MANIFEST.in` once fallback is no longer needed. +3. Remove `provides=('bauh')` from AUR after deprecation window. +4. Drop `bauh` package from `find_packages` / wheel entirely. + +**Target full removal:** earliest `0.10.8` stable (after validated release on current shims). + +--- + +## Gems Migration Plan — DONE (G.1–G.4) + +All active gem backends now live under `bearhub/gems/`. The native loader at `bearhub/view/core/gems.py`: + +1. Scans `{ROOT_DIR}/gems` where `ROOT_DIR` comes from `bearhub`. +2. Imports `bearhub.gems.{name}.controller` (with `bauh.gems.*` fallback during the shim window). +3. Loads per-gem locale files from `{gem}/resources/locale`. +4. Uses `FORBIDDEN_GEMS_FILE = f'/etc/{__app_name__}/gems.forbidden'` with `bearhub.__app_name__`. + +`bauh/view/core/gems.py` is a compatibility shim only. See slice notes below for historical move order. + +### Recommended migration order + +Migrate smallest / best-tested backends first; leave Arch (largest, most critical) for last. + +| PR | Backend | Files | Tests | Risk | Rationale | +|----|---------|-------|-------|------|-----------| +| G.1 | **Loader + AppImage** | 10 + `gems.py` | 4 tests | Low | **Done** — smallest backend; validates loader changes | +| G.2 | **Flatpak** | 10 | 11 tests | Low–medium | **Done** — good test coverage; no pacman coupling | +| G.3 | **Web** | 12 | 14 tests | Medium | **Done** — optional deps (`lxml`, `bs4`); node/nativefier paths | +| G.4 | **Arch/AUR** | 28 | 67 tests | High | **Done** — primary backend; most internal cross-imports | + +### Per-slice checklist (repeat for G.1–G.4) + +**1. Move source tree** + +```bash +git mv bauh/gems/ bearhub/gems/ +``` + +**2. Update imports inside moved files** + +Replace namespace references: + +``` +bauh.gems. → bearhub.gems. +bauh.api.* → bearhub.api.* (or keep bauh.* via wrappers during transition) +bauh.commons.* → bearhub.commons.* +bauh.view.util.* → bearhub.view.util.* +from bauh import ... → from bearhub import ... +``` + +**3. Add compatibility shims in `bauh/gems//`** + +```python +# bauh/gems//__init__.py (and per-module stubs as needed) +from bearhub.gems. import * # noqa: F401,F403 +``` + +**4. Update gem loader (G.1 only, then verify each slice)** + +Native `bearhub/view/core/gems.py` must: + +- Import `ROOT_DIR` from `bearhub` (not `bauh`). +- Scan `os.path.join(ROOT_DIR, 'gems')`. +- Import `bearhub.gems.{name}.controller` (with fallback to `bauh.gems.{name}.controller` during transition if needed). +- Keep `FORBIDDEN_GEMS_FILE = f'/etc/{__app_name__}/gems.forbidden'` using `bearhub.__app_name__`. + +**5. Update packaging metadata** + +In `pyproject.toml` and `setup.py`, add/update: + +```python +"bearhub": [ + ... + "gems/*/resources/img/*", + "gems/*/resources/locale/*", +] +``` + +**6. Update tests** + +Prefer `from bearhub.gems....` in test imports. Keep one compatibility test per backend verifying `import bauh.gems.` still works until Phase D. + +**7. Verify** + +```bash +python -m unittest discover -s tests -p "test_*.py" -v +bearhub-cli --version +bearhub --help # offscreen if no display +``` + +### G.1 detailed steps (first slice) — DONE + +Completed 2026-06-27. + +**Moved:** `bauh/gems/appimage/` → `bearhub/gems/appimage/` (resources included) + +**Rewritten natively:** + +- `bearhub/view/core/gems.py` — scans `bearhub/gems/` first, falls back to `bauh/gems/`; imports `bearhub.gems.*.controller` with `bauh.*` fallback +- `bauh/view/core/gems.py` — compatibility shim → `bearhub.view.core.gems` + +**Compatibility shims added:** + +- `bauh/gems/appimage/*.py` → re-export from `bearhub.gems.appimage.*` +- Extra `bearhub/api/abstract/*` and `bearhub/commons/*` wrappers required by AppImage imports + +**Tests:** `tests/gems/appimage/test_util.py` (canonical import), `tests/gems/appimage/test_namespace.py` (compat + loader) + +**Result:** AppImage canonical under `bearhub/gems/appimage/`; loader established for subsequent backends. + +### G.2 detailed steps (second slice) — DONE + +Completed 2026-06-27. + +**Moved:** `bauh/gems/flatpak/` → `bearhub/gems/flatpak/` (resources included) + +**Compatibility shims:** `bauh/gems/flatpak/*.py` → re-export from `bearhub.gems.flatpak.*` + +**Additional wrappers:** `bearhub/api/exception.py`, `bearhub/api/abstract/cache.py`, `bearhub/commons/suggestions.py`, `bearhub/commons/util.py` + +**Tests:** flatpak tests switched to `bearhub.*` imports; `tests/gems/flatpak/test_namespace.py` added + +**Result:** Flatpak canonical under `bearhub/gems/flatpak/`. + +### G.3 detailed steps (third slice) — DONE + +Completed 2026-06-27. + +**Moved:** `bauh/gems/web/` → `bearhub/gems/web/` (resources included) + +**Compatibility shims:** `bauh/gems/web/*.py` → re-export from `bearhub.gems.web.*` + +**Additional wrappers:** `bearhub/api/abstract/download.py`, `bearhub/commons/view_utils.py` + +**Tests:** web tests switched to `bearhub.*` imports/patch targets; `tests/gems/web/test_namespace.py` added + +**Result:** Web canonical under `bearhub/gems/web/`. + +### G.4 detailed steps (fourth slice) — DONE + +Completed 2026-06-27. + +**Moved:** `bauh/gems/arch/` → `bearhub/gems/arch/` (28 Python modules + resources) + +**Compatibility shims:** `bauh/gems/arch/*.py` → re-export from `bearhub.gems.arch.*` + +**Additional wrappers:** `bearhub/commons/category.py` + +**Tests:** all `tests/gems/arch/*` switched to `bearhub.*` imports/patch targets; `tests/gems/arch/test_namespace.py` added + +**Result:** All active gem backends canonical under `bearhub/gems/` (Phase B.7 complete). + +### B.3/B.4 slice: native `api/` + `commons/` — DONE + +Completed 2026-06-27. + +**Moved:** `bauh/api/` → `bearhub/api/` (14 modules), `bauh/commons/` → `bearhub/commons/` (15 modules) + +**Compatibility shims:** `bauh/api/*.py`, `bauh/commons/*.py` → re-export from `bearhub.*` + +**Tests:** `tests/common/*`, `tests/api/abstract/*` switched to `bearhub.*`; `tests/api/test_namespace.py` added + +**Result:** `bearhub.api` and `bearhub.commons` are canonical. + +### B.4 slice: native `view/util/` — DONE + +Completed 2026-06-27. + +**Moved:** `bauh/view/util/{cache,disk,logs,translation,util}.py` → `bearhub/view/util/` + +**Kept native:** `bearhub/view/util/resource.py` (Bearhub-first resource resolver with `bauh` fallback) + +**Compatibility shims:** `bauh/view/util/*.py` → re-export from `bearhub.view.util.*` + +**Tests:** `tests/view/util/test_namespace.py` added + +**Result:** `bearhub.view.util` is canonical (`resource.py` Bearhub-first with `bauh` fallback). + +### B.5 slice: native `view/core/` — DONE + +Completed 2026-06-27. + +**Moved:** `bauh/view/core/{controller,downloader,settings,suggestions,timeshift,tray_client,update}.py` → `bearhub/view/core/` + +**Already native:** `config.py`, `gems.py` + +**Compatibility shims:** `bauh/view/core/*.py` → re-export from `bearhub.view.core.*` + +**Tests:** `tests/view/core/test_namespace.py` added + +**Result:** `bearhub.view.core` is canonical (except `config`/`gems`, already native). + +### B.6 slice: native `view/qt/` — DONE + +Completed 2026-06-27. + +**Moved:** all 18 modules from `bauh/view/qt/` → `bearhub/view/qt/` + +**Key import updates:** `bearhub.context`, `bearhub.stylesheet`, `bearhub.view.core/*`, `bearhub.view.util/*` + +**Compatibility shims:** `bauh/view/qt/*.py` → re-export from `bearhub.view.qt.*` + +**Tests:** `tests/view/qt/test_namespace.py` added + +**Result:** Phase B complete — all runtime logic is native under `bearhub/`. Remaining M3 work is Phase D (shim removal after one stable release). + +### G.4 Arch-specific notes + +Arch has the most cross-module imports (~31 files) and the most tests. Additional care: + +- `worker.py` has a lazy import of `ArchManager` — preserve pattern. +- `CUSTOM_MAKEPKG_FILE`, `ARCH_CONFIG_DIR`, pacman integration — smoke-test install/uninstall on a real Arch system or VM. +- Locale files under `gems/arch/resources/locale/` must ship in `package_data`. +- Run full arch test suite: `python -m unittest discover -s tests/gems/arch -v`. + +### Phase B completion summary + +Phase B (B.1–B.7) is **complete** as of 2026-06-27. All runtime modules are native under `bearhub/`; `bauh/` holds re-export shims only. + +**Next (Phase D):** ship one stable release on current shims, then remove `bauh/*` compatibility tree per checklist above. Do not start M6 (Qt6) until M3 is tagged and stable — see `docs/qt6-migration.md`. + +--- ## Compatibility Policy -- During migration, both imports should work: - - `import bearhub` - - `import bauh` -- `bearhub` is canonical for new code. -- `bauh` should only be used as temporary compatibility path. +During migration, both imports should work: + +```python +import bearhub +import bauh # temporary — deprecated +``` + +- `bearhub` is canonical for all new code and entry points. +- `bauh` is a compatibility path only; do not add new `bauh` imports. +- `bearhub/__init__.py` currently delegates `__version__` to `bauh` — fix in Phase D. +- User config/cache paths use `__app_name__` (`bearhub`); legacy `bauh` dirs are auto-migrated via `bauh/api/paths.py`. ## Verification Checklist -- `python -m py_compile` passes for changed modules. -- GUI starts and basic actions work. -- AUR `bearhub` and `bearhub-git` build/install successfully. -- No user-facing regression in naming/path behavior. +Run after every migration slice: + +- [ ] `python -m unittest discover -s tests -p "test_*.py"` passes +- [ ] `python -m py_compile` on changed modules +- [ ] `bearhub --version` prints expected version +- [ ] `bearhub-cli --help` works +- [ ] GUI smoke test (if display available): start → search → list installed apps +- [ ] Backend-specific smoke test for migrated gem (install/uninstall dry-run or test env) +- [ ] `pip install -e .` succeeds +- [ ] AUR `bearhub` and `bearhub-git` PKGBUILDs build (maintainer check) +- [ ] No new user-facing `bauh` labels in changed UI paths +- [ ] Changelog entry under `[Unreleased]` or next `bearhub.N` tag + +## Related Documents + +- `ROADMAP.md` — milestone M3 (namespace) and M6 (Qt6, after M3 tag) +- `docs/qt6-migration.md` — Qt6 inventory under `bearhub/view/qt/*` and `bearhub/view/core/*` +- `CHANGELOG.md` — `[Unreleased]` holds full Phase B + partial Phase D notes; tagged slices from `0.10.7-bearhub.4` through `.6` \ No newline at end of file diff --git a/README.md b/README.md index 16835211..1bd979e2 100644 --- a/README.md +++ b/README.md @@ -201,13 +201,14 @@ Bearhub is currently distributed through source releases and AUR: #### Maintainer docs -- Namespace migration notes: `NAMESPACE_MIGRATION.md` +- Namespace migration notes: `NAMESPACE_MIGRATION.md` (runtime is native under `bearhub/`; `bauh/` is shim-only until Phase D completion) +- Unreleased migration changelog: `CHANGELOG.md` → `[Unreleased]` - Qt6 migration plan: `docs/qt6-migration.md` - Brand assets: `gfx/bearhub.svg`, `gfx/bearhub.png` (synced into `bearhub/view/resources/img/logo.svg` for runtime/packaging) - AppImage build (from `linux_dist/appimage/`): ```bash -export BEARHUB_VERSION=0.10.7-bearhub.6 # release tag to build +export BEARHUB_VERSION=0.10.7-bearhub.7 # next tag after CHANGELOG [Unreleased] is released ./build.sh ``` @@ -530,11 +531,13 @@ It is a separate repository with some files downloaded during runtime. #### Code structure -- `view`: code associated with the graphical interface -- `gems`: code responsible to work with the different packaging technologies (every submodule deals with one or more types) -- `api`: code abstractions representing the main actions that a user can do with Linux packages (search, install, ...). These abstractions are implemented by the `gems`, and -the `view` code is only attached to them (it does not know how the `gems` handle these actions) -- `commons`: common code used by `gems` and `view` +Canonical Python package: **`bearhub/`** (import paths like `bearhub.gems.arch`, `bearhub.view.qt`). + +- `bearhub/view`: graphical interface (`qt`, `core`, `util`) +- `bearhub/gems`: packaging backends (Arch/AUR, Flatpak, AppImage, Web) +- `bearhub/api`: abstractions for package actions (search, install, …); implemented by `gems`, consumed by `view` +- `bearhub/commons`: shared utilities for `gems` and `view` +- `bauh/`: legacy compatibility shims only (`import bauh` still works during migration) #### Roadmap - Support for other packaging technologies diff --git a/ROADMAP.md b/ROADMAP.md index a8881647..f88986d7 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -37,6 +37,8 @@ Definition of Done: ### M3: Namespace Migration (`bauh` -> `bearhub`) (3-5 weeks) +Status (2026-06-27): **~95 % complete** — runtime code native under `bearhub/`; `bauh/` is shim-only; version flip done; full shim removal pending one stable release. See `NAMESPACE_MIGRATION.md` and `CHANGELOG.md` `[Unreleased]`. + Scope: - Migrate Python package namespace from `bauh` to `bearhub`. - Provide temporary import compatibility layer for transition period. @@ -47,6 +49,11 @@ Definition of Done: - Compatibility shim exists and is marked for removal date. - Packaging and tests run successfully with new namespace. +Remaining for M3 closure: +- Ship `[Unreleased]` migration changes as a tagged release (`0.10.7-bearhub.7` or `0.10.8`) +- Validate AUR `bearhub` / `bearhub-git` on real Arch systems +- Remove `bauh/*` shims after one stable cycle (Phase D completion) + ### M4: Backend Governance (2-3 weeks) Scope: @@ -86,7 +93,7 @@ Prerequisites: Scope: - Choose Qt6 binding target: **PySide6** (preferred default: LGPL) or **PyQt6** (if GPL-only strategy is confirmed). -- Migrate `bauh/view/qt/*` and app entry modules to Qt6 APIs. +- Migrate `bearhub/view/qt/*` and app entry modules to Qt6 APIs. - Update themes/QSS validation and tray behavior on Wayland. - Update packaging (AUR deps, AppImage Qt6 bundle, CI GUI smoke checks). @@ -146,7 +153,8 @@ Rollback strategy: ## Immediate Next Actions -1. Close remaining M1 gaps (smoke-test checklist, `NAMESPACE_MIGRATION.md` refresh). -2. Build M2 issue list from current crash reports and prioritize top 3. -3. Continue M3 namespace migration (`gems/` move order + shim removal date). -4. Schedule M6 spike after M3 core move (do not start full Qt6 migration in parallel). +1. Tag release with `CHANGELOG.md` `[Unreleased]` namespace migration entries. +2. Close remaining M1 gaps (smoke-test checklist on real Arch desktop). +3. Build M2 issue list from current crash reports and prioritize top 3. +4. Complete M3 Phase D after one stable release (remove `bauh/*` shims, drop `provides=('bauh')` in AUR). +5. Schedule M6 Qt6 PR-6.2 after M3 tag (namespace stable; do not parallelize full Qt6 migration). diff --git a/bauh/__init__.py b/bauh/__init__.py index ff4a7173..939534c7 100644 --- a/bauh/__init__.py +++ b/bauh/__init__.py @@ -1,5 +1,8 @@ -__version__ = '0.10.7' -__app_name__ = 'bearhub' +""" +Legacy namespace compatibility shim. -import os -ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) +Deprecated: import from `bearhub` instead of `bauh`. +""" +from bearhub import ROOT_DIR, __app_name__, __version__ + +__all__ = ["__app_name__", "__version__", "ROOT_DIR"] \ No newline at end of file diff --git a/bauh/api/__init__.py b/bauh/api/__init__.py new file mode 100644 index 00000000..51a0fc9c --- /dev/null +++ b/bauh/api/__init__.py @@ -0,0 +1 @@ +from bearhub.api import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/api/abstract/__init__.py b/bauh/api/abstract/__init__.py new file mode 100644 index 00000000..cdf9b5ee --- /dev/null +++ b/bauh/api/abstract/__init__.py @@ -0,0 +1 @@ +from bearhub.api.abstract import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/api/abstract/cache.py b/bauh/api/abstract/cache.py new file mode 100644 index 00000000..9aa9b17c --- /dev/null +++ b/bauh/api/abstract/cache.py @@ -0,0 +1 @@ +from bearhub.api.abstract.cache import * # noqa: F401,F403 diff --git a/bauh/api/abstract/context.py b/bauh/api/abstract/context.py new file mode 100644 index 00000000..60fd5797 --- /dev/null +++ b/bauh/api/abstract/context.py @@ -0,0 +1 @@ +from bearhub.api.abstract.context import * # noqa: F401,F403 diff --git a/bauh/api/abstract/controller.py b/bauh/api/abstract/controller.py new file mode 100644 index 00000000..95e42af9 --- /dev/null +++ b/bauh/api/abstract/controller.py @@ -0,0 +1 @@ +from bearhub.api.abstract.controller import * # noqa: F401,F403 diff --git a/bauh/api/abstract/disk.py b/bauh/api/abstract/disk.py new file mode 100644 index 00000000..8c5f66d4 --- /dev/null +++ b/bauh/api/abstract/disk.py @@ -0,0 +1 @@ +from bearhub.api.abstract.disk import * # noqa: F401,F403 diff --git a/bauh/api/abstract/download.py b/bauh/api/abstract/download.py new file mode 100644 index 00000000..e0dd7d54 --- /dev/null +++ b/bauh/api/abstract/download.py @@ -0,0 +1 @@ +from bearhub.api.abstract.download import * # noqa: F401,F403 diff --git a/bauh/api/abstract/handler.py b/bauh/api/abstract/handler.py new file mode 100644 index 00000000..ceb7800d --- /dev/null +++ b/bauh/api/abstract/handler.py @@ -0,0 +1 @@ +from bearhub.api.abstract.handler import * # noqa: F401,F403 diff --git a/bauh/api/abstract/model.py b/bauh/api/abstract/model.py new file mode 100644 index 00000000..bc7ddb4a --- /dev/null +++ b/bauh/api/abstract/model.py @@ -0,0 +1 @@ +from bearhub.api.abstract.model import * # noqa: F401,F403 diff --git a/bauh/api/abstract/view.py b/bauh/api/abstract/view.py new file mode 100644 index 00000000..4bf9993f --- /dev/null +++ b/bauh/api/abstract/view.py @@ -0,0 +1 @@ +from bearhub.api.abstract.view import * # noqa: F401,F403 diff --git a/bauh/api/exception.py b/bauh/api/exception.py new file mode 100644 index 00000000..8f543a1d --- /dev/null +++ b/bauh/api/exception.py @@ -0,0 +1 @@ +from bearhub.api.exception import * # noqa: F401,F403 diff --git a/bauh/api/http.py b/bauh/api/http.py new file mode 100644 index 00000000..8a7be511 --- /dev/null +++ b/bauh/api/http.py @@ -0,0 +1 @@ +from bearhub.api.http import * # noqa: F401,F403 diff --git a/bauh/api/paths.py b/bauh/api/paths.py new file mode 100644 index 00000000..938fa5d7 --- /dev/null +++ b/bauh/api/paths.py @@ -0,0 +1 @@ +from bearhub.api.paths import * # noqa: F401,F403 diff --git a/bauh/api/user.py b/bauh/api/user.py new file mode 100644 index 00000000..a47a5843 --- /dev/null +++ b/bauh/api/user.py @@ -0,0 +1 @@ +from bearhub.api.user import * # noqa: F401,F403 diff --git a/bauh/commons/__init__.py b/bauh/commons/__init__.py new file mode 100644 index 00000000..70a4a17c --- /dev/null +++ b/bauh/commons/__init__.py @@ -0,0 +1 @@ +from bearhub.commons import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/commons/boot.py b/bauh/commons/boot.py new file mode 100644 index 00000000..ac5701c6 --- /dev/null +++ b/bauh/commons/boot.py @@ -0,0 +1 @@ +from bearhub.commons.boot import * # noqa: F401,F403 diff --git a/bauh/commons/category.py b/bauh/commons/category.py new file mode 100644 index 00000000..f947766c --- /dev/null +++ b/bauh/commons/category.py @@ -0,0 +1 @@ +from bearhub.commons.category import * # noqa: F401,F403 diff --git a/bauh/commons/config.py b/bauh/commons/config.py new file mode 100644 index 00000000..c0e6a24c --- /dev/null +++ b/bauh/commons/config.py @@ -0,0 +1 @@ +from bearhub.commons.config import * # noqa: F401,F403 diff --git a/bauh/commons/custom_types.py b/bauh/commons/custom_types.py new file mode 100644 index 00000000..c159d502 --- /dev/null +++ b/bauh/commons/custom_types.py @@ -0,0 +1 @@ +from bearhub.commons.custom_types import * # noqa: F401,F403 diff --git a/bauh/commons/html.py b/bauh/commons/html.py new file mode 100644 index 00000000..13f6443d --- /dev/null +++ b/bauh/commons/html.py @@ -0,0 +1 @@ +from bearhub.commons.html import * # noqa: F401,F403 diff --git a/bauh/commons/internet.py b/bauh/commons/internet.py new file mode 100644 index 00000000..795669c0 --- /dev/null +++ b/bauh/commons/internet.py @@ -0,0 +1 @@ +from bearhub.commons.internet import * # noqa: F401,F403 diff --git a/bauh/commons/regex.py b/bauh/commons/regex.py new file mode 100644 index 00000000..68072d78 --- /dev/null +++ b/bauh/commons/regex.py @@ -0,0 +1 @@ +from bearhub.commons.regex import * # noqa: F401,F403 diff --git a/bauh/commons/resource.py b/bauh/commons/resource.py new file mode 100644 index 00000000..f0ae4f12 --- /dev/null +++ b/bauh/commons/resource.py @@ -0,0 +1 @@ +from bearhub.commons.resource import * # noqa: F401,F403 diff --git a/bauh/commons/singleton.py b/bauh/commons/singleton.py new file mode 100644 index 00000000..0b638468 --- /dev/null +++ b/bauh/commons/singleton.py @@ -0,0 +1 @@ +from bearhub.commons.singleton import * # noqa: F401,F403 diff --git a/bauh/commons/suggestions.py b/bauh/commons/suggestions.py new file mode 100644 index 00000000..bdfb8f47 --- /dev/null +++ b/bauh/commons/suggestions.py @@ -0,0 +1 @@ +from bearhub.commons.suggestions import * # noqa: F401,F403 diff --git a/bauh/commons/system.py b/bauh/commons/system.py new file mode 100644 index 00000000..cc634cad --- /dev/null +++ b/bauh/commons/system.py @@ -0,0 +1 @@ +from bearhub.commons.system import * # noqa: F401,F403 diff --git a/bauh/commons/util.py b/bauh/commons/util.py new file mode 100644 index 00000000..3dfda29d --- /dev/null +++ b/bauh/commons/util.py @@ -0,0 +1 @@ +from bearhub.commons.util import * # noqa: F401,F403 diff --git a/bauh/commons/version_util.py b/bauh/commons/version_util.py new file mode 100644 index 00000000..dd7a0c9f --- /dev/null +++ b/bauh/commons/version_util.py @@ -0,0 +1 @@ +from bearhub.commons.version_util import * # noqa: F401,F403 diff --git a/bauh/commons/view_utils.py b/bauh/commons/view_utils.py new file mode 100644 index 00000000..127618eb --- /dev/null +++ b/bauh/commons/view_utils.py @@ -0,0 +1 @@ +from bearhub.commons.view_utils import * # noqa: F401,F403 diff --git a/bauh/gems/appimage/__init__.py b/bauh/gems/appimage/__init__.py new file mode 100644 index 00000000..1a9ea3dc --- /dev/null +++ b/bauh/gems/appimage/__init__.py @@ -0,0 +1 @@ +from bearhub.gems.appimage import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/appimage/config.py b/bauh/gems/appimage/config.py new file mode 100644 index 00000000..0a476c36 --- /dev/null +++ b/bauh/gems/appimage/config.py @@ -0,0 +1 @@ +from bearhub.gems.appimage.config import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py new file mode 100644 index 00000000..281f97bb --- /dev/null +++ b/bauh/gems/appimage/controller.py @@ -0,0 +1 @@ +from bearhub.gems.appimage.controller import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/appimage/model.py b/bauh/gems/appimage/model.py new file mode 100644 index 00000000..d72fadd9 --- /dev/null +++ b/bauh/gems/appimage/model.py @@ -0,0 +1 @@ +from bearhub.gems.appimage.model import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/appimage/query.py b/bauh/gems/appimage/query.py new file mode 100644 index 00000000..008978f9 --- /dev/null +++ b/bauh/gems/appimage/query.py @@ -0,0 +1 @@ +from bearhub.gems.appimage.query import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/appimage/util.py b/bauh/gems/appimage/util.py new file mode 100644 index 00000000..0b52616a --- /dev/null +++ b/bauh/gems/appimage/util.py @@ -0,0 +1 @@ +from bearhub.gems.appimage.util import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/appimage/worker.py b/bauh/gems/appimage/worker.py new file mode 100644 index 00000000..4625bdc9 --- /dev/null +++ b/bauh/gems/appimage/worker.py @@ -0,0 +1 @@ +from bearhub.gems.appimage.worker import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py new file mode 100644 index 00000000..ac535edd --- /dev/null +++ b/bauh/gems/arch/__init__.py @@ -0,0 +1 @@ +from bearhub.gems.arch.__init__ import * # noqa: F401,F403 diff --git a/bauh/gems/arch/aur.py b/bauh/gems/arch/aur.py new file mode 100644 index 00000000..d2c892a3 --- /dev/null +++ b/bauh/gems/arch/aur.py @@ -0,0 +1 @@ +from bearhub.gems.arch.aur import * # noqa: F401,F403 diff --git a/bauh/gems/arch/config.py b/bauh/gems/arch/config.py new file mode 100644 index 00000000..da18672b --- /dev/null +++ b/bauh/gems/arch/config.py @@ -0,0 +1 @@ +from bearhub.gems.arch.config import * # noqa: F401,F403 diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py new file mode 100644 index 00000000..47234791 --- /dev/null +++ b/bauh/gems/arch/confirmation.py @@ -0,0 +1 @@ +from bearhub.gems.arch.confirmation import * # noqa: F401,F403 diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py new file mode 100644 index 00000000..d65c2a5d --- /dev/null +++ b/bauh/gems/arch/controller.py @@ -0,0 +1 @@ +from bearhub.gems.arch.controller import * # noqa: F401,F403 diff --git a/bauh/gems/arch/cpu_manager.py b/bauh/gems/arch/cpu_manager.py new file mode 100644 index 00000000..4388b4ca --- /dev/null +++ b/bauh/gems/arch/cpu_manager.py @@ -0,0 +1 @@ +from bearhub.gems.arch.cpu_manager import * # noqa: F401,F403 diff --git a/bauh/gems/arch/database.py b/bauh/gems/arch/database.py new file mode 100644 index 00000000..79da08d4 --- /dev/null +++ b/bauh/gems/arch/database.py @@ -0,0 +1 @@ +from bearhub.gems.arch.database import * # noqa: F401,F403 diff --git a/bauh/gems/arch/dependencies.py b/bauh/gems/arch/dependencies.py new file mode 100644 index 00000000..6245acc0 --- /dev/null +++ b/bauh/gems/arch/dependencies.py @@ -0,0 +1 @@ +from bearhub.gems.arch.dependencies import * # noqa: F401,F403 diff --git a/bauh/gems/arch/disk.py b/bauh/gems/arch/disk.py new file mode 100644 index 00000000..ab1a244e --- /dev/null +++ b/bauh/gems/arch/disk.py @@ -0,0 +1 @@ +from bearhub.gems.arch.disk import * # noqa: F401,F403 diff --git a/bauh/gems/arch/download.py b/bauh/gems/arch/download.py new file mode 100644 index 00000000..bc4cb045 --- /dev/null +++ b/bauh/gems/arch/download.py @@ -0,0 +1 @@ +from bearhub.gems.arch.download import * # noqa: F401,F403 diff --git a/bauh/gems/arch/exceptions.py b/bauh/gems/arch/exceptions.py new file mode 100644 index 00000000..ceebcd4d --- /dev/null +++ b/bauh/gems/arch/exceptions.py @@ -0,0 +1 @@ +from bearhub.gems.arch.exceptions import * # noqa: F401,F403 diff --git a/bauh/gems/arch/git.py b/bauh/gems/arch/git.py new file mode 100644 index 00000000..4cb4daa6 --- /dev/null +++ b/bauh/gems/arch/git.py @@ -0,0 +1 @@ +from bearhub.gems.arch.git import * # noqa: F401,F403 diff --git a/bauh/gems/arch/gpg.py b/bauh/gems/arch/gpg.py new file mode 100644 index 00000000..33d2c8ea --- /dev/null +++ b/bauh/gems/arch/gpg.py @@ -0,0 +1 @@ +from bearhub.gems.arch.gpg import * # noqa: F401,F403 diff --git a/bauh/gems/arch/makepkg.py b/bauh/gems/arch/makepkg.py new file mode 100644 index 00000000..03bedd56 --- /dev/null +++ b/bauh/gems/arch/makepkg.py @@ -0,0 +1 @@ +from bearhub.gems.arch.makepkg import * # noqa: F401,F403 diff --git a/bauh/gems/arch/mapper.py b/bauh/gems/arch/mapper.py new file mode 100644 index 00000000..2f65184a --- /dev/null +++ b/bauh/gems/arch/mapper.py @@ -0,0 +1 @@ +from bearhub.gems.arch.mapper import * # noqa: F401,F403 diff --git a/bauh/gems/arch/message.py b/bauh/gems/arch/message.py new file mode 100644 index 00000000..2b136ca8 --- /dev/null +++ b/bauh/gems/arch/message.py @@ -0,0 +1 @@ +from bearhub.gems.arch.message import * # noqa: F401,F403 diff --git a/bauh/gems/arch/mirrors.py b/bauh/gems/arch/mirrors.py new file mode 100644 index 00000000..29214d42 --- /dev/null +++ b/bauh/gems/arch/mirrors.py @@ -0,0 +1 @@ +from bearhub.gems.arch.mirrors import * # noqa: F401,F403 diff --git a/bauh/gems/arch/model.py b/bauh/gems/arch/model.py new file mode 100644 index 00000000..a1e9610b --- /dev/null +++ b/bauh/gems/arch/model.py @@ -0,0 +1 @@ +from bearhub.gems.arch.model import * # noqa: F401,F403 diff --git a/bauh/gems/arch/output.py b/bauh/gems/arch/output.py new file mode 100644 index 00000000..46d5dbd2 --- /dev/null +++ b/bauh/gems/arch/output.py @@ -0,0 +1 @@ +from bearhub.gems.arch.output import * # noqa: F401,F403 diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py new file mode 100644 index 00000000..a41f9c69 --- /dev/null +++ b/bauh/gems/arch/pacman.py @@ -0,0 +1 @@ +from bearhub.gems.arch.pacman import * # noqa: F401,F403 diff --git a/bauh/gems/arch/pkgbuild.py b/bauh/gems/arch/pkgbuild.py new file mode 100644 index 00000000..e4b1f7d5 --- /dev/null +++ b/bauh/gems/arch/pkgbuild.py @@ -0,0 +1 @@ +from bearhub.gems.arch.pkgbuild import * # noqa: F401,F403 diff --git a/bauh/gems/arch/proc_util.py b/bauh/gems/arch/proc_util.py new file mode 100644 index 00000000..9d66e7a9 --- /dev/null +++ b/bauh/gems/arch/proc_util.py @@ -0,0 +1 @@ +from bearhub.gems.arch.proc_util import * # noqa: F401,F403 diff --git a/bauh/gems/arch/rebuild_detector.py b/bauh/gems/arch/rebuild_detector.py new file mode 100644 index 00000000..7a2dea84 --- /dev/null +++ b/bauh/gems/arch/rebuild_detector.py @@ -0,0 +1 @@ +from bearhub.gems.arch.rebuild_detector import * # noqa: F401,F403 diff --git a/bauh/gems/arch/sorting.py b/bauh/gems/arch/sorting.py new file mode 100644 index 00000000..4463aff0 --- /dev/null +++ b/bauh/gems/arch/sorting.py @@ -0,0 +1 @@ +from bearhub.gems.arch.sorting import * # noqa: F401,F403 diff --git a/bauh/gems/arch/sshell.py b/bauh/gems/arch/sshell.py new file mode 100644 index 00000000..3f6c6e64 --- /dev/null +++ b/bauh/gems/arch/sshell.py @@ -0,0 +1 @@ +from bearhub.gems.arch.sshell import * # noqa: F401,F403 diff --git a/bauh/gems/arch/suggestions.py b/bauh/gems/arch/suggestions.py new file mode 100644 index 00000000..92d3ce56 --- /dev/null +++ b/bauh/gems/arch/suggestions.py @@ -0,0 +1 @@ +from bearhub.gems.arch.suggestions import * # noqa: F401,F403 diff --git a/bauh/gems/arch/updates.py b/bauh/gems/arch/updates.py new file mode 100644 index 00000000..6c37ca79 --- /dev/null +++ b/bauh/gems/arch/updates.py @@ -0,0 +1 @@ +from bearhub.gems.arch.updates import * # noqa: F401,F403 diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py new file mode 100644 index 00000000..70286d1e --- /dev/null +++ b/bauh/gems/arch/worker.py @@ -0,0 +1 @@ +from bearhub.gems.arch.worker import * # noqa: F401,F403 diff --git a/bauh/gems/flatpak/__init__.py b/bauh/gems/flatpak/__init__.py new file mode 100644 index 00000000..a0b99454 --- /dev/null +++ b/bauh/gems/flatpak/__init__.py @@ -0,0 +1 @@ +from bearhub.gems.flatpak import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/flatpak/config.py b/bauh/gems/flatpak/config.py new file mode 100644 index 00000000..b3446e6c --- /dev/null +++ b/bauh/gems/flatpak/config.py @@ -0,0 +1 @@ +from bearhub.gems.flatpak.config import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/flatpak/constants.py b/bauh/gems/flatpak/constants.py new file mode 100644 index 00000000..7394c6d4 --- /dev/null +++ b/bauh/gems/flatpak/constants.py @@ -0,0 +1 @@ +from bearhub.gems.flatpak.constants import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/flatpak/controller.py b/bauh/gems/flatpak/controller.py new file mode 100644 index 00000000..7c035d1b --- /dev/null +++ b/bauh/gems/flatpak/controller.py @@ -0,0 +1 @@ +from bearhub.gems.flatpak.controller import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/flatpak/flatpak.py b/bauh/gems/flatpak/flatpak.py new file mode 100644 index 00000000..fa67a6b4 --- /dev/null +++ b/bauh/gems/flatpak/flatpak.py @@ -0,0 +1 @@ +from bearhub.gems.flatpak.flatpak import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/flatpak/model.py b/bauh/gems/flatpak/model.py new file mode 100644 index 00000000..35fe8b77 --- /dev/null +++ b/bauh/gems/flatpak/model.py @@ -0,0 +1 @@ +from bearhub.gems.flatpak.model import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/flatpak/worker.py b/bauh/gems/flatpak/worker.py new file mode 100644 index 00000000..4048c801 --- /dev/null +++ b/bauh/gems/flatpak/worker.py @@ -0,0 +1 @@ +from bearhub.gems.flatpak.worker import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/__init__.py b/bauh/gems/web/__init__.py new file mode 100644 index 00000000..165db98a --- /dev/null +++ b/bauh/gems/web/__init__.py @@ -0,0 +1 @@ +from bearhub.gems.web import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/config.py b/bauh/gems/web/config.py new file mode 100644 index 00000000..0e91bba1 --- /dev/null +++ b/bauh/gems/web/config.py @@ -0,0 +1 @@ +from bearhub.gems.web.config import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py new file mode 100644 index 00000000..d38a3226 --- /dev/null +++ b/bauh/gems/web/controller.py @@ -0,0 +1 @@ +from bearhub.gems.web.controller import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/environment.py b/bauh/gems/web/environment.py new file mode 100644 index 00000000..910b604f --- /dev/null +++ b/bauh/gems/web/environment.py @@ -0,0 +1 @@ +from bearhub.gems.web.environment import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/model.py b/bauh/gems/web/model.py new file mode 100644 index 00000000..1b37bc2e --- /dev/null +++ b/bauh/gems/web/model.py @@ -0,0 +1 @@ +from bearhub.gems.web.model import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/nativefier.py b/bauh/gems/web/nativefier.py new file mode 100644 index 00000000..8448bf00 --- /dev/null +++ b/bauh/gems/web/nativefier.py @@ -0,0 +1 @@ +from bearhub.gems.web.nativefier import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/search.py b/bauh/gems/web/search.py new file mode 100644 index 00000000..75137c97 --- /dev/null +++ b/bauh/gems/web/search.py @@ -0,0 +1 @@ +from bearhub.gems.web.search import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/suggestions.py b/bauh/gems/web/suggestions.py new file mode 100644 index 00000000..c41f1924 --- /dev/null +++ b/bauh/gems/web/suggestions.py @@ -0,0 +1 @@ +from bearhub.gems.web.suggestions import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/gems/web/worker.py b/bauh/gems/web/worker.py new file mode 100644 index 00000000..3577cf40 --- /dev/null +++ b/bauh/gems/web/worker.py @@ -0,0 +1 @@ +from bearhub.gems.web.worker import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/stylesheet.py b/bauh/stylesheet.py index 37584c6e..5aa5c0e5 100644 --- a/bauh/stylesheet.py +++ b/bauh/stylesheet.py @@ -1,258 +1 @@ -import glob -import os -import re -from typing import Optional, Dict, Tuple, Set - -from bauh.api.paths import USER_THEMES_DIR -from bauh.view.util import resource -from bauh.view.util.translation import I18n - -# RE_WIDTH_PERCENT = re.compile(r'[\d\\.]+%w') TODO percentage measures disabled for the moment (requires more testing) -# RE_HEIGHT_PERCENT = re.compile(r'[\d\\.]+%h') TODO percentage measures disabled for the moment (requires more testing) -RE_META_I18N_FIELDS = re.compile(r'((name|description)(\[\w+])?)') -RE_VAR_PATTERN = re.compile(r'^@[\w.\-_]+') -RE_QSS_EXT = re.compile(r'\.qss$') - - -class ThemeMetadata: - - def __init__(self, file_path: str, default: bool, default_name: Optional[str] = None, - default_description: Optional[str] = None, version: Optional[str] = None, - root_theme: Optional[str] = None, abstract: bool = False): - self.names = {} - self.default_name = default_name - self.descriptions = {} - self.default_description = default_description - self.root_theme = root_theme - self.version = version - self.file_path = file_path - self.file_dir = '/'.join(file_path.split('/')[0:-1]) - self.default = default - self.key = self.file_path.split('/')[-1].split('.')[0] if self.default else self.file_path - self.abstract = abstract - - def __eq__(self, other) -> bool: - if isinstance(other, ThemeMetadata): - return self.file_path == other.file_path - - return False - - def __hash__(self): - return self.file_path.__hash__() - - def __repr__(self): - return self.file_path if self.file_path else '' - - def get_i18n_name(self, i18n: I18n) -> str: - if self.names: - name = self.names.get(i18n.current_key, self.names.get(i18n.default_key)) - - if name: - return name - - if self.default_name: - return self.default_name - else: - return self.file_path.split('/')[-1] - - def get_i18n_description(self, i18n: I18n) -> Optional[str]: - if self.descriptions: - des = self.descriptions.get(i18n.current_key, self.descriptions.get(i18n.default_key)) - - if des: - return des - - return self.default_description - - -def read_theme_metada(key: str, file_path: str) -> ThemeMetadata: - meta_file = RE_QSS_EXT.sub('.meta', file_path) - meta_obj = ThemeMetadata(file_path=file_path, default_name=key, default=not key.startswith('/')) - - if os.path.exists(meta_file): - meta_dict = {} - with open(meta_file) as f: - for line in f.readlines(): - if line: - field_split = line.split('=') - - if len(field_split) > 1: - meta_dict[field_split[0].strip()] = field_split[1].strip() - - if meta_dict: - for field, val in meta_dict.items(): - if field == 'version': - meta_obj.version = val - elif field == 'root_theme': - meta_obj.root_theme = val - elif field == 'name': - meta_obj.default_name = val - elif field == 'description': - meta_obj.default_description = val - elif field == 'abstract': - boolean = val.lower() - - if boolean == 'true': - meta_obj.abstract = True - elif boolean == 'false': - meta_obj.abstract = False - - else: - i18n_field = RE_META_I18N_FIELDS.findall(field) - - if i18n_field: - if i18n_field[0][1] == 'name': - meta_obj.names[i18n_field[0][2][1:-1]] = val - else: - meta_obj.descriptions[i18n_field[0][2][1:-1]] = val - - return meta_obj - - -def read_default_themes() -> Dict[str, str]: - return {f.split('/')[-1].split('.')[0].lower(): f for f in glob.glob(resource.get_path('style/**/*.qss'))} - - -def read_user_themes() -> Dict[str, str]: - return {f: f for f in glob.glob('{}/**/*.qss'.format(USER_THEMES_DIR), recursive=True)} - - -def read_all_themes_metadata() -> Set[ThemeMetadata]: - themes = set() - - for key, file_path in read_default_themes().items(): - themes.add(read_theme_metada(key=key, file_path=file_path)) - - for key, file_path in read_user_themes().items(): - themes.add(read_theme_metada(key=key, file_path=file_path)) - - return themes - - -def process_theme(file_path: str, theme_str: str, metadata: ThemeMetadata, - available_themes: Optional[Dict[str, str]]) -> Optional[Tuple[str, ThemeMetadata]]: - if theme_str and metadata: - root_theme = None - if metadata.root_theme and metadata.root_theme in available_themes: - root_file = available_themes[metadata.root_theme] - - if os.path.isfile(root_file): - with open(root_file) as f: - root_theme_str = f.read() - - if root_theme_str: - root_metadata = read_theme_metada(key=metadata.root_theme, file_path=root_file) - root_theme = process_theme(file_path=root_file, - theme_str=root_theme_str, - metadata=root_metadata, - available_themes=available_themes) - - var_map = _read_var_file(file_path) - var_map['images'] = resource.get_path('img') - var_map['style_dir'] = metadata.file_dir - - if var_map: - var_list = [*var_map.keys()] - var_list.sort(key=_by_str_len, reverse=True) - - for var in var_list: - theme_str = theme_str.replace('@' + var, var_map[var]) - - # TODO percentage measures disabled for the moment (requires more testing) - # screen_size = QApplication.primaryScreen().size() - # theme_str = process_width_percent_measures(theme_str, screen_size.width()) - # theme_str = process_height_percent_measures(theme_str, screen_size.height()) - - return theme_str if not root_theme else '{}\n{}'.format(root_theme[0], theme_str), metadata - - -def _by_str_len(string: str) -> int: - return len(string) - - -def _read_var_file(theme_file: str) -> dict: - vars_file = theme_file.replace('.qss', '.vars') - var_map = {} - - if os.path.isfile(vars_file): - with open(vars_file) as f: - for line in f.readlines(): - if line: - line_strip = line.strip() - if line_strip: - var_value = line_strip.split('=') - - if var_value and len(var_value) == 2: - var, value = var_value[0].strip(), var_value[1].strip() - - if var and value: - var_map[var] = value - - if var_map: - process_var_of_vars(var_map) # mapping keys that point to others - - return var_map - - -def process_var_of_vars(var_map: dict): - while True: - pending_vars, invalid = {}, set() - - for k, v in var_map.items(): - var_match = RE_VAR_PATTERN.match(v) - - if var_match: - var_name = var_match.group()[1:] - if var_name not in var_map or var_name == k: - invalid.add(k) - else: - pending_vars[k] = var_name - - for key in invalid: - del var_map[key] - - if not pending_vars: - break - - resolved = 0 - - for key, val in pending_vars.items(): - real_val = var_map[val] - - if not RE_VAR_PATTERN.match(real_val): - var_map[key] = real_val - resolved += 1 - - if resolved == len(pending_vars): - break - - -# TODO percentage measures disabled for the moment (requires more testing) -# def process_width_percent_measures(theme: str, screen_width: int) -> str: -# width_measures = RE_WIDTH_PERCENT.findall(theme) -# -# final_theme = theme -# if width_measures: -# for m in width_measures: -# try: -# percent = float(m.split('%')[0]) -# final_theme = final_theme.replace(m, '{}px'.format(round(screen_width * percent))) -# except ValueError: -# traceback.print_exc() -# -# return final_theme - - -# def process_height_percent_measures(theme: str, screen_height: int) -> str: -# width_measures = RE_HEIGHT_PERCENT.findall(theme) -# -# final_sheet = theme -# if width_measures: -# for m in width_measures: -# try: -# percent = float(m.split('%')[0]) -# final_sheet = final_sheet.replace(m, '{}px'.format(round(screen_height * percent))) -# except ValueError: -# traceback.print_exc() -# -# return final_sheet +from bearhub.stylesheet import * # noqa: F401,F403 \ No newline at end of file diff --git a/bauh/view/core/__init__.py b/bauh/view/core/__init__.py old mode 100755 new mode 100644 index e69de29b..a16b3359 --- a/bauh/view/core/__init__.py +++ b/bauh/view/core/__init__.py @@ -0,0 +1 @@ +from bearhub.view.core import * # noqa: F401,F403 diff --git a/bauh/view/core/controller.py b/bauh/view/core/controller.py new file mode 100644 index 00000000..e8aa2c69 --- /dev/null +++ b/bauh/view/core/controller.py @@ -0,0 +1 @@ +from bearhub.view.core.controller import * # noqa: F401,F403 diff --git a/bauh/view/core/downloader.py b/bauh/view/core/downloader.py new file mode 100644 index 00000000..3f155ff8 --- /dev/null +++ b/bauh/view/core/downloader.py @@ -0,0 +1 @@ +from bearhub.view.core.downloader import * # noqa: F401,F403 diff --git a/bauh/view/core/gems.py b/bauh/view/core/gems.py index 493ef140..81f123a6 100644 --- a/bauh/view/core/gems.py +++ b/bauh/view/core/gems.py @@ -1,81 +1 @@ -import inspect -import importlib -import os -from logging import Logger -from typing import List, Generator - -from bauh import __app_name__, ROOT_DIR -from bauh.api.abstract.controller import SoftwareManager, ApplicationContext -from bauh.view.util import translation - -FORBIDDEN_GEMS_FILE = f'/etc/{__app_name__}/gems.forbidden' - - -def find_manager(member): - if not isinstance(member, str): - if inspect.isclass(member) and inspect.getmro(member)[1].__name__ == 'SoftwareManager': - return member - elif inspect.ismodule(member): - for name, mod in inspect.getmembers(member): - manager_found = find_manager(mod) - if manager_found: - return manager_found - - -def read_forbidden_gems() -> Generator[str, None, None]: - try: - with open(FORBIDDEN_GEMS_FILE) as f: - forbidden_lines = f.readlines() - - for line in forbidden_lines: - clean_line = line.strip() - - if clean_line and not clean_line.startswith('#'): - yield clean_line - - except FileNotFoundError: - pass - - -def load_managers(locale: str, context: ApplicationContext, config: dict, default_locale: str, logger: Logger) -> List[SoftwareManager]: - managers = [] - - forbidden_gems = {gem for gem in read_forbidden_gems()} - - for f in os.scandir(f'{ROOT_DIR}/gems'): - if f.is_dir() and f.name != '__pycache__': - - if f.name in forbidden_gems: - logger.warning(f"gem '{f.name}' could not be loaded because it was marked as forbidden in '{FORBIDDEN_GEMS_FILE}'") - continue - - module_name = f'bauh.gems.{f.name}.controller' - - try: - module = importlib.import_module(module_name) - except ModuleNotFoundError: - module = None - - if module: - manager_class = find_manager(module) - - if manager_class: - if locale: - locale_path = f'{f.path}/resources/locale' - - if os.path.exists(locale_path): - context.i18n.current.update(translation.get_locale_keys(locale, locale_path)[1]) - - if default_locale and context.i18n.default: - context.i18n.default.update(translation.get_locale_keys(default_locale, locale_path)[1]) - - man = manager_class(context=context) - - if config['gems'] is None: - man.set_enabled(man.is_default_enabled()) - else: - man.set_enabled(f.name in config['gems']) - - managers.append(man) - - return managers +from bearhub.view.core.gems import * # noqa: F401,F403 diff --git a/bauh/view/core/settings.py b/bauh/view/core/settings.py new file mode 100644 index 00000000..fd3743c8 --- /dev/null +++ b/bauh/view/core/settings.py @@ -0,0 +1 @@ +from bearhub.view.core.settings import * # noqa: F401,F403 diff --git a/bauh/view/core/suggestions.py b/bauh/view/core/suggestions.py new file mode 100644 index 00000000..ca6c451c --- /dev/null +++ b/bauh/view/core/suggestions.py @@ -0,0 +1 @@ +from bearhub.view.core.suggestions import * # noqa: F401,F403 diff --git a/bauh/view/core/timeshift.py b/bauh/view/core/timeshift.py new file mode 100644 index 00000000..277a56a2 --- /dev/null +++ b/bauh/view/core/timeshift.py @@ -0,0 +1 @@ +from bearhub.view.core.timeshift import * # noqa: F401,F403 diff --git a/bauh/view/core/tray_client.py b/bauh/view/core/tray_client.py new file mode 100644 index 00000000..bd8b3964 --- /dev/null +++ b/bauh/view/core/tray_client.py @@ -0,0 +1 @@ +from bearhub.view.core.tray_client import * # noqa: F401,F403 diff --git a/bauh/view/core/update.py b/bauh/view/core/update.py new file mode 100644 index 00000000..ddb31915 --- /dev/null +++ b/bauh/view/core/update.py @@ -0,0 +1 @@ +from bearhub.view.core.update import * # noqa: F401,F403 diff --git a/bauh/view/qt/__init__.py b/bauh/view/qt/__init__.py new file mode 100644 index 00000000..e30fdb8c --- /dev/null +++ b/bauh/view/qt/__init__.py @@ -0,0 +1 @@ +from bearhub.view.qt import * # noqa: F401,F403 diff --git a/bauh/view/qt/about.py b/bauh/view/qt/about.py new file mode 100644 index 00000000..e55932f8 --- /dev/null +++ b/bauh/view/qt/about.py @@ -0,0 +1 @@ +from bearhub.view.qt.about import * # noqa: F401,F403 diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py new file mode 100644 index 00000000..8d9a9866 --- /dev/null +++ b/bauh/view/qt/apps_table.py @@ -0,0 +1 @@ +from bearhub.view.qt.apps_table import * # noqa: F401,F403 diff --git a/bauh/view/qt/commons.py b/bauh/view/qt/commons.py new file mode 100644 index 00000000..8d74ccc4 --- /dev/null +++ b/bauh/view/qt/commons.py @@ -0,0 +1 @@ +from bearhub.view.qt.commons import * # noqa: F401,F403 diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py new file mode 100644 index 00000000..d9859041 --- /dev/null +++ b/bauh/view/qt/components.py @@ -0,0 +1 @@ +from bearhub.view.qt.components import * # noqa: F401,F403 diff --git a/bauh/view/qt/dialog.py b/bauh/view/qt/dialog.py new file mode 100644 index 00000000..a0ff7fdb --- /dev/null +++ b/bauh/view/qt/dialog.py @@ -0,0 +1 @@ +from bearhub.view.qt.dialog import * # noqa: F401,F403 diff --git a/bauh/view/qt/history.py b/bauh/view/qt/history.py new file mode 100644 index 00000000..6054e4da --- /dev/null +++ b/bauh/view/qt/history.py @@ -0,0 +1 @@ +from bearhub.view.qt.history import * # noqa: F401,F403 diff --git a/bauh/view/qt/info.py b/bauh/view/qt/info.py new file mode 100644 index 00000000..ba0d1b26 --- /dev/null +++ b/bauh/view/qt/info.py @@ -0,0 +1 @@ +from bearhub.view.qt.info import * # noqa: F401,F403 diff --git a/bauh/view/qt/prepare.py b/bauh/view/qt/prepare.py new file mode 100644 index 00000000..97ef6276 --- /dev/null +++ b/bauh/view/qt/prepare.py @@ -0,0 +1 @@ +from bearhub.view.qt.prepare import * # noqa: F401,F403 diff --git a/bauh/view/qt/qt_utils.py b/bauh/view/qt/qt_utils.py new file mode 100644 index 00000000..8712f3fc --- /dev/null +++ b/bauh/view/qt/qt_utils.py @@ -0,0 +1 @@ +from bearhub.view.qt.qt_utils import * # noqa: F401,F403 diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py new file mode 100644 index 00000000..3bcbd949 --- /dev/null +++ b/bauh/view/qt/root.py @@ -0,0 +1 @@ +from bearhub.view.qt.root import * # noqa: F401,F403 diff --git a/bauh/view/qt/screenshots.py b/bauh/view/qt/screenshots.py new file mode 100644 index 00000000..75214062 --- /dev/null +++ b/bauh/view/qt/screenshots.py @@ -0,0 +1 @@ +from bearhub.view.qt.screenshots import * # noqa: F401,F403 diff --git a/bauh/view/qt/settings.py b/bauh/view/qt/settings.py new file mode 100644 index 00000000..2229cc12 --- /dev/null +++ b/bauh/view/qt/settings.py @@ -0,0 +1 @@ +from bearhub.view.qt.settings import * # noqa: F401,F403 diff --git a/bauh/view/qt/systray.py b/bauh/view/qt/systray.py new file mode 100644 index 00000000..411dc38f --- /dev/null +++ b/bauh/view/qt/systray.py @@ -0,0 +1 @@ +from bearhub.view.qt.systray import * # noqa: F401,F403 diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py new file mode 100644 index 00000000..0767876d --- /dev/null +++ b/bauh/view/qt/thread.py @@ -0,0 +1 @@ +from bearhub.view.qt.thread import * # noqa: F401,F403 diff --git a/bauh/view/qt/view_index.py b/bauh/view/qt/view_index.py new file mode 100644 index 00000000..00c8d788 --- /dev/null +++ b/bauh/view/qt/view_index.py @@ -0,0 +1 @@ +from bearhub.view.qt.view_index import * # noqa: F401,F403 diff --git a/bauh/view/qt/view_model.py b/bauh/view/qt/view_model.py new file mode 100644 index 00000000..cf866019 --- /dev/null +++ b/bauh/view/qt/view_model.py @@ -0,0 +1 @@ +from bearhub.view.qt.view_model import * # noqa: F401,F403 diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py new file mode 100644 index 00000000..f7892de1 --- /dev/null +++ b/bauh/view/qt/window.py @@ -0,0 +1 @@ +from bearhub.view.qt.window import * # noqa: F401,F403 diff --git a/bauh/view/util/__init__.py b/bauh/view/util/__init__.py new file mode 100644 index 00000000..b1167ddd --- /dev/null +++ b/bauh/view/util/__init__.py @@ -0,0 +1 @@ +from bearhub.view.util import * # noqa: F401,F403 diff --git a/bauh/view/util/cache.py b/bauh/view/util/cache.py new file mode 100644 index 00000000..762dd8af --- /dev/null +++ b/bauh/view/util/cache.py @@ -0,0 +1 @@ +from bearhub.view.util.cache import * # noqa: F401,F403 diff --git a/bauh/view/util/disk.py b/bauh/view/util/disk.py new file mode 100644 index 00000000..6aeaec63 --- /dev/null +++ b/bauh/view/util/disk.py @@ -0,0 +1 @@ +from bearhub.view.util.disk import * # noqa: F401,F403 diff --git a/bauh/view/util/logs.py b/bauh/view/util/logs.py new file mode 100644 index 00000000..ffa76cb1 --- /dev/null +++ b/bauh/view/util/logs.py @@ -0,0 +1 @@ +from bearhub.view.util.logs import * # noqa: F401,F403 diff --git a/bauh/view/util/resource.py b/bauh/view/util/resource.py new file mode 100644 index 00000000..6ed1a3b2 --- /dev/null +++ b/bauh/view/util/resource.py @@ -0,0 +1 @@ +from bearhub.view.util.resource import * # noqa: F401,F403 diff --git a/bauh/view/util/translation.py b/bauh/view/util/translation.py new file mode 100644 index 00000000..e23859c6 --- /dev/null +++ b/bauh/view/util/translation.py @@ -0,0 +1 @@ +from bearhub.view.util.translation import * # noqa: F401,F403 diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py new file mode 100644 index 00000000..79e4e300 --- /dev/null +++ b/bauh/view/util/util.py @@ -0,0 +1 @@ +from bearhub.view.util.util import * # noqa: F401,F403 diff --git a/bearhub/__init__.py b/bearhub/__init__.py index ecbb5a43..19c00190 100644 --- a/bearhub/__init__.py +++ b/bearhub/__init__.py @@ -1,11 +1,8 @@ import os -try: - from bauh import __app_name__, __version__ -except ModuleNotFoundError: - __app_name__ = "bearhub" - __version__ = "0.10.7" +__version__ = '0.10.7' +__app_name__ = 'bearhub' ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) -__all__ = ["__app_name__", "__version__", "ROOT_DIR"] +__all__ = ["__app_name__", "__version__", "ROOT_DIR"] \ No newline at end of file diff --git a/bearhub/api/abstract/context.py b/bearhub/api/abstract/context.py index 3fe3f901..f0b463f0 100644 --- a/bearhub/api/abstract/context.py +++ b/bearhub/api/abstract/context.py @@ -2,12 +2,12 @@ import logging import sys from typing import Optional, Dict -from bauh.api.abstract.cache import MemoryCacheFactory -from bauh.api.abstract.disk import DiskCacheLoaderFactory -from bauh.api.abstract.download import FileDownloader -from bauh.api.http import HttpClient -from bauh.commons.internet import InternetChecker -from bauh.view.util.translation import I18n +from bearhub.api.abstract.cache import MemoryCacheFactory +from bearhub.api.abstract.disk import DiskCacheLoaderFactory +from bearhub.api.abstract.download import FileDownloader +from bearhub.api.http import HttpClient +from bearhub.commons.internet import InternetChecker +from bearhub.view.util.translation import I18n class ApplicationContext: diff --git a/bearhub/api/abstract/controller.py b/bearhub/api/abstract/controller.py index 9f9b716c..e5a1a158 100644 --- a/bearhub/api/abstract/controller.py +++ b/bearhub/api/abstract/controller.py @@ -8,12 +8,12 @@ from typing import List, Set, Type, Tuple, Optional, Generator, TypeVar import yaml -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.disk import DiskCacheLoader -from bauh.api.abstract.handler import ProcessWatcher, TaskManager -from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, \ +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.disk import DiskCacheLoader +from bearhub.api.abstract.handler import ProcessWatcher, TaskManager +from bearhub.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, \ CustomSoftwareAction -from bauh.api.abstract.view import ViewComponent +from bearhub.api.abstract.view import ViewComponent P = TypeVar('P', bound=SoftwarePackage) diff --git a/bearhub/api/abstract/disk.py b/bearhub/api/abstract/disk.py index bcac5792..b84a0f46 100644 --- a/bearhub/api/abstract/disk.py +++ b/bearhub/api/abstract/disk.py @@ -1,8 +1,8 @@ from abc import ABC, abstractmethod from typing import Type, Optional, Any, Dict -from bauh.api.abstract.cache import MemoryCache -from bauh.api.abstract.model import SoftwarePackage +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.abstract.model import SoftwarePackage class DiskCacheLoader: diff --git a/bearhub/api/abstract/download.py b/bearhub/api/abstract/download.py index 1eef87d4..98070897 100644 --- a/bearhub/api/abstract/download.py +++ b/bearhub/api/abstract/download.py @@ -1,7 +1,7 @@ from abc import ABC, abstractmethod from typing import Iterable, List, Optional, Tuple -from bauh.api.abstract.handler import ProcessWatcher +from bearhub.api.abstract.handler import ProcessWatcher class FileDownloader(ABC): diff --git a/bearhub/api/abstract/handler.py b/bearhub/api/abstract/handler.py index 393ede9c..32f2dcab 100644 --- a/bearhub/api/abstract/handler.py +++ b/bearhub/api/abstract/handler.py @@ -1,6 +1,6 @@ from typing import List, Tuple, Optional -from bauh.api.abstract.view import MessageType, ViewComponent +from bearhub.api.abstract.view import MessageType, ViewComponent class ProcessWatcher: diff --git a/bearhub/api/abstract/model.py b/bearhub/api/abstract/model.py index 108673cc..1c237161 100644 --- a/bearhub/api/abstract/model.py +++ b/bearhub/api/abstract/model.py @@ -3,11 +3,11 @@ from abc import ABC, abstractmethod from enum import Enum from typing import List, Optional, Iterable -from bauh.api.paths import CACHE_DIR +from bearhub.api.paths import CACHE_DIR from typing import TYPE_CHECKING if TYPE_CHECKING: - from bauh.api.abstract.controller import SoftwareManager + from bearhub.api.abstract.controller import SoftwareManager class CustomSoftwareAction: diff --git a/bearhub/api/http.py b/bearhub/api/http.py index f325acb0..6e6f88fc 100644 --- a/bearhub/api/http.py +++ b/bearhub/api/http.py @@ -6,8 +6,8 @@ from typing import Optional import requests import yaml -from bauh.commons import system -from bauh.commons.view_utils import get_human_size_str +from bearhub.commons import system +from bearhub.commons.view_utils import get_human_size_str class HttpClient: diff --git a/bearhub/api/paths.py b/bearhub/api/paths.py index 8c388360..61b65927 100644 --- a/bearhub/api/paths.py +++ b/bearhub/api/paths.py @@ -3,8 +3,8 @@ import shutil from getpass import getuser from pathlib import Path -from bauh import __app_name__ -from bauh.api import user +from bearhub import __app_name__ +from bearhub.api import user def get_temp_dir(username: str) -> str: diff --git a/bearhub/commons/boot.py b/bearhub/commons/boot.py index c9874ada..266106d9 100644 --- a/bearhub/commons/boot.py +++ b/bearhub/commons/boot.py @@ -3,9 +3,9 @@ from logging import Logger from threading import Thread from typing import Optional -from bauh.api.abstract.handler import TaskManager -from bauh.commons.config import ConfigManager -from bauh.view.util.translation import I18n +from bearhub.api.abstract.handler import TaskManager +from bearhub.commons.config import ConfigManager +from bearhub.view.util.translation import I18n class CreateConfigFile(Thread): diff --git a/bearhub/commons/category.py b/bearhub/commons/category.py index 969df2b0..7e619ced 100644 --- a/bearhub/commons/category.py +++ b/bearhub/commons/category.py @@ -9,10 +9,10 @@ from typing import Dict, List, Optional import requests -from bauh.api.abstract.controller import SoftwareManager -from bauh.api.http import HttpClient -from bauh.commons.internet import InternetChecker -from bauh.commons.util import map_timestamp_file +from bearhub.api.abstract.controller import SoftwareManager +from bearhub.api.http import HttpClient +from bearhub.commons.internet import InternetChecker +from bearhub.commons.util import map_timestamp_file class CategoriesDownloader(Thread): diff --git a/bearhub/commons/config.py b/bearhub/commons/config.py index f2e6cb40..f7029294 100644 --- a/bearhub/commons/config.py +++ b/bearhub/commons/config.py @@ -7,8 +7,8 @@ from typing import Optional import yaml -from bauh.api.paths import CONFIG_DIR -from bauh.commons import util +from bearhub.api.paths import CONFIG_DIR +from bearhub.commons import util def read_config(file_path: str, template: dict, update_file: bool = False, update_async: bool = False) -> dict: diff --git a/bearhub/commons/suggestions.py b/bearhub/commons/suggestions.py index c7565e2c..ab48a19f 100644 --- a/bearhub/commons/suggestions.py +++ b/bearhub/commons/suggestions.py @@ -1,7 +1,7 @@ from logging import Logger from typing import Dict, Optional, Tuple -from bauh.api.abstract.model import SuggestionPriority +from bearhub.api.abstract.model import SuggestionPriority def parse(suggestions_str: str, logger: Optional[Logger] = None, type_: Optional[str] = None, diff --git a/bearhub/commons/system.py b/bearhub/commons/system.py index a3f0c3d5..ff3c3433 100644 --- a/bearhub/commons/system.py +++ b/bearhub/commons/system.py @@ -8,7 +8,7 @@ from subprocess import PIPE from typing import List, Tuple, Set, Dict, Optional, Iterable, Union, IO, Any # default environment variables for subprocesses. -from bauh.api.abstract.handler import ProcessWatcher +from bearhub.api.abstract.handler import ProcessWatcher PY_VERSION = "{}.{}".format(sys.version_info.major, sys.version_info.minor) GLOBAL_PY_LIBS = '/usr/lib/python{}'.format(PY_VERSION) diff --git a/bearhub/commons/view_utils.py b/bearhub/commons/view_utils.py index 2138aaeb..c5b87fcd 100644 --- a/bearhub/commons/view_utils.py +++ b/bearhub/commons/view_utils.py @@ -1,7 +1,7 @@ import locale from typing import Tuple, Optional, Iterable -from bauh.api.abstract.view import SelectViewType, InputOption, SingleSelectComponent +from bearhub.api.abstract.view import SelectViewType, InputOption, SingleSelectComponent def new_select(label: str, tip: Optional[str], id_: str, opts: Iterable[Tuple[Optional[str], object, Optional[str]]], value: object, max_width: Optional[int] = None, diff --git a/bearhub/gems/__init__.py b/bearhub/gems/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bearhub/gems/appimage/__init__.py b/bearhub/gems/appimage/__init__.py index cd6914c5..5b34d63a 100644 --- a/bearhub/gems/appimage/__init__.py +++ b/bearhub/gems/appimage/__init__.py @@ -2,8 +2,8 @@ import os from pathlib import Path from typing import Optional -from bauh.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_DIR, BINARIES_DIR, SHARED_FILES_DIR -from bauh.commons import resource +from bearhub.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_DIR, BINARIES_DIR, SHARED_FILES_DIR +from bearhub.commons import resource ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) APPIMAGE_SHARED_DIR = f'{SHARED_FILES_DIR}/appimage' diff --git a/bearhub/gems/appimage/config.py b/bearhub/gems/appimage/config.py index 9f508d46..4ca840e0 100644 --- a/bearhub/gems/appimage/config.py +++ b/bearhub/gems/appimage/config.py @@ -1,5 +1,5 @@ -from bauh.commons.config import YAMLConfigManager -from bauh.gems.appimage import CONFIG_FILE +from bearhub.commons.config import YAMLConfigManager +from bearhub.gems.appimage import CONFIG_FILE class AppImageConfigManager(YAMLConfigManager): diff --git a/bearhub/gems/appimage/controller.py b/bearhub/gems/appimage/controller.py index 2cb56695..61f9c061 100644 --- a/bearhub/gems/appimage/controller.py +++ b/bearhub/gems/appimage/controller.py @@ -12,29 +12,29 @@ from typing import Set, Type, List, Tuple, Optional, Iterable, Generator from colorama import Fore -from bauh import __app_name__ -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.controller import SoftwareManager, SearchResult, UpgradeRequirements, UpgradeRequirement, \ +from bearhub import __app_name__ +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.controller import SoftwareManager, SearchResult, UpgradeRequirements, UpgradeRequirement, \ TransactionResult, SoftwareAction, SettingsView, SettingsController -from bauh.api.abstract.disk import DiskCacheLoader -from bauh.api.abstract.handler import ProcessWatcher, TaskManager -from bauh.api.abstract.model import SoftwarePackage, PackageHistory, PackageUpdate, PackageSuggestion, \ +from bearhub.api.abstract.disk import DiskCacheLoader +from bearhub.api.abstract.handler import ProcessWatcher, TaskManager +from bearhub.api.abstract.model import SoftwarePackage, PackageHistory, PackageUpdate, PackageSuggestion, \ SuggestionPriority, CustomSoftwareAction -from bauh.api.abstract.view import MessageType, FormComponent, InputOption, SingleSelectComponent, \ +from bearhub.api.abstract.view import MessageType, FormComponent, InputOption, SingleSelectComponent, \ SelectViewType, TextInputComponent, PanelComponent, FileChooserComponent, ViewObserver -from bauh.api.paths import DESKTOP_ENTRIES_DIR -from bauh.commons import resource -from bauh.commons.boot import CreateConfigFile -from bauh.commons.html import bold -from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, SimpleProcess -from bauh.commons.version_util import normalize_version -from bauh.gems.appimage import query, INSTALLATION_DIR, APPIMAGE_SHARED_DIR, ROOT_DIR, \ +from bearhub.api.paths import DESKTOP_ENTRIES_DIR +from bearhub.commons import resource +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.html import bold +from bearhub.commons.system import SystemProcess, new_subprocess, ProcessHandler, SimpleProcess +from bearhub.commons.version_util import normalize_version +from bearhub.gems.appimage import query, INSTALLATION_DIR, APPIMAGE_SHARED_DIR, ROOT_DIR, \ APPIMAGE_CONFIG_DIR, UPDATES_IGNORED_FILE, util, get_default_manual_installation_file_dir, DATABASE_APPS_FILE, \ DATABASE_RELEASES_FILE, APPIMAGE_CACHE_DIR, get_icon_path, DOWNLOAD_DIR -from bauh.gems.appimage.config import AppImageConfigManager -from bauh.gems.appimage.model import AppImage -from bauh.gems.appimage.util import replace_desktop_entry_exec_command -from bauh.gems.appimage.worker import DatabaseUpdater, SymlinksVerifier, AppImageSuggestionsDownloader +from bearhub.gems.appimage.config import AppImageConfigManager +from bearhub.gems.appimage.model import AppImage +from bearhub.gems.appimage.util import replace_desktop_entry_exec_command +from bearhub.gems.appimage.worker import DatabaseUpdater, SymlinksVerifier, AppImageSuggestionsDownloader RE_DESKTOP_ICON = re.compile(r'Icon\s*=\s*.+\n') RE_ICON_ENDS_WITH = re.compile(r'.+\.(png|svg)$') diff --git a/bearhub/gems/appimage/model.py b/bearhub/gems/appimage/model.py index 4f4f22bb..ba8bf2ee 100644 --- a/bearhub/gems/appimage/model.py +++ b/bearhub/gems/appimage/model.py @@ -3,10 +3,10 @@ from io import StringIO from re import Pattern from typing import Optional, Iterable, Tuple -from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction -from bauh.commons import resource -from bauh.gems.appimage import ROOT_DIR, INSTALLATION_DIR -from bauh.view.util.translation import I18n +from bearhub.api.abstract.model import SoftwarePackage, CustomSoftwareAction +from bearhub.commons import resource +from bearhub.gems.appimage import ROOT_DIR, INSTALLATION_DIR +from bearhub.view.util.translation import I18n class AppImage(SoftwarePackage): diff --git a/bearhub/gems/appimage/worker.py b/bearhub/gems/appimage/worker.py index 315009c9..fb8fa635 100644 --- a/bearhub/gems/appimage/worker.py +++ b/bearhub/gems/appimage/worker.py @@ -12,14 +12,14 @@ from typing import Optional, Generator import requests -from bauh.api.abstract.handler import TaskManager, ProcessWatcher -from bauh.api.http import HttpClient -from bauh.commons.boot import CreateConfigFile -from bauh.commons.html import bold -from bauh.gems.appimage import get_icon_path, INSTALLATION_DIR, SYMLINKS_DIR, util, DATABASES_TS_FILE, \ +from bearhub.api.abstract.handler import TaskManager, ProcessWatcher +from bearhub.api.http import HttpClient +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.html import bold +from bearhub.gems.appimage import get_icon_path, INSTALLATION_DIR, SYMLINKS_DIR, util, DATABASES_TS_FILE, \ APPIMAGE_CACHE_DIR, DATABASE_APPS_FILE, DATABASE_RELEASES_FILE, URL_COMPRESSED_DATABASES -from bauh.gems.appimage.model import AppImage -from bauh.view.util.translation import I18n +from bearhub.gems.appimage.model import AppImage +from bearhub.view.util.translation import I18n class DatabaseUpdater(Thread): diff --git a/bearhub/gems/arch/__init__.py b/bearhub/gems/arch/__init__.py index fc953859..6e4324fc 100644 --- a/bearhub/gems/arch/__init__.py +++ b/bearhub/gems/arch/__init__.py @@ -1,8 +1,8 @@ import os from typing import Optional -from bauh.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_DIR, get_temp_dir -from bauh.commons import resource +from bearhub.api.paths import CONFIG_DIR, TEMP_DIR, CACHE_DIR, get_temp_dir +from bearhub.commons import resource ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) ARCH_CACHE_DIR = f'{CACHE_DIR}/arch' diff --git a/bearhub/gems/arch/aur.py b/bearhub/gems/arch/aur.py index 79ff5767..2788519c 100644 --- a/bearhub/gems/arch/aur.py +++ b/bearhub/gems/arch/aur.py @@ -6,9 +6,9 @@ from typing import Set, List, Iterable, Dict, Optional, Generator, Tuple import requests -from bauh.api.http import HttpClient -from bauh.gems.arch import AUR_INDEX_FILE, git -from bauh.gems.arch.exceptions import PackageNotFoundException +from bearhub.api.http import HttpClient +from bearhub.gems.arch import AUR_INDEX_FILE, git +from bearhub.gems.arch.exceptions import PackageNotFoundException URL_INFO = 'https://aur.archlinux.org/rpc/?v=5&type=info&' URL_SRC_INFO = 'https://aur.archlinux.org/cgit/aur.git/plain/.SRCINFO?h=' diff --git a/bearhub/gems/arch/config.py b/bearhub/gems/arch/config.py index de35348d..00643dfe 100644 --- a/bearhub/gems/arch/config.py +++ b/bearhub/gems/arch/config.py @@ -1,7 +1,7 @@ from typing import Optional -from bauh.commons.config import YAMLConfigManager -from bauh.gems.arch import CONFIG_FILE, get_pkgbuild_dir +from bearhub.commons.config import YAMLConfigManager +from bearhub.gems.arch import CONFIG_FILE, get_pkgbuild_dir def get_build_dir(arch_config: dict, user: Optional[str]) -> str: diff --git a/bearhub/gems/arch/confirmation.py b/bearhub/gems/arch/confirmation.py index 5fe05bad..1670a6f8 100644 --- a/bearhub/gems/arch/confirmation.py +++ b/bearhub/gems/arch/confirmation.py @@ -1,14 +1,14 @@ from io import StringIO from typing import Set, Tuple, Dict, Collection -from bauh.api.abstract.handler import ProcessWatcher -from bauh.api.abstract.view import MultipleSelectComponent, InputOption, FormComponent, SingleSelectComponent, \ +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.api.abstract.view import MultipleSelectComponent, InputOption, FormComponent, SingleSelectComponent, \ SelectViewType -from bauh.commons import resource -from bauh.commons.html import bold -from bauh.commons.view_utils import get_human_size_str -from bauh.gems.arch import ROOT_DIR, get_repo_icon_path, get_icon_path, pacman -from bauh.view.util.translation import I18n +from bearhub.commons import resource +from bearhub.commons.html import bold +from bearhub.commons.view_utils import get_human_size_str +from bearhub.gems.arch import ROOT_DIR, get_repo_icon_path, get_icon_path, pacman +from bearhub.view.util.translation import I18n def _get_repo_icon(repository: str): return resource.get_path('img/{}.svg'.format('arch' if repository == 'aur' else 'repo'), ROOT_DIR) diff --git a/bearhub/gems/arch/controller.py b/bearhub/gems/arch/controller.py index 801908df..fd86baa5 100644 --- a/bearhub/gems/arch/controller.py +++ b/bearhub/gems/arch/controller.py @@ -15,44 +15,44 @@ from typing import List, Set, Type, Tuple, Dict, Iterable, Optional, Collection, from dateutil.parser import parse as parse_date -from bauh import __app_name__ -from bauh.api.abstract.controller import SearchResult, SoftwareManager, ApplicationContext, UpgradeRequirements, \ +from bearhub import __app_name__ +from bearhub.api.abstract.controller import SearchResult, SoftwareManager, ApplicationContext, UpgradeRequirements, \ TransactionResult, SoftwareAction, SettingsView, SettingsController -from bauh.api.abstract.disk import DiskCacheLoader -from bauh.api.abstract.handler import ProcessWatcher, TaskManager -from bauh.api.abstract.model import PackageUpdate, PackageHistory, SoftwarePackage, PackageStatus, \ +from bearhub.api.abstract.disk import DiskCacheLoader +from bearhub.api.abstract.handler import ProcessWatcher, TaskManager +from bearhub.api.abstract.model import PackageUpdate, PackageHistory, SoftwarePackage, PackageStatus, \ CustomSoftwareAction, PackageSuggestion -from bauh.api.abstract.view import MessageType, FormComponent, InputOption, SingleSelectComponent, SelectViewType, \ +from bearhub.api.abstract.view import MessageType, FormComponent, InputOption, SingleSelectComponent, SelectViewType, \ ViewComponent, PanelComponent, MultipleSelectComponent, TextInputComponent, TextInputType, \ FileChooserComponent, TextComponent -from bauh.api.exception import NoInternetException -from bauh.api.paths import TEMP_DIR -from bauh.commons import system -from bauh.commons.boot import CreateConfigFile -from bauh.commons.category import CategoriesDownloader -from bauh.commons.html import bold -from bauh.commons.suggestions import sort_by_priority -from bauh.commons.system import SystemProcess, ProcessHandler, new_subprocess, run_cmd, SimpleProcess -from bauh.commons.util import datetime_as_milis -from bauh.commons.view_utils import new_select -from bauh.gems.arch import aur, pacman, message, confirmation, disk, git, \ +from bearhub.api.exception import NoInternetException +from bearhub.api.paths import TEMP_DIR +from bearhub.commons import system +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.category import CategoriesDownloader +from bearhub.commons.html import bold +from bearhub.commons.suggestions import sort_by_priority +from bearhub.commons.system import SystemProcess, ProcessHandler, new_subprocess, run_cmd, SimpleProcess +from bearhub.commons.util import datetime_as_milis +from bearhub.commons.view_utils import new_select +from bearhub.gems.arch import aur, pacman, message, confirmation, disk, git, \ gpg, URL_CATEGORIES_FILE, CATEGORIES_FILE_PATH, CUSTOM_MAKEPKG_FILE, \ get_icon_path, database, mirrors, sorting, cpu_manager, UPDATES_IGNORED_FILE, \ ARCH_CONFIG_DIR, EDITABLE_PKGBUILDS_FILE, URL_GPG_SERVERS, rebuild_detector, makepkg, sshell, get_repo_icon_path -from bauh.gems.arch.aur import AURClient -from bauh.gems.arch.config import get_build_dir, ArchConfigManager -from bauh.gems.arch.confirmation import confirm_missing_deps -from bauh.gems.arch.dependencies import DependenciesAnalyser -from bauh.gems.arch.download import MultithreadedDownloadService, ArchDownloadException -from bauh.gems.arch.exceptions import PackageNotFoundException, PackageInHoldException -from bauh.gems.arch.mapper import AURDataMapper -from bauh.gems.arch.model import ArchPackage -from bauh.gems.arch.output import TransactionStatusHandler -from bauh.gems.arch.pacman import RE_DEP_OPERATORS -from bauh.gems.arch.proc_util import write_as_user -from bauh.gems.arch.suggestions import RepositorySuggestionsDownloader -from bauh.gems.arch.updates import UpdatesSummarizer -from bauh.gems.arch.worker import AURIndexUpdater, ArchDiskCacheUpdater, ArchCompilationOptimizer, RefreshMirrors, \ +from bearhub.gems.arch.aur import AURClient +from bearhub.gems.arch.config import get_build_dir, ArchConfigManager +from bearhub.gems.arch.confirmation import confirm_missing_deps +from bearhub.gems.arch.dependencies import DependenciesAnalyser +from bearhub.gems.arch.download import MultithreadedDownloadService, ArchDownloadException +from bearhub.gems.arch.exceptions import PackageNotFoundException, PackageInHoldException +from bearhub.gems.arch.mapper import AURDataMapper +from bearhub.gems.arch.model import ArchPackage +from bearhub.gems.arch.output import TransactionStatusHandler +from bearhub.gems.arch.pacman import RE_DEP_OPERATORS +from bearhub.gems.arch.proc_util import write_as_user +from bearhub.gems.arch.suggestions import RepositorySuggestionsDownloader +from bearhub.gems.arch.updates import UpdatesSummarizer +from bearhub.gems.arch.worker import AURIndexUpdater, ArchDiskCacheUpdater, ArchCompilationOptimizer, RefreshMirrors, \ SyncDatabases URL_GIT = 'https://aur.archlinux.org/{}.git' diff --git a/bearhub/gems/arch/cpu_manager.py b/bearhub/gems/arch/cpu_manager.py index a3cc6221..fb18ca33 100644 --- a/bearhub/gems/arch/cpu_manager.py +++ b/bearhub/gems/arch/cpu_manager.py @@ -6,8 +6,8 @@ from logging import Logger from pathlib import Path from typing import Optional, Set, Tuple, Dict -from bauh.api.paths import TEMP_DIR -from bauh.commons.system import new_root_subprocess +from bearhub.api.paths import TEMP_DIR +from bearhub.commons.system import new_root_subprocess def supports_performance_mode() -> bool: diff --git a/bearhub/gems/arch/database.py b/bearhub/gems/arch/database.py index dda0c053..3179336f 100644 --- a/bearhub/gems/arch/database.py +++ b/bearhub/gems/arch/database.py @@ -7,8 +7,8 @@ from logging import Logger from pathlib import Path from typing import Optional -from bauh.api.paths import CACHE_DIR -from bauh.commons.system import ProcessHandler +from bearhub.api.paths import CACHE_DIR +from bearhub.commons.system import ProcessHandler SYNC_FILE = f'{CACHE_DIR}/arch/db_sync' diff --git a/bearhub/gems/arch/dependencies.py b/bearhub/gems/arch/dependencies.py index 7ae70db8..370540bc 100644 --- a/bearhub/gems/arch/dependencies.py +++ b/bearhub/gems/arch/dependencies.py @@ -4,12 +4,12 @@ from logging import Logger from threading import Thread from typing import Set, List, Tuple, Dict, Iterable, Optional, Generator, Pattern -from bauh.api.abstract.handler import ProcessWatcher -from bauh.commons.version_util import match_required_version -from bauh.gems.arch import pacman, message, sorting, confirmation -from bauh.gems.arch.aur import AURClient -from bauh.gems.arch.exceptions import PackageNotFoundException -from bauh.view.util.translation import I18n +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.commons.version_util import match_required_version +from bearhub.gems.arch import pacman, message, sorting, confirmation +from bearhub.gems.arch.aur import AURClient +from bearhub.gems.arch.exceptions import PackageNotFoundException +from bearhub.view.util.translation import I18n class DependenciesAnalyser: diff --git a/bearhub/gems/arch/disk.py b/bearhub/gems/arch/disk.py index d47a09b0..93b8a5c4 100644 --- a/bearhub/gems/arch/disk.py +++ b/bearhub/gems/arch/disk.py @@ -4,8 +4,8 @@ import re from pathlib import Path from typing import List, Dict, Tuple, Optional, Callable -from bauh.gems.arch import pacman -from bauh.gems.arch.model import ArchPackage +from bearhub.gems.arch import pacman +from bearhub.gems.arch.model import ArchPackage RE_DESKTOP_ENTRY = re.compile(r'[\n^](Exec|Icon|NoDisplay)\s*=\s*(.+)') RE_CLEAN_NAME = re.compile(r'[+*?%]') diff --git a/bearhub/gems/arch/download.py b/bearhub/gems/arch/download.py index e4e2d21b..45d20754 100644 --- a/bearhub/gems/arch/download.py +++ b/bearhub/gems/arch/download.py @@ -6,14 +6,14 @@ import traceback from threading import Lock, Thread from typing import List, Iterable, Dict, Optional -from bauh.api.abstract.download import FileDownloader -from bauh.api.abstract.handler import ProcessWatcher -from bauh.api.abstract.view import MessageType -from bauh.api.http import HttpClient -from bauh.commons.html import bold -from bauh.commons.system import ProcessHandler, SimpleProcess -from bauh.gems.arch import pacman -from bauh.view.util.translation import I18n +from bearhub.api.abstract.download import FileDownloader +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.api.abstract.view import MessageType +from bearhub.api.http import HttpClient +from bearhub.commons.html import bold +from bearhub.commons.system import ProcessHandler, SimpleProcess +from bearhub.gems.arch import pacman +from bearhub.view.util.translation import I18n class ArchDownloadException(Exception): diff --git a/bearhub/gems/arch/git.py b/bearhub/gems/arch/git.py index 632752d8..760901d7 100644 --- a/bearhub/gems/arch/git.py +++ b/bearhub/gems/arch/git.py @@ -3,8 +3,8 @@ from io import StringIO from logging import Logger from typing import List, Tuple, Optional -from bauh.commons import system -from bauh.commons.system import SimpleProcess +from bearhub.commons import system +from bearhub.commons.system import SimpleProcess def is_installed() -> bool: diff --git a/bearhub/gems/arch/gpg.py b/bearhub/gems/arch/gpg.py index 01c7235c..2a47f806 100644 --- a/bearhub/gems/arch/gpg.py +++ b/bearhub/gems/arch/gpg.py @@ -1,6 +1,6 @@ from typing import Optional -from bauh.commons.system import SystemProcess, new_subprocess +from bearhub.commons.system import SystemProcess, new_subprocess def receive_key(key: str, server: Optional[str] = None) -> SystemProcess: diff --git a/bearhub/gems/arch/makepkg.py b/bearhub/gems/arch/makepkg.py index 3c59bb7b..48ba31b7 100644 --- a/bearhub/gems/arch/makepkg.py +++ b/bearhub/gems/arch/makepkg.py @@ -2,10 +2,10 @@ import os import re from typing import Optional, Set, Tuple -from bauh.commons import system -from bauh.commons.system import ProcessHandler, SimpleProcess -from bauh.gems.arch import CUSTOM_MAKEPKG_FILE -from bauh.gems.arch.proc_util import write_as_user +from bearhub.commons import system +from bearhub.commons.system import ProcessHandler, SimpleProcess +from bearhub.gems.arch import CUSTOM_MAKEPKG_FILE +from bearhub.gems.arch.proc_util import write_as_user RE_UNKNOWN_GPG_KEY = re.compile(r'\(unknown public key (\w+)\)') RE_DEPS_PATTERN = re.compile(r'\n?\s+->\s(.+)\n') diff --git a/bearhub/gems/arch/mapper.py b/bearhub/gems/arch/mapper.py index 0c75a2b2..5673f498 100644 --- a/bearhub/gems/arch/mapper.py +++ b/bearhub/gems/arch/mapper.py @@ -2,11 +2,11 @@ import logging import os from typing import Optional, List, Dict -from bauh.api.abstract.model import PackageStatus -from bauh.api.http import HttpClient -from bauh.gems.arch.model import ArchPackage -from bauh.commons.version_util import normalize_version -from bauh.view.util.translation import I18n +from bearhub.api.abstract.model import PackageStatus +from bearhub.api.http import HttpClient +from bearhub.gems.arch.model import ArchPackage +from bearhub.commons.version_util import normalize_version +from bearhub.view.util.translation import I18n URL_PKG_DOWNLOAD = 'https://aur.archlinux.org/{}' diff --git a/bearhub/gems/arch/message.py b/bearhub/gems/arch/message.py index 1a43fbac..2b31b80c 100644 --- a/bearhub/gems/arch/message.py +++ b/bearhub/gems/arch/message.py @@ -1,9 +1,9 @@ from typing import Iterable, Optional -from bauh.api.abstract.handler import ProcessWatcher -from bauh.api.abstract.view import MessageType -from bauh.commons.html import bold -from bauh.view.util.translation import I18n +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.api.abstract.view import MessageType +from bearhub.commons.html import bold +from bearhub.view.util.translation import I18n def show_deps_not_installed(watcher: ProcessWatcher, pkgname: str, depnames: Iterable[str], i18n: I18n): diff --git a/bearhub/gems/arch/mirrors.py b/bearhub/gems/arch/mirrors.py index 47ec7411..6709d1aa 100644 --- a/bearhub/gems/arch/mirrors.py +++ b/bearhub/gems/arch/mirrors.py @@ -6,7 +6,7 @@ from datetime import datetime from logging import Logger from pathlib import Path -from bauh.api.paths import CACHE_DIR +from bearhub.api.paths import CACHE_DIR SYNC_FILE = f'{CACHE_DIR}/arch/mirrors_sync' diff --git a/bearhub/gems/arch/model.py b/bearhub/gems/arch/model.py index fd09525e..9b254ccf 100644 --- a/bearhub/gems/arch/model.py +++ b/bearhub/gems/arch/model.py @@ -1,9 +1,9 @@ from typing import List, Set, Optional, Iterable, Tuple -from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction -from bauh.commons import resource -from bauh.gems.arch import ROOT_DIR, ARCH_CACHE_DIR -from bauh.view.util.translation import I18n +from bearhub.api.abstract.model import SoftwarePackage, CustomSoftwareAction +from bearhub.commons import resource +from bearhub.gems.arch import ROOT_DIR, ARCH_CACHE_DIR +from bearhub.view.util.translation import I18n class ArchPackage(SoftwarePackage): diff --git a/bearhub/gems/arch/output.py b/bearhub/gems/arch/output.py index b0eca16d..d49faaa9 100644 --- a/bearhub/gems/arch/output.py +++ b/bearhub/gems/arch/output.py @@ -3,9 +3,9 @@ import time from threading import Thread from typing import Optional, Collection -from bauh.api.abstract.handler import ProcessWatcher -from bauh.commons.html import bold -from bauh.view.util.translation import I18n +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.commons.html import bold +from bearhub.view.util.translation import I18n class TransactionStatusHandler(Thread): diff --git a/bearhub/gems/arch/pacman.py b/bearhub/gems/arch/pacman.py index 6e184c01..93544bfd 100644 --- a/bearhub/gems/arch/pacman.py +++ b/bearhub/gems/arch/pacman.py @@ -9,10 +9,10 @@ from typing import List, Set, Tuple, Dict, Iterable, Optional, Any, Pattern, Col from colorama import Fore -from bauh.commons import system -from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess, SimpleProcess -from bauh.commons.util import size_to_byte -from bauh.gems.arch.exceptions import PackageNotFoundException, PackageInHoldException +from bearhub.commons import system +from bearhub.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess, SimpleProcess +from bearhub.commons.util import size_to_byte +from bearhub.gems.arch.exceptions import PackageNotFoundException, PackageInHoldException RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-.]+\s+\[\w+]') RE_OPTDEPS = re.compile(r'[\w._\-]+\s*:') diff --git a/bearhub/gems/arch/rebuild_detector.py b/bearhub/gems/arch/rebuild_detector.py index 23c45e60..de6d0a75 100644 --- a/bearhub/gems/arch/rebuild_detector.py +++ b/bearhub/gems/arch/rebuild_detector.py @@ -3,8 +3,8 @@ import shutil from pathlib import Path from typing import Set -from bauh.commons import system -from bauh.gems.arch import IGNORED_REBUILD_CHECK_FILE +from bearhub.commons import system +from bearhub.gems.arch import IGNORED_REBUILD_CHECK_FILE def is_installed() -> bool: diff --git a/bearhub/gems/arch/sshell.py b/bearhub/gems/arch/sshell.py index 7e4852c1..904a2d54 100644 --- a/bearhub/gems/arch/sshell.py +++ b/bearhub/gems/arch/sshell.py @@ -1,6 +1,6 @@ from typing import Optional, Tuple -from bauh.commons.system import execute +from bearhub.commons.system import execute def mkdir(dir_path: str, parent: bool = True, custom_user: Optional[str] = None) -> Tuple[bool, Optional[str]]: diff --git a/bearhub/gems/arch/suggestions.py b/bearhub/gems/arch/suggestions.py index 161caff0..d4797873 100644 --- a/bearhub/gems/arch/suggestions.py +++ b/bearhub/gems/arch/suggestions.py @@ -6,13 +6,13 @@ from pathlib import Path from threading import Thread from typing import Optional, Dict -from bauh.api.abstract.handler import TaskManager -from bauh.api.abstract.model import SuggestionPriority -from bauh.api.http import HttpClient -from bauh.commons.boot import CreateConfigFile -from bauh.gems.arch import ARCH_CACHE_DIR, get_icon_path -from bauh.view.util.translation import I18n -from bauh.commons.suggestions import parse +from bearhub.api.abstract.handler import TaskManager +from bearhub.api.abstract.model import SuggestionPriority +from bearhub.api.http import HttpClient +from bearhub.commons.boot import CreateConfigFile +from bearhub.gems.arch import ARCH_CACHE_DIR, get_icon_path +from bearhub.view.util.translation import I18n +from bearhub.commons.suggestions import parse class RepositorySuggestionsDownloader(Thread): diff --git a/bearhub/gems/arch/updates.py b/bearhub/gems/arch/updates.py index 4ff57e32..d9af72c9 100644 --- a/bearhub/gems/arch/updates.py +++ b/bearhub/gems/arch/updates.py @@ -4,16 +4,16 @@ import traceback from threading import Thread from typing import Dict, Set, List, Tuple, Iterable, Optional, Any -from bauh.api.abstract.controller import UpgradeRequirements, UpgradeRequirement -from bauh.api.abstract.handler import ProcessWatcher -from bauh.gems.arch import pacman, sorting -from bauh.gems.arch.aur import AURClient -from bauh.gems.arch.dependencies import DependenciesAnalyser -from bauh.gems.arch.exceptions import PackageNotFoundException -from bauh.gems.arch.model import ArchPackage -from bauh.gems.arch.pacman import RE_DEP_OPERATORS -from bauh.commons.version_util import match_required_version -from bauh.view.util.translation import I18n +from bearhub.api.abstract.controller import UpgradeRequirements, UpgradeRequirement +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.gems.arch import pacman, sorting +from bearhub.gems.arch.aur import AURClient +from bearhub.gems.arch.dependencies import DependenciesAnalyser +from bearhub.gems.arch.exceptions import PackageNotFoundException +from bearhub.gems.arch.model import ArchPackage +from bearhub.gems.arch.pacman import RE_DEP_OPERATORS +from bearhub.commons.version_util import match_required_version +from bearhub.view.util.translation import I18n class UpdateRequirementsContext: diff --git a/bearhub/gems/arch/worker.py b/bearhub/gems/arch/worker.py index 97eb525c..efbf894a 100644 --- a/bearhub/gems/arch/worker.py +++ b/bearhub/gems/arch/worker.py @@ -13,20 +13,20 @@ from typing import Optional import requests -from bauh import __app_name__ -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.handler import TaskManager -from bauh.commons.boot import CreateConfigFile -from bauh.commons.html import bold -from bauh.commons.system import new_root_subprocess, ProcessHandler -from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_FILE, ARCH_CONFIG_DIR, AUR_INDEX_FILE, get_icon_path, database, \ +from bearhub import __app_name__ +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.handler import TaskManager +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.html import bold +from bearhub.commons.system import new_root_subprocess, ProcessHandler +from bearhub.gems.arch import pacman, disk, CUSTOM_MAKEPKG_FILE, ARCH_CONFIG_DIR, AUR_INDEX_FILE, get_icon_path, database, \ mirrors, ARCH_CACHE_DIR, AUR_INDEX_TS_FILE, aur -from bauh.gems.arch.aur import URL_INDEX -from bauh.view.util.translation import I18n +from bearhub.gems.arch.aur import URL_INDEX +from bearhub.view.util.translation import I18n from typing import TYPE_CHECKING if TYPE_CHECKING: - from bauh.gems.arch.controller import ArchManager + from bearhub.gems.arch.controller import ArchManager URL_INFO = 'https://aur.archlinux.org/rpc/?v=5&type=info&arg={}' diff --git a/bearhub/gems/flatpak/__init__.py b/bearhub/gems/flatpak/__init__.py index 23e67ce9..ddc86116 100644 --- a/bearhub/gems/flatpak/__init__.py +++ b/bearhub/gems/flatpak/__init__.py @@ -1,10 +1,10 @@ import os from pathlib import Path -from bauh.api import user -from bauh.api.paths import CONFIG_DIR -from bauh.commons import resource -from bauh.commons.version_util import map_str_version +from bearhub.api import user +from bearhub.api.paths import CONFIG_DIR +from bearhub.commons import resource +from bearhub.commons.version_util import map_str_version ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) CONFIG_FILE = f'{CONFIG_DIR}/flatpak.yml' diff --git a/bearhub/gems/flatpak/config.py b/bearhub/gems/flatpak/config.py index fbc2046a..70aec51e 100644 --- a/bearhub/gems/flatpak/config.py +++ b/bearhub/gems/flatpak/config.py @@ -1,5 +1,5 @@ -from bauh.commons.config import YAMLConfigManager -from bauh.gems.flatpak import CONFIG_FILE +from bearhub.commons.config import YAMLConfigManager +from bearhub.gems.flatpak import CONFIG_FILE class FlatpakConfigManager(YAMLConfigManager): diff --git a/bearhub/gems/flatpak/controller.py b/bearhub/gems/flatpak/controller.py index 6cca43b3..ff7116c5 100644 --- a/bearhub/gems/flatpak/controller.py +++ b/bearhub/gems/flatpak/controller.py @@ -7,26 +7,26 @@ from pathlib import Path from threading import Thread from typing import List, Set, Type, Tuple, Optional, Generator, Dict -from bauh.api import user -from bauh.api.abstract.controller import SearchResult, SoftwareManager, ApplicationContext, UpgradeRequirements, \ +from bearhub.api import user +from bearhub.api.abstract.controller import SearchResult, SoftwareManager, ApplicationContext, UpgradeRequirements, \ UpgradeRequirement, TransactionResult, SoftwareAction, SettingsView, SettingsController -from bauh.api.abstract.disk import DiskCacheLoader -from bauh.api.abstract.handler import ProcessWatcher, TaskManager -from bauh.api.abstract.model import PackageHistory, PackageUpdate, SoftwarePackage, PackageSuggestion, \ +from bearhub.api.abstract.disk import DiskCacheLoader +from bearhub.api.abstract.handler import ProcessWatcher, TaskManager +from bearhub.api.abstract.model import PackageHistory, PackageUpdate, SoftwarePackage, PackageSuggestion, \ PackageStatus, CustomSoftwareAction, SuggestionPriority -from bauh.api.abstract.view import MessageType, FormComponent, SingleSelectComponent, InputOption, SelectViewType, \ +from bearhub.api.abstract.view import MessageType, FormComponent, SingleSelectComponent, InputOption, SelectViewType, \ PanelComponent, ViewComponentAlignment -from bauh.commons import suggestions -from bauh.commons.boot import CreateConfigFile -from bauh.commons.html import strip_html, bold -from bauh.commons.system import ProcessHandler -from bauh.gems.flatpak import flatpak, CONFIG_FILE, UPDATES_IGNORED_FILE, FLATPAK_CONFIG_DIR, \ +from bearhub.commons import suggestions +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.html import strip_html, bold +from bearhub.commons.system import ProcessHandler +from bearhub.gems.flatpak import flatpak, CONFIG_FILE, UPDATES_IGNORED_FILE, FLATPAK_CONFIG_DIR, \ EXPORTS_PATH, \ get_icon_path, VERSION_1_5, VERSION_1_2, VERSION_1_12 -from bauh.gems.flatpak.config import FlatpakConfigManager -from bauh.gems.flatpak.constants import FLATHUB_API_URL -from bauh.gems.flatpak.model import FlatpakApplication -from bauh.gems.flatpak.worker import FlatpakAsyncDataLoader +from bearhub.gems.flatpak.config import FlatpakConfigManager +from bearhub.gems.flatpak.constants import FLATHUB_API_URL +from bearhub.gems.flatpak.model import FlatpakApplication +from bearhub.gems.flatpak.worker import FlatpakAsyncDataLoader DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.000Z' RE_INSTALL_REFS = re.compile(r'\d+\)\s+(.+)') diff --git a/bearhub/gems/flatpak/flatpak.py b/bearhub/gems/flatpak/flatpak.py index 89a650a7..ecfc6ad5 100755 --- a/bearhub/gems/flatpak/flatpak.py +++ b/bearhub/gems/flatpak/flatpak.py @@ -6,13 +6,13 @@ from datetime import datetime from threading import Thread from typing import List, Dict, Set, Iterable, Optional, Tuple -from bauh.api.exception import NoInternetException -from bauh.commons import system -from bauh.commons.system import new_subprocess, run_cmd, SimpleProcess, ProcessHandler, DEFAULT_LANG -from bauh.commons.util import size_to_byte -from bauh.commons.version_util import map_str_version -from bauh.gems.flatpak import EXPORTS_PATH, VERSION_1_3, VERSION_1_2, VERSION_1_5, VERSION_1_12 -from bauh.gems.flatpak.constants import FLATHUB_URL +from bearhub.api.exception import NoInternetException +from bearhub.commons import system +from bearhub.commons.system import new_subprocess, run_cmd, SimpleProcess, ProcessHandler, DEFAULT_LANG +from bearhub.commons.util import size_to_byte +from bearhub.commons.version_util import map_str_version +from bearhub.gems.flatpak import EXPORTS_PATH, VERSION_1_3, VERSION_1_2, VERSION_1_5, VERSION_1_12 +from bearhub.gems.flatpak.constants import FLATHUB_URL RE_SEVERAL_SPACES = re.compile(r'\s+') RE_COMMIT = re.compile(r'(Latest commit|Commit)\s*:\s*(.+)') diff --git a/bearhub/gems/flatpak/model.py b/bearhub/gems/flatpak/model.py index 381386e2..d611bad4 100644 --- a/bearhub/gems/flatpak/model.py +++ b/bearhub/gems/flatpak/model.py @@ -1,9 +1,9 @@ from typing import Tuple -from bauh.api.abstract.model import SoftwarePackage, PackageStatus -from bauh.commons import resource -from bauh.gems.flatpak import ROOT_DIR, VERSION_1_2 -from bauh.view.util.translation import I18n +from bearhub.api.abstract.model import SoftwarePackage, PackageStatus +from bearhub.commons import resource +from bearhub.gems.flatpak import ROOT_DIR, VERSION_1_2 +from bearhub.view.util.translation import I18n class FlatpakApplication(SoftwarePackage): diff --git a/bearhub/gems/flatpak/worker.py b/bearhub/gems/flatpak/worker.py index 9f25b59b..f1b8fbb7 100644 --- a/bearhub/gems/flatpak/worker.py +++ b/bearhub/gems/flatpak/worker.py @@ -2,12 +2,12 @@ import traceback from io import StringIO from threading import Thread -from bauh.api.abstract.cache import MemoryCache -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.controller import SoftwareManager -from bauh.api.abstract.model import PackageStatus -from bauh.gems.flatpak.constants import FLATHUB_API_URL, FLATHUB_URL -from bauh.gems.flatpak.model import FlatpakApplication +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.controller import SoftwareManager +from bearhub.api.abstract.model import PackageStatus +from bearhub.gems.flatpak.constants import FLATHUB_API_URL, FLATHUB_URL +from bearhub.gems.flatpak.model import FlatpakApplication class FlatpakAsyncDataLoader(Thread): diff --git a/bearhub/gems/web/__init__.py b/bearhub/gems/web/__init__.py index 28802793..3e9a40c3 100644 --- a/bearhub/gems/web/__init__.py +++ b/bearhub/gems/web/__init__.py @@ -1,9 +1,9 @@ import os -from bauh import __app_name__ -from bauh.api.paths import DESKTOP_ENTRIES_DIR, CONFIG_DIR, TEMP_DIR, CACHE_DIR, SHARED_FILES_DIR -from bauh.commons import resource -from bauh.commons.util import map_timestamp_file +from bearhub import __app_name__ +from bearhub.api.paths import DESKTOP_ENTRIES_DIR, CONFIG_DIR, TEMP_DIR, CACHE_DIR, SHARED_FILES_DIR +from bearhub.commons import resource +from bearhub.commons.util import map_timestamp_file ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) WEB_SHARED_DIR = f'{SHARED_FILES_DIR}/web' diff --git a/bearhub/gems/web/config.py b/bearhub/gems/web/config.py index 50852b04..cafb77b8 100644 --- a/bearhub/gems/web/config.py +++ b/bearhub/gems/web/config.py @@ -1,5 +1,5 @@ -from bauh.commons.config import YAMLConfigManager -from bauh.gems.web import CONFIG_FILE +from bearhub.commons.config import YAMLConfigManager +from bearhub.gems.web import CONFIG_FILE class WebConfigManager(YAMLConfigManager): diff --git a/bearhub/gems/web/controller.py b/bearhub/gems/web/controller.py index da486332..14d63221 100644 --- a/bearhub/gems/web/controller.py +++ b/bearhub/gems/web/controller.py @@ -15,30 +15,30 @@ import yaml from colorama import Fore from requests import Response -from bauh import __app_name__ -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.controller import SoftwareManager, SearchResult, UpgradeRequirements, TransactionResult, \ +from bearhub import __app_name__ +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.controller import SoftwareManager, SearchResult, UpgradeRequirements, TransactionResult, \ SoftwareAction, SettingsView, SettingsController -from bauh.api.abstract.disk import DiskCacheLoader -from bauh.api.abstract.handler import ProcessWatcher, TaskManager -from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction, PackageSuggestion, PackageUpdate, \ +from bearhub.api.abstract.disk import DiskCacheLoader +from bearhub.api.abstract.handler import ProcessWatcher, TaskManager +from bearhub.api.abstract.model import SoftwarePackage, CustomSoftwareAction, PackageSuggestion, PackageUpdate, \ PackageHistory, \ SuggestionPriority, PackageStatus -from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, SingleSelectComponent, \ +from bearhub.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, SingleSelectComponent, \ SelectViewType, TextInputComponent, FormComponent, FileChooserComponent, PanelComponent, ViewComponentAlignment -from bauh.api.paths import DESKTOP_ENTRIES_DIR -from bauh.commons import resource -from bauh.commons.boot import CreateConfigFile -from bauh.commons.html import bold -from bauh.commons.system import ProcessHandler, get_dir_size, SimpleProcess -from bauh.commons.view_utils import get_human_size_str -from bauh.gems.web import INSTALLED_PATH, nativefier, DESKTOP_ENTRY_PATH_PATTERN, URL_FIX_PATTERN, ENV_PATH, \ +from bearhub.api.paths import DESKTOP_ENTRIES_DIR +from bearhub.commons import resource +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.html import bold +from bearhub.commons.system import ProcessHandler, get_dir_size, SimpleProcess +from bearhub.commons.view_utils import get_human_size_str +from bearhub.gems.web import INSTALLED_PATH, nativefier, DESKTOP_ENTRY_PATH_PATTERN, URL_FIX_PATTERN, ENV_PATH, \ ROOT_DIR, TEMP_PATH, FIX_FILE_PATH, ELECTRON_CACHE_DIR, UA_CHROME, get_icon_path, URL_PROPS_PATTERN -from bauh.gems.web.config import WebConfigManager -from bauh.gems.web.environment import EnvironmentUpdater, EnvironmentComponent -from bauh.gems.web.model import WebApplication -from bauh.gems.web.search import SearchIndexManager -from bauh.gems.web.worker import SuggestionsManager, UpdateEnvironmentSettings, \ +from bearhub.gems.web.config import WebConfigManager +from bearhub.gems.web.environment import EnvironmentUpdater, EnvironmentComponent +from bearhub.gems.web.model import WebApplication +from bearhub.gems.web.search import SearchIndexManager +from bearhub.gems.web.worker import SuggestionsManager, UpdateEnvironmentSettings, \ SuggestionsLoader, SearchIndexGenerator try: diff --git a/bearhub/gems/web/environment.py b/bearhub/gems/web/environment.py index 82c4c8dc..ec06e2ac 100644 --- a/bearhub/gems/web/environment.py +++ b/bearhub/gems/web/environment.py @@ -12,18 +12,18 @@ from typing import Dict, List, Optional import requests import yaml -from bauh.api.abstract.download import FileDownloader -from bauh.api.abstract.handler import ProcessWatcher, TaskManager -from bauh.api.abstract.view import MessageType -from bauh.api.http import HttpClient -from bauh.commons import system -from bauh.commons.html import bold -from bauh.commons.system import SimpleProcess, ProcessHandler -from bauh.gems.web import ENV_PATH, NODE_DIR_PATH, NODE_BIN_PATH, NODE_MODULES_PATH, NATIVEFIER_BIN_PATH, \ +from bearhub.api.abstract.download import FileDownloader +from bearhub.api.abstract.handler import ProcessWatcher, TaskManager +from bearhub.api.abstract.view import MessageType +from bearhub.api.http import HttpClient +from bearhub.commons import system +from bearhub.commons.html import bold +from bearhub.commons.system import SimpleProcess, ProcessHandler +from bearhub.gems.web import ENV_PATH, NODE_DIR_PATH, NODE_BIN_PATH, NODE_MODULES_PATH, NATIVEFIER_BIN_PATH, \ ELECTRON_CACHE_DIR, URL_ENVIRONMENT_SETTINGS, NPM_BIN_PATH, NODE_PATHS, \ nativefier, ENVIRONMENT_SETTINGS_CACHED_FILE, ENVIRONMENT_SETTINGS_TS_FILE, get_icon_path -from bauh.gems.web.model import WebApplication -from bauh.view.util.translation import I18n +from bearhub.gems.web.model import WebApplication +from bearhub.view.util.translation import I18n class EnvironmentComponent: diff --git a/bearhub/gems/web/model.py b/bearhub/gems/web/model.py index 58217f68..062681fc 100644 --- a/bearhub/gems/web/model.py +++ b/bearhub/gems/web/model.py @@ -3,12 +3,12 @@ import os from pathlib import Path from typing import List, Optional -from bauh import __app_name__ -from bauh.api import user -from bauh.api.abstract.model import SoftwarePackage -from bauh.api.paths import AUTOSTART_DIR -from bauh.commons import resource -from bauh.gems.web import ROOT_DIR +from bearhub import __app_name__ +from bearhub.api import user +from bearhub.api.abstract.model import SoftwarePackage +from bearhub.api.paths import AUTOSTART_DIR +from bearhub.commons import resource +from bearhub.gems.web import ROOT_DIR class WebApplication(SoftwarePackage): diff --git a/bearhub/gems/web/nativefier.py b/bearhub/gems/web/nativefier.py index a59870dc..0c4a692b 100644 --- a/bearhub/gems/web/nativefier.py +++ b/bearhub/gems/web/nativefier.py @@ -2,8 +2,8 @@ import os import shutil from typing import List, Optional -from bauh.commons.system import SimpleProcess, run_cmd -from bauh.gems.web import NATIVEFIER_BIN_PATH, NODE_PATHS, ELECTRON_CACHE_DIR +from bearhub.commons.system import SimpleProcess, run_cmd +from bearhub.gems.web import NATIVEFIER_BIN_PATH, NODE_PATHS, ELECTRON_CACHE_DIR def install(url: str, name: str, output_dir: str, electron_version: Optional[str], cwd: str, system: bool, diff --git a/bearhub/gems/web/search.py b/bearhub/gems/web/search.py index 5d37f5e8..10f56bb9 100644 --- a/bearhub/gems/web/search.py +++ b/bearhub/gems/web/search.py @@ -6,7 +6,7 @@ from typing import Optional import yaml -from bauh.gems.web import SEARCH_INDEX_FILE +from bearhub.gems.web import SEARCH_INDEX_FILE class SearchIndexManager: diff --git a/bearhub/gems/web/suggestions.py b/bearhub/gems/web/suggestions.py index 8f38af13..193ba567 100644 --- a/bearhub/gems/web/suggestions.py +++ b/bearhub/gems/web/suggestions.py @@ -8,10 +8,10 @@ from typing import Optional import requests import yaml -from bauh.api.http import HttpClient -from bauh.commons.util import map_timestamp_file -from bauh.gems.web import WEB_CACHE_DIR -from bauh.view.util.translation import I18n +from bearhub.api.http import HttpClient +from bearhub.commons.util import map_timestamp_file +from bearhub.gems.web import WEB_CACHE_DIR +from bearhub.view.util.translation import I18n class SuggestionsManager: diff --git a/bearhub/gems/web/worker.py b/bearhub/gems/web/worker.py index 193ac18f..d87d27ed 100644 --- a/bearhub/gems/web/worker.py +++ b/bearhub/gems/web/worker.py @@ -5,14 +5,14 @@ from datetime import datetime, timezone from threading import Thread from typing import Optional -from bauh.api.abstract.handler import TaskManager -from bauh.commons.boot import CreateConfigFile -from bauh.commons.html import bold -from bauh.gems.web import get_icon_path -from bauh.gems.web.environment import EnvironmentUpdater -from bauh.gems.web.search import SearchIndexManager -from bauh.gems.web.suggestions import SuggestionsManager -from bauh.view.util.translation import I18n +from bearhub.api.abstract.handler import TaskManager +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.html import bold +from bearhub.gems.web import get_icon_path +from bearhub.gems.web.environment import EnvironmentUpdater +from bearhub.gems.web.search import SearchIndexManager +from bearhub.gems.web.suggestions import SuggestionsManager +from bearhub.view.util.translation import I18n class SuggestionsLoader(Thread): diff --git a/bearhub/view/core/__init__.py b/bearhub/view/core/__init__.py index c88ff18f..e69de29b 100644 --- a/bearhub/view/core/__init__.py +++ b/bearhub/view/core/__init__.py @@ -1,3 +0,0 @@ -""" -Bearhub view.core namespace package (migration in progress). -""" diff --git a/bearhub/view/core/controller.py b/bearhub/view/core/controller.py index 4da5652b..2cc17967 100755 --- a/bearhub/view/core/controller.py +++ b/bearhub/view/core/controller.py @@ -5,24 +5,24 @@ from subprocess import Popen, STDOUT from threading import Thread from typing import List, Set, Type, Tuple, Dict, Optional, Generator, Callable -from bauh.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext, UpgradeRequirements, \ +from bearhub.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext, UpgradeRequirements, \ UpgradeRequirement, TransactionResult, SoftwareAction, SettingsView, SettingsController -from bauh.api.abstract.disk import DiskCacheLoader -from bauh.api.abstract.handler import ProcessWatcher, TaskManager -from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, \ +from bearhub.api.abstract.disk import DiskCacheLoader +from bearhub.api.abstract.handler import ProcessWatcher, TaskManager +from bearhub.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, \ CustomSoftwareAction -from bauh.api.abstract.view import TabGroupComponent, MessageType -from bauh.api.exception import NoInternetException -from bauh.commons.boot import CreateConfigFile -from bauh.commons.html import bold -from bauh.commons.regex import RE_URL -from bauh.commons.util import sanitize_command_input -from bauh.view.core.config import CoreConfigManager -from bauh.view.core.settings import GenericSettingsManager -from bauh.view.core.update import check_for_update -from bauh.view.util import resource -from bauh.view.util.resource import get_path -from bauh.view.util.util import clean_app_files, restart_app +from bearhub.api.abstract.view import TabGroupComponent, MessageType +from bearhub.api.exception import NoInternetException +from bearhub.commons.boot import CreateConfigFile +from bearhub.commons.html import bold +from bearhub.commons.regex import RE_URL +from bearhub.commons.util import sanitize_command_input +from bearhub.view.core.config import CoreConfigManager +from bearhub.view.core.settings import GenericSettingsManager +from bearhub.view.core.update import check_for_update +from bearhub.view.util import resource +from bearhub.view.util.resource import get_path +from bearhub.view.util.util import clean_app_files, restart_app class GenericUpgradeRequirements(UpgradeRequirements): diff --git a/bearhub/view/core/downloader.py b/bearhub/view/core/downloader.py index 982d12e4..faa8b5f9 100644 --- a/bearhub/view/core/downloader.py +++ b/bearhub/view/core/downloader.py @@ -10,13 +10,13 @@ from pathlib import Path from threading import Thread from typing import Optional, Tuple -from bauh.api.abstract.download import FileDownloader -from bauh.api.abstract.handler import ProcessWatcher -from bauh.api.http import HttpClient -from bauh.commons.html import bold -from bauh.commons.system import ProcessHandler, SimpleProcess -from bauh.commons.view_utils import get_human_size_str -from bauh.view.util.translation import I18n +from bearhub.api.abstract.download import FileDownloader +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.api.http import HttpClient +from bearhub.commons.html import bold +from bearhub.commons.system import ProcessHandler, SimpleProcess +from bearhub.commons.view_utils import get_human_size_str +from bearhub.view.util.translation import I18n RE_HAS_EXTENSION = re.compile(r'.+\.\w+$') diff --git a/bearhub/view/core/gems.py b/bearhub/view/core/gems.py index 2d34df24..2dd5580d 100644 --- a/bearhub/view/core/gems.py +++ b/bearhub/view/core/gems.py @@ -1,2 +1,101 @@ -from bauh.view.core.gems import * # noqa: F401,F403 +import importlib +import inspect +import os +from logging import Logger +from typing import Dict, Generator, List, Optional, Tuple +from bearhub import ROOT_DIR as BEARHUB_ROOT_DIR, __app_name__ +from bearhub.api.abstract.controller import ApplicationContext, SoftwareManager +from bearhub.view.util import translation + +_LEGACY_BAUH_ROOT = os.path.join(os.path.dirname(BEARHUB_ROOT_DIR), 'bauh') + +FORBIDDEN_GEMS_FILE = f'/etc/{__app_name__}/gems.forbidden' + + +def find_manager(member): + if not isinstance(member, str): + if inspect.isclass(member) and inspect.getmro(member)[1].__name__ == 'SoftwareManager': + return member + elif inspect.ismodule(member): + for name, mod in inspect.getmembers(member): + manager_found = find_manager(mod) + if manager_found: + return manager_found + + +def read_forbidden_gems() -> Generator[str, None, None]: + try: + with open(FORBIDDEN_GEMS_FILE) as f: + forbidden_lines = f.readlines() + + for line in forbidden_lines: + clean_line = line.strip() + + if clean_line and not clean_line.startswith('#'): + yield clean_line + + except FileNotFoundError: + pass + + +def _discover_gem_dirs() -> List[Tuple[str, str]]: + gems: Dict[str, str] = {} + + for root in (BEARHUB_ROOT_DIR, _LEGACY_BAUH_ROOT): + gems_dir = os.path.join(root, 'gems') + if not os.path.isdir(gems_dir): + continue + + for entry in os.scandir(gems_dir): + if entry.is_dir() and entry.name != '__pycache__' and entry.name not in gems: + gems[entry.name] = entry.path + + return sorted(gems.items()) + + +def _import_controller_module(gem_name: str): + for module_name in (f'bearhub.gems.{gem_name}.controller', f'bauh.gems.{gem_name}.controller'): + try: + return importlib.import_module(module_name) + except ModuleNotFoundError: + continue + + return None + + +def load_managers(locale: str, context: ApplicationContext, config: dict, default_locale: str, logger: Logger) -> List[SoftwareManager]: + managers = [] + + forbidden_gems = {gem for gem in read_forbidden_gems()} + + for gem_name, gem_path in _discover_gem_dirs(): + if gem_name in forbidden_gems: + logger.warning(f"gem '{gem_name}' could not be loaded because it was marked as forbidden in '{FORBIDDEN_GEMS_FILE}'") + continue + + module = _import_controller_module(gem_name) + + if module: + manager_class = find_manager(module) + + if manager_class: + if locale: + locale_path = f'{gem_path}/resources/locale' + + if os.path.exists(locale_path): + context.i18n.current.update(translation.get_locale_keys(locale, locale_path)[1]) + + if default_locale and context.i18n.default: + context.i18n.default.update(translation.get_locale_keys(default_locale, locale_path)[1]) + + man = manager_class(context=context) + + if config['gems'] is None: + man.set_enabled(man.is_default_enabled()) + else: + man.set_enabled(gem_name in config['gems']) + + managers.append(man) + + return managers \ No newline at end of file diff --git a/bearhub/view/core/settings.py b/bearhub/view/core/settings.py index ae276e56..affad9e5 100644 --- a/bearhub/view/core/settings.py +++ b/bearhub/view/core/settings.py @@ -7,17 +7,17 @@ from typing import List, Tuple, Optional, Dict, Type, Iterable from PyQt5.QtWidgets import QApplication, QStyleFactory -from bauh import ROOT_DIR, __app_name__ -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.controller import SoftwareManager, SettingsController, SettingsView -from bauh.api.abstract.view import TabComponent, InputOption, TextComponent, MultipleSelectComponent, \ +from bearhub import ROOT_DIR, __app_name__ +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.controller import SoftwareManager, SettingsController, SettingsView +from bearhub.api.abstract.view import TabComponent, InputOption, TextComponent, MultipleSelectComponent, \ PanelComponent, FormComponent, TabGroupComponent, SingleSelectComponent, SelectViewType, TextInputComponent, \ FileChooserComponent, RangeInputComponent, ViewComponentAlignment -from bauh.commons.view_utils import new_select -from bauh.view.core import timeshift -from bauh.view.core.config import CoreConfigManager, BACKUP_REMOVE_METHODS, BACKUP_DEFAULT_REMOVE_METHOD -from bauh.view.core.downloader import AdaptableFileDownloader -from bauh.view.util import translation +from bearhub.commons.view_utils import new_select +from bearhub.view.core import timeshift +from bearhub.view.core.config import CoreConfigManager, BACKUP_REMOVE_METHODS, BACKUP_DEFAULT_REMOVE_METHOD +from bearhub.view.core.downloader import AdaptableFileDownloader +from bearhub.view.util import translation class GenericSettingsManager(SettingsController): diff --git a/bearhub/view/core/suggestions.py b/bearhub/view/core/suggestions.py index 280f3a88..76c19658 100644 --- a/bearhub/view/core/suggestions.py +++ b/bearhub/view/core/suggestions.py @@ -1,6 +1,6 @@ import os from typing import Optional, Dict -from bauh import __app_name__ +from bearhub import __app_name__ def read_suggestions_mapping() -> Optional[Dict[str, str]]: diff --git a/bearhub/view/core/timeshift.py b/bearhub/view/core/timeshift.py index 2ed1f99a..886ea3ef 100644 --- a/bearhub/view/core/timeshift.py +++ b/bearhub/view/core/timeshift.py @@ -2,8 +2,8 @@ import re import shutil from typing import Optional, Generator -from bauh import __app_name__ -from bauh.commons.system import SimpleProcess, new_root_subprocess +from bearhub import __app_name__ +from bearhub.commons.system import SimpleProcess, new_root_subprocess RE_SNAPSHOTS = re.compile(r'\d+\s+>\s+([\w\-_]+)\s+.+<{}>'.format(__app_name__)) diff --git a/bearhub/view/core/tray_client.py b/bearhub/view/core/tray_client.py index 1bdad0f9..a7627546 100644 --- a/bearhub/view/core/tray_client.py +++ b/bearhub/view/core/tray_client.py @@ -1,6 +1,6 @@ from pathlib import Path -from bauh.api.paths import CACHE_DIR +from bearhub.api.paths import CACHE_DIR TRAY_CHECK_FILE = f'{CACHE_DIR}/notify_tray' # it is a file that signals to the tray icon it should recheck for updates diff --git a/bearhub/view/core/update.py b/bearhub/view/core/update.py index e1953201..70b02518 100644 --- a/bearhub/view/core/update.py +++ b/bearhub/view/core/update.py @@ -2,12 +2,12 @@ import logging import os from pathlib import Path -from bauh import __app_name__, __version__ -from bauh.api.http import HttpClient -from bauh.api.paths import CACHE_DIR -from bauh.commons.html import bold, link -from bauh.commons.version_util import normalize_version -from bauh.view.util.translation import I18n +from bearhub import __app_name__, __version__ +from bearhub.api.http import HttpClient +from bearhub.api.paths import CACHE_DIR +from bearhub.commons.html import bold, link +from bearhub.commons.version_util import normalize_version +from bearhub.view.util.translation import I18n def check_for_update(logger: logging.Logger, http_client: HttpClient, i18n: I18n, tray: bool = False) -> str: diff --git a/bearhub/view/qt/about.py b/bearhub/view/qt/about.py index 7a8ab56b..629c4eb5 100644 --- a/bearhub/view/qt/about.py +++ b/bearhub/view/qt/about.py @@ -3,9 +3,9 @@ from glob import glob from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLabel, QWidget, QHBoxLayout, QSizePolicy, QApplication -from bauh import __version__, ROOT_DIR -from bauh.context import generate_i18n -from bauh.view.util import resource +from bearhub import __version__, ROOT_DIR +from bearhub.context import generate_i18n +from bearhub.view.util import resource DISPLAY_NAME = 'Bearhub' PROJECT_URL = 'https://github.com/spalencsar/bearhub' diff --git a/bearhub/view/qt/apps_table.py b/bearhub/view/qt/apps_table.py index 3fe9a583..c8ec77fa 100644 --- a/bearhub/view/qt/apps_table.py +++ b/bearhub/view/qt/apps_table.py @@ -10,17 +10,17 @@ from PyQt5.QtGui import QPixmap, QIcon, QCursor from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QToolButton, QWidget, \ QHeaderView, QLabel, QHBoxLayout, QToolBar, QSizePolicy -from bauh.api.abstract.cache import MemoryCache -from bauh.api.abstract.model import PackageStatus, CustomSoftwareAction -from bauh.api.abstract.view import MessageType -from bauh.commons.html import strip_html, bold -from bauh.commons.regex import RE_URL -from bauh.view.qt.components import IconButton, QCustomMenuAction, QCustomToolbar -from bauh.view.qt.dialog import ConfirmationDialog -from bauh.view.qt.qt_utils import get_current_screen_geometry -from bauh.view.qt.thread import URLFileDownloader -from bauh.view.qt.view_model import PackageView -from bauh.view.util.translation import I18n +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.abstract.model import PackageStatus, CustomSoftwareAction +from bearhub.api.abstract.view import MessageType +from bearhub.commons.html import strip_html, bold +from bearhub.commons.regex import RE_URL +from bearhub.view.qt.components import IconButton, QCustomMenuAction, QCustomToolbar +from bearhub.view.qt.dialog import ConfirmationDialog +from bearhub.view.qt.qt_utils import get_current_screen_geometry +from bearhub.view.qt.thread import URLFileDownloader +from bearhub.view.qt.view_model import PackageView +from bearhub.view.util.translation import I18n class UpgradeToggleButton(QToolButton): diff --git a/bearhub/view/qt/commons.py b/bearhub/view/qt/commons.py index 919239b9..32773c3d 100644 --- a/bearhub/view/qt/commons.py +++ b/bearhub/view/qt/commons.py @@ -1,7 +1,7 @@ from typing import List, Dict, Any, NamedTuple, Optional, Union, Collection, Iterable -from bauh.api.abstract.model import SoftwarePackage -from bauh.view.qt.view_model import PackageView +from bearhub.api.abstract.model import SoftwarePackage +from bearhub.view.qt.view_model import PackageView class PackageFilters(NamedTuple): diff --git a/bearhub/view/qt/components.py b/bearhub/view/qt/components.py index dabd6bc9..568649e1 100644 --- a/bearhub/view/qt/components.py +++ b/bearhub/view/qt/components.py @@ -9,11 +9,11 @@ from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGrid QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout, QFormLayout, QFileDialog, QTabWidget, QVBoxLayout, \ QSlider, QScrollArea, QFrame, QAction, QSpinBox, QPlainTextEdit, QWidgetAction, QPushButton, QMenu -from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \ +from bearhub.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \ TextInputComponent, FormComponent, FileChooserComponent, ViewComponent, TabGroupComponent, PanelComponent, \ TwoStateButtonComponent, TextComponent, SpacerComponent, RangeInputComponent, ViewObserver, TextInputType, \ ViewComponentAlignment -from bauh.view.util.translation import I18n +from bearhub.view.util.translation import I18n class QtComponentsManager: diff --git a/bearhub/view/qt/dialog.py b/bearhub/view/qt/dialog.py index 94de3e11..ea85594b 100644 --- a/bearhub/view/qt/dialog.py +++ b/bearhub/view/qt/dialog.py @@ -5,10 +5,10 @@ from PyQt5.QtGui import QIcon, QCursor from PyQt5.QtWidgets import QMessageBox, QLabel, QWidget, QHBoxLayout, QDialog, QVBoxLayout, QSizePolicy, QPushButton, \ QScrollArea, QFrame -from bauh.api.abstract.view import MessageType -from bauh.view.qt.components import new_spacer -from bauh.view.util import resource -from bauh.view.util.translation import I18n +from bearhub.api.abstract.view import MessageType +from bearhub.view.qt.components import new_spacer +from bearhub.view.util import resource +from bearhub.view.util.translation import I18n MSG_TYPE_MAP = { MessageType.ERROR: QMessageBox.Critical, diff --git a/bearhub/view/qt/history.py b/bearhub/view/qt/history.py index 30ad4d02..65ae40f8 100644 --- a/bearhub/view/qt/history.py +++ b/bearhub/view/qt/history.py @@ -5,10 +5,10 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QIcon, QCursor from PyQt5.QtWidgets import QDialog, QVBoxLayout, QTableWidget, QHeaderView, QLabel -from bauh.api.abstract.cache import MemoryCache -from bauh.api.abstract.model import PackageHistory -from bauh.view.qt.view_model import PackageView -from bauh.view.util.translation import I18n +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.abstract.model import PackageHistory +from bearhub.view.qt.view_model import PackageView +from bearhub.view.util.translation import I18n class HistoryDialog(QDialog): diff --git a/bearhub/view/qt/info.py b/bearhub/view/qt/info.py index 01abcacc..f420487e 100644 --- a/bearhub/view/qt/info.py +++ b/bearhub/view/qt/info.py @@ -10,11 +10,11 @@ from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \ QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QScrollArea, QFrame, QWidget, QSizePolicy, \ QHBoxLayout -from bauh.api.abstract.cache import MemoryCache -from bauh.commons.regex import RE_URL -from bauh.view.qt.components import new_spacer -from bauh.view.qt.qt_utils import get_current_screen_geometry -from bauh.view.util.translation import I18n +from bearhub.api.abstract.cache import MemoryCache +from bearhub.commons.regex import RE_URL +from bearhub.view.qt.components import new_spacer +from bearhub.view.qt.qt_utils import get_current_screen_geometry +from bearhub.view.util.translation import I18n IGNORED_ATTRS = {'name', '__app__'} diff --git a/bearhub/view/qt/prepare.py b/bearhub/view/qt/prepare.py index fc80fd83..34412561 100644 --- a/bearhub/view/qt/prepare.py +++ b/bearhub/view/qt/prepare.py @@ -9,16 +9,16 @@ from PyQt5.QtGui import QIcon, QCursor, QCloseEvent, QShowEvent from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QSizePolicy, QTableWidget, QHeaderView, QPushButton, \ QProgressBar, QPlainTextEdit, QToolButton, QHBoxLayout -from bauh import __app_name__ -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.controller import SoftwareManager, SoftwareAction -from bauh.api.abstract.handler import TaskManager -from bauh.api import user -from bauh.view.qt.components import new_spacer, QCustomToolbar -from bauh.view.qt.qt_utils import centralize, get_current_screen_geometry -from bauh.view.qt.root import RootDialog -from bauh.view.qt.thread import AnimateProgress -from bauh.view.util.translation import I18n +from bearhub import __app_name__ +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.controller import SoftwareManager, SoftwareAction +from bearhub.api.abstract.handler import TaskManager +from bearhub.api import user +from bearhub.view.qt.components import new_spacer, QCustomToolbar +from bearhub.view.qt.qt_utils import centralize, get_current_screen_geometry +from bearhub.view.qt.root import RootDialog +from bearhub.view.qt.thread import AnimateProgress +from bearhub.view.util.translation import I18n class Prepare(QThread, TaskManager): diff --git a/bearhub/view/qt/qt_utils.py b/bearhub/view/qt/qt_utils.py index 0bcaa7c9..f0761803 100644 --- a/bearhub/view/qt/qt_utils.py +++ b/bearhub/view/qt/qt_utils.py @@ -4,7 +4,7 @@ from PyQt5.QtCore import Qt, QRect, QPoint from PyQt5.QtGui import QIcon, QPixmap from PyQt5.QtWidgets import QWidget, QApplication, QDesktopWidget -from bauh.view.util import resource +from bearhub.view.util import resource desktop: Optional[QDesktopWidget] = None diff --git a/bearhub/view/qt/root.py b/bearhub/view/qt/root.py index 0c58c10c..eea312c2 100644 --- a/bearhub/view/qt/root.py +++ b/bearhub/view/qt/root.py @@ -7,12 +7,12 @@ from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import QLineEdit, QApplication, QDialog, QPushButton, QVBoxLayout, \ QSizePolicy, QToolBar, QLabel -from bauh.api.abstract.context import ApplicationContext -from bauh.commons.system import new_subprocess -from bauh.view.core.config import CoreConfigManager -from bauh.view.qt.components import QtComponentsManager, new_spacer -from bauh.view.util import util -from bauh.view.util.translation import I18n +from bearhub.api.abstract.context import ApplicationContext +from bearhub.commons.system import new_subprocess +from bearhub.view.core.config import CoreConfigManager +from bearhub.view.qt.components import QtComponentsManager, new_spacer +from bearhub.view.util import util +from bearhub.view.util.translation import I18n ACTION_ASK_ROOT = 99 diff --git a/bearhub/view/qt/screenshots.py b/bearhub/view/qt/screenshots.py index 08a30fe0..b340711d 100644 --- a/bearhub/view/qt/screenshots.py +++ b/bearhub/view/qt/screenshots.py @@ -9,13 +9,13 @@ from PyQt5.QtGui import QIcon, QPixmap, QCursor from PyQt5.QtWidgets import QDialog, QLabel, QPushButton, QVBoxLayout, QProgressBar, QApplication, QWidget, \ QSizePolicy, QHBoxLayout -from bauh.api.abstract.cache import MemoryCache -from bauh.api.http import HttpClient -from bauh.view.qt import qt_utils -from bauh.view.qt.components import new_spacer -from bauh.view.qt.thread import AnimateProgress -from bauh.view.qt.view_model import PackageView -from bauh.view.util.translation import I18n +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.http import HttpClient +from bearhub.view.qt import qt_utils +from bearhub.view.qt.components import new_spacer +from bearhub.view.qt.thread import AnimateProgress +from bearhub.view.qt.view_model import PackageView +from bearhub.view.util.translation import I18n class ScreenshotsDialog(QDialog): diff --git a/bearhub/view/qt/settings.py b/bearhub/view/qt/settings.py index 2b1d9bdd..1710c291 100644 --- a/bearhub/view/qt/settings.py +++ b/bearhub/view/qt/settings.py @@ -6,16 +6,16 @@ from PyQt5.QtCore import Qt, QCoreApplication, QThread, pyqtSignal from PyQt5.QtGui import QCursor, QShowEvent from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QPushButton, QHBoxLayout, QApplication -from bauh import __app_name__ -from bauh.api.abstract.controller import SoftwareManager -from bauh.api.abstract.view import MessageType -from bauh.view.core.controller import GenericSoftwareManager -from bauh.view.qt import dialog -from bauh.view.qt.components import to_widget, new_spacer -from bauh.view.qt.dialog import ConfirmationDialog -from bauh.view.qt.qt_utils import centralize -from bauh.view.util import util -from bauh.view.util.translation import I18n +from bearhub import __app_name__ +from bearhub.api.abstract.controller import SoftwareManager +from bearhub.api.abstract.view import MessageType +from bearhub.view.core.controller import GenericSoftwareManager +from bearhub.view.qt import dialog +from bearhub.view.qt.components import to_widget, new_spacer +from bearhub.view.qt.dialog import ConfirmationDialog +from bearhub.view.qt.qt_utils import centralize +from bearhub.view.util import util +from bearhub.view.util.translation import I18n class ReloadManagePanel(QThread): diff --git a/bearhub/view/qt/systray.py b/bearhub/view/qt/systray.py index f17bcc91..b3997396 100755 --- a/bearhub/view/qt/systray.py +++ b/bearhub/view/qt/systray.py @@ -13,17 +13,17 @@ from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication, QSize from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QSystemTrayIcon, QMenu -from bauh import __app_name__, ROOT_DIR -from bauh.api.abstract.model import PackageUpdate -from bauh.api.http import HttpClient -from bauh.commons import system -from bauh.context import generate_i18n -from bauh.view.core.tray_client import TRAY_CHECK_FILE -from bauh.view.core.update import check_for_update -from bauh.view.qt.about import AboutDialog -from bauh.view.qt.qt_utils import load_resource_icon -from bauh.view.util import util, resource -from bauh.view.util.translation import I18n +from bearhub import __app_name__, ROOT_DIR +from bearhub.api.abstract.model import PackageUpdate +from bearhub.api.http import HttpClient +from bearhub.commons import system +from bearhub.context import generate_i18n +from bearhub.view.core.tray_client import TRAY_CHECK_FILE +from bearhub.view.core.update import check_for_update +from bearhub.view.qt.about import AboutDialog +from bearhub.view.qt.qt_utils import load_resource_icon +from bearhub.view.util import util, resource +from bearhub.view.util.translation import I18n CLI_NAME = f'{__app_name__}-cli' diff --git a/bearhub/view/qt/thread.py b/bearhub/view/qt/thread.py index 64fd5652..afb0dfd3 100644 --- a/bearhub/view/qt/thread.py +++ b/bearhub/view/qt/thread.py @@ -16,28 +16,28 @@ from PyQt5.QtCore import QThread, pyqtSignal, QObject from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QWidget -from bauh.api import user -from bauh.api.abstract.cache import MemoryCache -from bauh.api.abstract.controller import SoftwareManager, UpgradeRequirement, UpgradeRequirements, SoftwareAction -from bauh.api.abstract.handler import ProcessWatcher -from bauh.api.abstract.model import PackageStatus, SoftwarePackage, CustomSoftwareAction -from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, TextComponent, \ +from bearhub.api import user +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.abstract.controller import SoftwareManager, UpgradeRequirement, UpgradeRequirements, SoftwareAction +from bearhub.api.abstract.handler import ProcessWatcher +from bearhub.api.abstract.model import PackageStatus, SoftwarePackage, CustomSoftwareAction +from bearhub.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, TextComponent, \ FormComponent, ViewComponent -from bauh.api.exception import NoInternetException -from bauh.api.paths import LOGS_DIR -from bauh.commons.html import bold -from bauh.commons.internet import InternetChecker -from bauh.commons.regex import RE_URL -from bauh.commons.system import ProcessHandler, SimpleProcess -from bauh.commons.view_utils import get_human_size_str -from bauh.view.core import timeshift -from bauh.view.core.config import CoreConfigManager, BACKUP_REMOVE_METHODS, BACKUP_DEFAULT_REMOVE_METHOD -from bauh.view.qt import commons -from bauh.view.qt.commons import sort_packages, PackageFilters -from bauh.view.qt.qt_utils import get_current_screen_geometry -from bauh.view.qt.view_index import query_packages -from bauh.view.qt.view_model import PackageView, PackageViewStatus -from bauh.view.util.translation import I18n +from bearhub.api.exception import NoInternetException +from bearhub.api.paths import LOGS_DIR +from bearhub.commons.html import bold +from bearhub.commons.internet import InternetChecker +from bearhub.commons.regex import RE_URL +from bearhub.commons.system import ProcessHandler, SimpleProcess +from bearhub.commons.view_utils import get_human_size_str +from bearhub.view.core import timeshift +from bearhub.view.core.config import CoreConfigManager, BACKUP_REMOVE_METHODS, BACKUP_DEFAULT_REMOVE_METHOD +from bearhub.view.qt import commons +from bearhub.view.qt.commons import sort_packages, PackageFilters +from bearhub.view.qt.qt_utils import get_current_screen_geometry +from bearhub.view.qt.view_index import query_packages +from bearhub.view.qt.view_model import PackageView, PackageViewStatus +from bearhub.view.util.translation import I18n RE_VERSION_IN_NAME = re.compile(r'\s+version\s+[\w.]+\s*$') diff --git a/bearhub/view/qt/view_index.py b/bearhub/view/qt/view_index.py index 00041c5e..76d6a8c9 100644 --- a/bearhub/view/qt/view_index.py +++ b/bearhub/view/qt/view_index.py @@ -1,8 +1,8 @@ from collections import defaultdict from typing import Dict, List, Generator, Tuple, Optional, Union -from bauh.view.qt.commons import PackageFilters -from bauh.view.qt.view_model import PackageView +from bearhub.view.qt.commons import PackageFilters +from bearhub.view.qt.view_model import PackageView def new_character_idx() -> Dict[str, List[PackageView]]: diff --git a/bearhub/view/qt/view_model.py b/bearhub/view/qt/view_model.py index cab67179..3e1a62ec 100644 --- a/bearhub/view/qt/view_model.py +++ b/bearhub/view/qt/view_model.py @@ -1,7 +1,7 @@ from enum import Enum -from bauh.api.abstract.model import SoftwarePackage, PackageStatus -from bauh.view.util.translation import I18n +from bearhub.api.abstract.model import SoftwarePackage, PackageStatus +from bearhub.view.util.translation import I18n class PackageViewStatus(Enum): diff --git a/bearhub/view/qt/window.py b/bearhub/view/qt/window.py index 7fb06c86..de0ae26e 100755 --- a/bearhub/view/qt/window.py +++ b/bearhub/view/qt/window.py @@ -12,42 +12,42 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolB QLabel, QPlainTextEdit, QProgressBar, QPushButton, QComboBox, QApplication, QListView, QSizePolicy, \ QMenu, QHBoxLayout -from bauh.api import user -from bauh.api.abstract.cache import MemoryCache -from bauh.api.abstract.context import ApplicationContext -from bauh.api.abstract.controller import SoftwareManager, SoftwareAction -from bauh.api.abstract.model import SoftwarePackage -from bauh.api.abstract.view import MessageType -from bauh.api.http import HttpClient -from bauh.api.paths import LOGS_DIR -from bauh.commons.html import bold -from bauh.context import set_theme -from bauh.stylesheet import read_all_themes_metadata, ThemeMetadata -from bauh.view.core.config import CoreConfigManager -from bauh.view.core.tray_client import notify_tray -from bauh.view.qt import dialog, commons, qt_utils -from bauh.view.qt.about import AboutDialog -from bauh.view.qt.apps_table import PackagesTable, UpgradeToggleButton -from bauh.view.qt.commons import sum_updates_displayed, PackageFilters -from bauh.view.qt.components import new_spacer, IconButton, QtComponentsManager, to_widget, QSearchBar, \ +from bearhub.api import user +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.abstract.context import ApplicationContext +from bearhub.api.abstract.controller import SoftwareManager, SoftwareAction +from bearhub.api.abstract.model import SoftwarePackage +from bearhub.api.abstract.view import MessageType +from bearhub.api.http import HttpClient +from bearhub.api.paths import LOGS_DIR +from bearhub.commons.html import bold +from bearhub.context import set_theme +from bearhub.stylesheet import read_all_themes_metadata, ThemeMetadata +from bearhub.view.core.config import CoreConfigManager +from bearhub.view.core.tray_client import notify_tray +from bearhub.view.qt import dialog, commons, qt_utils +from bearhub.view.qt.about import AboutDialog +from bearhub.view.qt.apps_table import PackagesTable, UpgradeToggleButton +from bearhub.view.qt.commons import sum_updates_displayed, PackageFilters +from bearhub.view.qt.components import new_spacer, IconButton, QtComponentsManager, to_widget, QSearchBar, \ QCustomMenuAction, QCustomToolbar -from bauh.view.qt.dialog import ConfirmationDialog -from bauh.view.qt.history import HistoryDialog -from bauh.view.qt.info import InfoDialog -from bauh.view.qt.qt_utils import get_current_screen_geometry -from bauh.view.qt.root import RootDialog -from bauh.view.qt.screenshots import ScreenshotsDialog -from bauh.view.qt.settings import SettingsWindow -from bauh.view.qt.thread import UpgradeSelected, RefreshApps, UninstallPackage, DowngradePackage, ShowPackageInfo, \ +from bearhub.view.qt.dialog import ConfirmationDialog +from bearhub.view.qt.history import HistoryDialog +from bearhub.view.qt.info import InfoDialog +from bearhub.view.qt.qt_utils import get_current_screen_geometry +from bearhub.view.qt.root import RootDialog +from bearhub.view.qt.screenshots import ScreenshotsDialog +from bearhub.view.qt.settings import SettingsWindow +from bearhub.view.qt.thread import UpgradeSelected, RefreshApps, UninstallPackage, DowngradePackage, ShowPackageInfo, \ ShowPackageHistory, SearchPackages, InstallPackage, AnimateProgress, NotifyPackagesReady, FindSuggestions, \ ListWarnings, \ AsyncAction, LaunchPackage, ApplyFilters, CustomSoftwareAction, ShowScreenshots, CustomAction, \ NotifyInstalledLoaded, \ IgnorePackageUpdates, SaveTheme, StartAsyncAction -from bauh.view.qt.view_index import add_to_index, new_package_index -from bauh.view.qt.view_model import PackageView, PackageViewStatus -from bauh.view.util import util, resource -from bauh.view.util.translation import I18n +from bearhub.view.qt.view_index import add_to_index, new_package_index +from bearhub.view.qt.view_model import PackageView, PackageViewStatus +from bearhub.view.util import util, resource +from bearhub.view.util.translation import I18n DARK_ORANGE = '#FF4500' diff --git a/bearhub/view/util/cache.py b/bearhub/view/util/cache.py index ae119351..4f6ecb5d 100644 --- a/bearhub/view/util/cache.py +++ b/bearhub/view/util/cache.py @@ -2,7 +2,7 @@ import datetime from threading import Lock from typing import Optional -from bauh.api.abstract.cache import MemoryCache, MemoryCacheFactory +from bearhub.api.abstract.cache import MemoryCache, MemoryCacheFactory class DefaultMemoryCache(MemoryCache): diff --git a/bearhub/view/util/disk.py b/bearhub/view/util/disk.py index f460f45f..b7bed255 100644 --- a/bearhub/view/util/disk.py +++ b/bearhub/view/util/disk.py @@ -7,9 +7,9 @@ from typing import Type, Dict, Any, Optional import yaml -from bauh.api.abstract.cache import MemoryCache -from bauh.api.abstract.disk import DiskCacheLoader, DiskCacheLoaderFactory -from bauh.api.abstract.model import SoftwarePackage +from bearhub.api.abstract.cache import MemoryCache +from bearhub.api.abstract.disk import DiskCacheLoader, DiskCacheLoaderFactory +from bearhub.api.abstract.model import SoftwarePackage class AsyncDiskCacheLoader(Thread, DiskCacheLoader): diff --git a/bearhub/view/util/translation.py b/bearhub/view/util/translation.py index 807c2cdf..aead9454 100644 --- a/bearhub/view/util/translation.py +++ b/bearhub/view/util/translation.py @@ -3,7 +3,7 @@ import locale import os from typing import Tuple, Set -from bauh.view.util import resource +from bearhub.view.util import resource class I18n(dict): diff --git a/bearhub/view/util/util.py b/bearhub/view/util/util.py index 1611d20e..03e3d0e5 100644 --- a/bearhub/view/util/util.py +++ b/bearhub/view/util/util.py @@ -9,11 +9,11 @@ from PyQt5.QtCore import QCoreApplication from PyQt5.QtGui import QIcon from colorama import Fore -from bauh import __app_name__ -from bauh.api.abstract.controller import SoftwareManager -from bauh.api.paths import CONFIG_DIR, CACHE_DIR, TEMP_DIR -from bauh.commons.system import run_cmd -from bauh.view.util import resource +from bearhub import __app_name__ +from bearhub.api.abstract.controller import SoftwareManager +from bearhub.api.paths import CONFIG_DIR, CACHE_DIR, TEMP_DIR +from bearhub.commons.system import run_cmd +from bearhub.view.util import resource def notify_user(msg: str, icon_path: str = None): diff --git a/docs/qt6-migration.md b/docs/qt6-migration.md index 71687bc1..d65caa97 100644 --- a/docs/qt6-migration.md +++ b/docs/qt6-migration.md @@ -19,7 +19,7 @@ Related roadmap milestone: `ROADMAP.md` → **M6: Qt6 Migration**. ## Prerequisites -- **M3** namespace migration is complete enough that UI modules live under stable `bearhub.*` import paths. +- **M3** Phase B is complete: UI modules live under stable `bearhub.*` import paths (`bearhub/view/qt/*`, etc.). Wait for an M3 stable tag before starting PR-6.2. - **M2** thread/uninstall crash paths are documented and reproducible. - Unit test CI is green (`tests/`, GitHub workflow `tests.yml`). @@ -30,11 +30,11 @@ Runtime PyQt5 usage is concentrated in: | Area | Files | Notes | |---|---|---| | App entry | `bearhub/app_main.py`, `bearhub/context.py`, `bearhub/manage.py`, `bearhub/tray.py` | app attributes, screen scale env | -| Main window/UI | `bauh/view/qt/window.py`, `apps_table.py`, `components.py`, `dialog.py` | largest migration surface | -| Async/threading | `bauh/view/qt/thread.py`, `prepare.py`, `systray.py`, `settings.py`, `root.py` | `QThread`, `pyqtSignal` | -| Utility/UI helpers | `bauh/view/qt/qt_utils.py`, `about.py`, `info.py`, `history.py`, `screenshots.py` | includes `QDesktopWidget` | -| Settings integration | `bauh/view/core/settings.py` | `QStyleFactory` | -| Misc | `bauh/view/util/util.py` | icon helpers | +| Main window/UI | `bearhub/view/qt/window.py`, `apps_table.py`, `components.py`, `dialog.py` | largest migration surface | +| Async/threading | `bearhub/view/qt/thread.py`, `prepare.py`, `systray.py`, `settings.py`, `root.py` | `QThread`, `pyqtSignal` | +| Utility/UI helpers | `bearhub/view/qt/qt_utils.py`, `about.py`, `info.py`, `history.py`, `screenshots.py` | includes `QDesktopWidget` | +| Settings integration | `bearhub/view/core/settings.py` | `QStyleFactory` | +| Misc | `bearhub/view/util/util.py` | icon helpers | Known Qt5-specific patterns in code today: diff --git a/packaging/aur/README.md b/packaging/aur/README.md index da13a49d..1900eaad 100644 --- a/packaging/aur/README.md +++ b/packaging/aur/README.md @@ -13,13 +13,13 @@ Before publishing: ## Stable release checklist (`bearhub`) -1. Update `CHANGELOG.md` and packaging paths for the new tag (e.g. `0.10.7-bearhub.6`). +1. Move `CHANGELOG.md` `[Unreleased]` entries under the new tag (e.g. `0.10.7-bearhub.7` or `0.10.8`). 2. Commit all release changes on `main`. 3. Create and push the git tag: ```bash - git tag -a 0.10.7-bearhub.6 -m "Release 0.10.7-bearhub.6" + git tag -a 0.10.7-bearhub.7 -m "Release 0.10.7-bearhub.7" git push origin main - git push origin 0.10.7-bearhub.6 + git push origin 0.10.7-bearhub.7 ``` 4. Refresh tarball checksum in `bearhub/PKGBUILD`: ```bash @@ -32,4 +32,4 @@ Before publishing: scripts/sync-aur-packaging.sh ``` 6. Build-test both AUR packages, then publish AUR commits. -7. Optional: create GitHub release from tag `0.10.7-bearhub.6`. +7. Optional: create GitHub release from the new tag. diff --git a/pyproject.toml b/pyproject.toml index 6105e7d7..a4ec3a7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,14 +50,14 @@ Repository = "https://github.com/spalencsar/bearhub" license-files = ["LICENSE"] [tool.setuptools.dynamic] -version = {attr = "bauh.__version__"} +version = {attr = "bearhub.__version__"} [tool.setuptools.packages.find] exclude = ["tests.*", "tests"] [tool.setuptools.package-data] -bearhub = ["desktop/*"] -bauh = [ +bearhub = [ + "desktop/*", "view/resources/locale/*", "view/resources/img/*", "view/resources/style/*", @@ -65,3 +65,4 @@ bauh = [ "gems/*/resources/img/*", "gems/*/resources/locale/*", ] +bauh = [] diff --git a/setup.py b/setup.py index 0c112ae4..da149454 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ DESCRIPTION = ( AUTHOR = "Vinicius Moreira" AUTHOR_EMAIL = "vinicius_fmoreira@hotmail.com" DIST_NAME = 'bearhub' -APP_PACKAGE = 'bauh' +APP_PACKAGE = 'bearhub' URL = "https://github.com/spalencsar/" + DIST_NAME file_dir = os.path.dirname(os.path.abspath(__file__)) @@ -23,7 +23,10 @@ else: with open(file_dir + '/{}/__init__.py'.format(APP_PACKAGE), 'r') as f: - exec(f.readlines()[0]) + for line in f: + if line.startswith('__version__'): + exec(line) + break setup( @@ -38,6 +41,7 @@ setup( packages=find_packages(exclude=["tests.*", "tests"]), package_data={ APP_PACKAGE: [ + "desktop/*", "view/resources/locale/*", "view/resources/img/*", "view/resources/style/*", @@ -45,7 +49,6 @@ setup( "gems/*/resources/img/*", "gems/*/resources/locale/*", ], - "bearhub": ["desktop/*"], }, install_requires=requirements, test_suite="tests", @@ -66,4 +69,4 @@ setup( 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8' ] -) +) \ No newline at end of file diff --git a/tests/api/abstract/test_model.py b/tests/api/abstract/test_model.py index 1c1ae843..e7983bb1 100644 --- a/tests/api/abstract/test_model.py +++ b/tests/api/abstract/test_model.py @@ -1,6 +1,6 @@ from unittest import TestCase -from bauh.api.abstract.model import PackageUpdate +from bearhub.api.abstract.model import PackageUpdate class PackageUpdateTest(TestCase): diff --git a/tests/api/test_namespace.py b/tests/api/test_namespace.py new file mode 100644 index 00000000..a25d0732 --- /dev/null +++ b/tests/api/test_namespace.py @@ -0,0 +1,17 @@ +from unittest import TestCase + +from bearhub.api.paths import CONFIG_DIR, CACHE_DIR +from bearhub.commons.util import size_to_byte + + +class TestApiNamespace(TestCase): + + def test_bauh_compat_api_import(self): + from bauh.api.paths import CONFIG_DIR as legacy_config + + self.assertEqual(legacy_config, CONFIG_DIR) + + def test_bauh_compat_commons_import(self): + from bauh.commons.util import size_to_byte as legacy_size + + self.assertEqual(legacy_size(1, 'K'), size_to_byte(1, 'K')) \ No newline at end of file diff --git a/tests/common/test_util.py b/tests/common/test_util.py index f883bb28..c28c6cbe 100644 --- a/tests/common/test_util.py +++ b/tests/common/test_util.py @@ -1,6 +1,6 @@ from unittest import TestCase -from bauh.commons.util import size_to_byte, sanitize_command_input +from bearhub.commons.util import size_to_byte, sanitize_command_input class SizeToByteTest(TestCase): diff --git a/tests/common/test_version_util.py b/tests/common/test_version_util.py index cf1d70ea..01c9d24f 100644 --- a/tests/common/test_version_util.py +++ b/tests/common/test_version_util.py @@ -1,7 +1,7 @@ import warnings from unittest import TestCase -from bauh.commons.version_util import match_required_version +from bearhub.commons.version_util import match_required_version class MatchRequiredVersionTest(TestCase): diff --git a/tests/common/test_view_utils.py b/tests/common/test_view_utils.py index 486fb38f..c0707155 100644 --- a/tests/common/test_view_utils.py +++ b/tests/common/test_view_utils.py @@ -1,7 +1,7 @@ import locale from unittest import TestCase -from bauh.commons.view_utils import get_human_size_str +from bearhub.commons.view_utils import get_human_size_str class GetHumanSizeStrTest(TestCase): diff --git a/tests/gems/appimage/test_namespace.py b/tests/gems/appimage/test_namespace.py new file mode 100644 index 00000000..23df03cc --- /dev/null +++ b/tests/gems/appimage/test_namespace.py @@ -0,0 +1,22 @@ +from unittest import TestCase + +from bearhub.gems.appimage.controller import AppImageManager +from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module + + +class TestAppImageNamespace(TestCase): + + def test_bauh_compat_import(self): + from bauh.gems.appimage.util import replace_desktop_entry_exec_command + + self.assertTrue(callable(replace_desktop_entry_exec_command)) + + def test_appimage_discovered_under_bearhub(self): + gem_dirs = dict(_discover_gem_dirs()) + self.assertIn('appimage', gem_dirs) + self.assertIn('bearhub/gems/appimage', gem_dirs['appimage'].replace('\\', '/')) + + def test_controller_import_prefers_bearhub(self): + module = _import_controller_module('appimage') + self.assertEqual(module.__name__, 'bearhub.gems.appimage.controller') + self.assertIs(module.AppImageManager, AppImageManager) \ No newline at end of file diff --git a/tests/gems/appimage/test_util.py b/tests/gems/appimage/test_util.py index ebf685e7..ea33e5d2 100644 --- a/tests/gems/appimage/test_util.py +++ b/tests/gems/appimage/test_util.py @@ -1,6 +1,6 @@ from unittest import TestCase -from bauh.gems.appimage.util import replace_desktop_entry_exec_command +from bearhub.gems.appimage.util import replace_desktop_entry_exec_command class TestUtil(TestCase): diff --git a/tests/gems/arch/test_aur.py b/tests/gems/arch/test_aur.py index 6f34cebe..a36a763e 100644 --- a/tests/gems/arch/test_aur.py +++ b/tests/gems/arch/test_aur.py @@ -1,7 +1,7 @@ import os from unittest import TestCase -from bauh.gems.arch import aur +from bearhub.gems.arch import aur FILE_DIR = os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/gems/arch/test_aur_data_mapper.py b/tests/gems/arch/test_aur_data_mapper.py index 24946105..50924dc2 100644 --- a/tests/gems/arch/test_aur_data_mapper.py +++ b/tests/gems/arch/test_aur_data_mapper.py @@ -2,8 +2,8 @@ import warnings from unittest import TestCase from unittest.mock import Mock -from bauh.gems.arch.mapper import AURDataMapper -from bauh.gems.arch.model import ArchPackage +from bearhub.gems.arch.mapper import AURDataMapper +from bearhub.gems.arch.model import ArchPackage class ArchDataMapperTest(TestCase): diff --git a/tests/gems/arch/test_namespace.py b/tests/gems/arch/test_namespace.py new file mode 100644 index 00000000..be8961c4 --- /dev/null +++ b/tests/gems/arch/test_namespace.py @@ -0,0 +1,22 @@ +from unittest import TestCase + +from bearhub.gems.arch.controller import ArchManager +from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module + + +class TestArchNamespace(TestCase): + + def test_bauh_compat_import(self): + from bearhub.gems.arch.model import ArchPackage + + self.assertTrue(issubclass(ArchPackage, object)) + + def test_arch_discovered_under_bearhub(self): + gem_dirs = dict(_discover_gem_dirs()) + self.assertIn('arch', gem_dirs) + self.assertIn('bearhub/gems/arch', gem_dirs['arch'].replace('\\', '/')) + + def test_controller_import_prefers_bearhub(self): + module = _import_controller_module('arch') + self.assertEqual(module.__name__, 'bearhub.gems.arch.controller') + self.assertIs(module.ArchManager, ArchManager) \ No newline at end of file diff --git a/tests/gems/arch/test_pacman.py b/tests/gems/arch/test_pacman.py index 1e62f6f4..7d8b3df4 100644 --- a/tests/gems/arch/test_pacman.py +++ b/tests/gems/arch/test_pacman.py @@ -4,7 +4,7 @@ from unittest import TestCase from unittest.mock import patch, Mock -from bauh.gems.arch import pacman +from bearhub.gems.arch import pacman FILE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -29,7 +29,7 @@ class PacmanTest(TestCase): self.assertIsNotNone(ignored) self.assertEqual(0, len(ignored)) - @patch("bauh.gems.arch.pacman.run_cmd", return_value=""" + @patch("bearhub.gems.arch.pacman.run_cmd", return_value=""" Name : package-test Version : 3.4.4-1 Description : Test @@ -42,7 +42,7 @@ Required By : None run_cmd.assert_called_once_with('pacman -Qi package-test') self.assertEqual({'package-test': {}}, res) - @patch("bauh.gems.arch.pacman.run_cmd", return_value=""" + @patch("bearhub.gems.arch.pacman.run_cmd", return_value=""" Name : package-test Version : 3.4.4-1 Description : Test @@ -55,7 +55,7 @@ Required By : None run_cmd.assert_called_once_with('pacman -Qi package-test') self.assertEqual({'package-test': {'lib32-vulkan-icd-loader': 'Vulkan support'}}, res) - @patch("bauh.gems.arch.pacman.run_cmd", return_value=""" + @patch("bearhub.gems.arch.pacman.run_cmd", return_value=""" Name : package-test Version : 3.4.4-1 Description : Test @@ -68,7 +68,7 @@ Required By : None run_cmd.assert_called_once_with('pacman -Qi package-test') self.assertEqual({'package-test': {'pipewire-alsa': ''}}, res) - @patch("bauh.gems.arch.pacman.run_cmd", return_value=""" + @patch("bearhub.gems.arch.pacman.run_cmd", return_value=""" Name : package-test Version : 3.4.4-1 Description : Test @@ -81,7 +81,7 @@ Required By : None run_cmd.assert_called_once_with('pacman -Qi package-test') self.assertEqual({'package-test': {}}, res) - @patch("bauh.gems.arch.pacman.run_cmd", return_value=""" + @patch("bearhub.gems.arch.pacman.run_cmd", return_value=""" Name : package-test Version : 3.4.4-1 Description : Test diff --git a/tests/gems/arch/test_sorting.py b/tests/gems/arch/test_sorting.py index ee9dea01..f9a7763e 100644 --- a/tests/gems/arch/test_sorting.py +++ b/tests/gems/arch/test_sorting.py @@ -1,6 +1,6 @@ from unittest import TestCase -from bauh.gems.arch import sorting +from bearhub.gems.arch import sorting class SortingTest(TestCase): diff --git a/tests/gems/arch/test_updates.py b/tests/gems/arch/test_updates.py index 4e9e6a3a..e1ae5180 100644 --- a/tests/gems/arch/test_updates.py +++ b/tests/gems/arch/test_updates.py @@ -1,11 +1,11 @@ from unittest import TestCase from unittest.mock import patch, Mock, MagicMock -from bauh.api.abstract.controller import UpgradeRequirement -from bauh.gems.arch.dependencies import DependenciesAnalyser -from bauh.gems.arch.model import ArchPackage -from bauh.gems.arch.updates import UpdatesSummarizer -from bauh.view.util.translation import I18n +from bearhub.api.abstract.controller import UpgradeRequirement +from bearhub.gems.arch.dependencies import DependenciesAnalyser +from bearhub.gems.arch.model import ArchPackage +from bearhub.gems.arch.updates import UpdatesSummarizer +from bearhub.view.util.translation import I18n class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): @@ -27,7 +27,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): "prefer_repository_provider": True, "check_dependency_breakage": True} - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_not_return_installed_to_remove_when_conflict_with_installed_version_fails(self, pacman: Mock): """ If the newest version o package A conflicts with an installed package named B, but the conflict expression @@ -75,7 +75,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertFalse(res.to_install) self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_return_installed_to_remove_when_conflict_with_installed_version_matches(self, pacman: Mock): """ If the newest version o package A conflicts with an installed package named B and the conflict expression @@ -129,7 +129,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_return_installed_to_remove_when_conflict_with_installed_matches(self, pacman: Mock): """ If the newest version o package A conflicts with an installed package named B, @@ -183,7 +183,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_not_return_installed_to_remove_when_conflict_with_is_self_conflict(self, pacman: Mock): """ If the newest version o package A conflicts with itself, then A should not be marked as a package to be removed. @@ -225,7 +225,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertFalse(res.to_install) self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_not_return_installed_to_remove_when_conflict_with_provided_version_fails(self, pacman: Mock): """ If the newest version o package A conflicts with a provided package C (by installed package B), @@ -272,7 +272,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertFalse(res.to_install) self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__not_return_to_remove_when_conflict_with_provided_virtual_package_with_version_fails(self, pacman: Mock): """ Scenario: @@ -324,7 +324,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertFalse(res.to_install) self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_installed_virtual_with_defined_version_to_remove_when_conflict_version_matches(self, pacman: Mock): """ Scenario: @@ -389,7 +389,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): pkg_b = ArchPackage(name="X", installed=True, i18n=self.i18n) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'V'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_installed_virtual_with_defined_version_to_remove_when_conflict_matches__case_2(self, pacman: Mock): """ This test case covers the same scenario as the above, but adds an additional provider for the same @@ -465,7 +465,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): pkg_b = ArchPackage(name="X", installed=True, i18n=self.i18n) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'V'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_return_installed_package_to_remove_when_conflict_with_provided_matches_version(self, pacman: Mock): """ If the newest version o package A conflicts with a provided package C (by installed package B), @@ -522,7 +522,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_return_installed_package_to_remove_when_conflict_with_provided_matches(self, pacman: Mock): """ If the newest version o package A conflicts with a provided package C (by installed package B), @@ -578,7 +578,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__should_not_return_installed_to_remove_when_conflict_with_provider_is_self_conflict(self, pacman: Mock): """ If the newest version o package A conflicts with a provided package C (by A itself), @@ -621,7 +621,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertFalse(res.to_install) self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_cannot_upgrade_when_several_to_upgrade_conflict_with_each_other(self, pacman: Mock): """ Consider package A and B are selected to be upgraded: @@ -681,7 +681,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertIn(UpgradeRequirement(pkg=pkg_a, reason=" 'B'"), res.cannot_upgrade) self.assertIn(UpgradeRequirement(pkg=pkg_b, reason=" 'A'"), res.cannot_upgrade) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_cannot_upgrade_when_several_to_upgrade_conflict_with_provided_by_each_other(self, pacman: Mock): """ Consider package A and B are selected to be upgraded: @@ -743,7 +743,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertIn(UpgradeRequirement(pkg=pkg_a, reason=" 'B'"), res.cannot_upgrade) self.assertIn(UpgradeRequirement(pkg=pkg_b, reason=" 'A'"), res.cannot_upgrade) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_to_remove_when_a_package_to_upgrade_conflicts_with_another(self, pacman: Mock): """ Consider package A and B are selected to be upgraded: @@ -805,7 +805,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_to_remove_when_a_package_to_upgrade_conflicts_with_provided_by_another(self, pacman: Mock): """ Consider package A and B are selected to be upgraded: @@ -870,7 +870,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_to_remove_when_a_package_to_upgrade_conflicts_with_provided_version_by_another(self, pacman: Mock): """ Consider package A and B are selected to be upgraded: @@ -936,8 +936,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove) - @patch("bauh.gems.arch.dependencies.pacman") - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.dependencies.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_cannot_upgrade_when_several_packages_to_install_conflict_with_each_other(self, *mocks: Mock): """ Consider package A and B are selected to be upgraded: @@ -1038,8 +1038,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertIn(UpgradeRequirement(pkg=pkg_a, reason="'C' 'D'"), res.cannot_upgrade) self.assertIn(UpgradeRequirement(pkg=pkg_b, reason="'C' 'D'"), res.cannot_upgrade) - @patch("bauh.gems.arch.dependencies.pacman") - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.dependencies.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_cannot_upgrade_when_packages_to_install_conflict_with_version_of_each_other(self, *mocks: Mock): """ Consider package A and B are selected to be upgraded: @@ -1140,8 +1140,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertIn(UpgradeRequirement(pkg=pkg_a, reason="'C' 'D'"), res.cannot_upgrade) self.assertIn(UpgradeRequirement(pkg=pkg_b, reason="'C' 'D'"), res.cannot_upgrade) - @patch("bauh.gems.arch.dependencies.pacman") - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.dependencies.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_to_remove_when_to_update_conflicts_with_to_install(self, *mocks: Mock): """ Consider package A and B are selected to be upgraded: @@ -1227,8 +1227,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) self.assertEqual([UpgradeRequirement(pkg=pkg_b, extra_size=1, reason=" 'C'")], res.to_remove) - @patch("bauh.gems.arch.dependencies.pacman") - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.dependencies.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_to_remove_when_to_update_conflicts_with_specific_version_of_install(self, *mocks: Mock): """ Consider package A and B are selected to be upgraded: @@ -1314,8 +1314,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase): self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade) self.assertEqual([UpgradeRequirement(pkg=pkg_b, extra_size=1, reason=" 'C'")], res.to_remove) - @patch("bauh.gems.arch.dependencies.pacman") - @patch("bauh.gems.arch.updates.pacman") + @patch("bearhub.gems.arch.dependencies.pacman") + @patch("bearhub.gems.arch.updates.pacman") def test__return_as_to_remove_when_to_update_conflicts_with_to_install_and_it_has_deps(self, *mocks: Mock): """ Consider package A and B are selected to be upgraded: diff --git a/tests/gems/flatpak/test_controller.py b/tests/gems/flatpak/test_controller.py index 11f7afa3..6b28cfc8 100644 --- a/tests/gems/flatpak/test_controller.py +++ b/tests/gems/flatpak/test_controller.py @@ -1,8 +1,8 @@ from unittest import TestCase from unittest.mock import Mock -from bauh.gems.flatpak.controller import FlatpakManager -from bauh.gems.flatpak.model import FlatpakApplication +from bearhub.gems.flatpak.controller import FlatpakManager +from bearhub.gems.flatpak.model import FlatpakApplication class FlatpakManagerSortUpdateOrderTest(TestCase): diff --git a/tests/gems/flatpak/test_flatpak.py b/tests/gems/flatpak/test_flatpak.py index 6e2a5582..c01825eb 100644 --- a/tests/gems/flatpak/test_flatpak.py +++ b/tests/gems/flatpak/test_flatpak.py @@ -2,13 +2,13 @@ from unittest import TestCase from unittest.mock import patch, Mock -from bauh.gems.flatpak import flatpak, VERSION_1_2 +from bearhub.gems.flatpak import flatpak, VERSION_1_2 class FlatpakTest(TestCase): - @patch("bauh.gems.flatpak.flatpak.SimpleProcess") - @patch("bauh.gems.flatpak.flatpak.ProcessHandler.handle_simple", return_value=(True, """ + @patch("bearhub.gems.flatpak.flatpak.SimpleProcess") + @patch("bearhub.gems.flatpak.flatpak.ProcessHandler.handle_simple", return_value=(True, """ Looking for updates... \tID\tArch\tBranch\tRemote\tDownload diff --git a/tests/gems/flatpak/test_namespace.py b/tests/gems/flatpak/test_namespace.py new file mode 100644 index 00000000..7931d061 --- /dev/null +++ b/tests/gems/flatpak/test_namespace.py @@ -0,0 +1,22 @@ +from unittest import TestCase + +from bearhub.gems.flatpak.controller import FlatpakManager +from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module + + +class TestFlatpakNamespace(TestCase): + + def test_bauh_compat_import(self): + from bauh.gems.flatpak.model import FlatpakApplication + + self.assertTrue(issubclass(FlatpakApplication, object)) + + def test_flatpak_discovered_under_bearhub(self): + gem_dirs = dict(_discover_gem_dirs()) + self.assertIn('flatpak', gem_dirs) + self.assertIn('bearhub/gems/flatpak', gem_dirs['flatpak'].replace('\\', '/')) + + def test_controller_import_prefers_bearhub(self): + module = _import_controller_module('flatpak') + self.assertEqual(module.__name__, 'bearhub.gems.flatpak.controller') + self.assertIs(module.FlatpakManager, FlatpakManager) \ No newline at end of file diff --git a/tests/gems/flatpak/test_worker.py b/tests/gems/flatpak/test_worker.py index cdc7886d..b4b60000 100644 --- a/tests/gems/flatpak/test_worker.py +++ b/tests/gems/flatpak/test_worker.py @@ -1,6 +1,6 @@ from unittest import TestCase -from bauh.gems.flatpak.worker import FlatpakAsyncDataLoader +from bearhub.gems.flatpak.worker import FlatpakAsyncDataLoader class FlatpakAsyncDataLoaderTest(TestCase): diff --git a/tests/gems/web/test_controller.py b/tests/gems/web/test_controller.py index 30ea5149..df38823e 100644 --- a/tests/gems/web/test_controller.py +++ b/tests/gems/web/test_controller.py @@ -1,10 +1,10 @@ from unittest import TestCase from unittest.mock import Mock, patch -from bauh.gems.web.controller import DEFAULT_LANGUAGE_HEADER -from bauh.gems.web.controller import WebApplicationManager +from bearhub.gems.web.controller import DEFAULT_LANGUAGE_HEADER +from bearhub.gems.web.controller import WebApplicationManager -LOCALE_TARGET = 'bauh.gems.web.controller.locale.getlocale' +LOCALE_TARGET = 'bearhub.gems.web.controller.locale.getlocale' class ControllerTest(TestCase): diff --git a/tests/gems/web/test_namespace.py b/tests/gems/web/test_namespace.py new file mode 100644 index 00000000..cc296eb0 --- /dev/null +++ b/tests/gems/web/test_namespace.py @@ -0,0 +1,22 @@ +from unittest import TestCase + +from bearhub.gems.web.controller import WebApplicationManager +from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module + + +class TestWebNamespace(TestCase): + + def test_bauh_compat_import(self): + from bauh.gems.web.controller import DEFAULT_LANGUAGE_HEADER + + self.assertEqual('en-US, en', DEFAULT_LANGUAGE_HEADER) + + def test_web_discovered_under_bearhub(self): + gem_dirs = dict(_discover_gem_dirs()) + self.assertIn('web', gem_dirs) + self.assertIn('bearhub/gems/web', gem_dirs['web'].replace('\\', '/')) + + def test_controller_import_prefers_bearhub(self): + module = _import_controller_module('web') + self.assertEqual(module.__name__, 'bearhub.gems.web.controller') + self.assertIs(module.WebApplicationManager, WebApplicationManager) \ No newline at end of file diff --git a/tests/test_namespace_phase_d.py b/tests/test_namespace_phase_d.py new file mode 100644 index 00000000..24a8a251 --- /dev/null +++ b/tests/test_namespace_phase_d.py @@ -0,0 +1,21 @@ +from unittest import TestCase + +import bearhub +import bearhub.stylesheet +import bauh + + +class TestPhaseDVersionFlip(TestCase): + + def test_version_canonical_in_bearhub(self): + self.assertEqual('0.10.7', bearhub.__version__) + self.assertEqual('bearhub', bearhub.__app_name__) + + def test_bauh_shim_reexports_version(self): + self.assertEqual(bearhub.__version__, bauh.__version__) + self.assertEqual(bearhub.__app_name__, bauh.__app_name__) + + def test_bauh_stylesheet_shim(self): + from bauh import stylesheet as legacy_stylesheet + + self.assertIs(legacy_stylesheet.process_var_of_vars, bearhub.stylesheet.process_var_of_vars) \ No newline at end of file diff --git a/tests/view/core/test_namespace.py b/tests/view/core/test_namespace.py new file mode 100644 index 00000000..4fcf240a --- /dev/null +++ b/tests/view/core/test_namespace.py @@ -0,0 +1,23 @@ +from unittest import TestCase + +from bearhub.view.core.config import CoreConfigManager +from bearhub.view.core.controller import GenericSoftwareManager +from bearhub.view.core.gems import load_managers +from bearhub.view.core.update import check_for_update + + +class TestViewCoreNamespace(TestCase): + + def test_bauh_compat_import(self): + from bauh.view.core.config import CoreConfigManager as legacy_config + + self.assertIs(legacy_config, CoreConfigManager) + + def test_controller_importable_from_bearhub(self): + self.assertTrue(callable(GenericSoftwareManager)) + + def test_gems_loader_native(self): + self.assertTrue(callable(load_managers)) + + def test_update_check_callable(self): + self.assertTrue(callable(check_for_update)) \ No newline at end of file diff --git a/tests/view/qt/__init__.py b/tests/view/qt/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/view/qt/test_namespace.py b/tests/view/qt/test_namespace.py new file mode 100644 index 00000000..00137985 --- /dev/null +++ b/tests/view/qt/test_namespace.py @@ -0,0 +1,19 @@ +from unittest import TestCase + +from bearhub.view.qt.prepare import PreparePanel +from bearhub.view.qt.window import ManageWindow +from bearhub.view.qt.components import QtComponentsManager + + +class TestViewQtNamespace(TestCase): + + def test_bauh_compat_import(self): + from bauh.view.qt.components import QtComponentsManager as legacy_manager + + self.assertIs(legacy_manager, QtComponentsManager) + + def test_prepare_panel_importable(self): + self.assertTrue(callable(PreparePanel)) + + def test_window_importable(self): + self.assertTrue(callable(ManageWindow)) \ No newline at end of file diff --git a/tests/view/util/__init__.py b/tests/view/util/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/view/util/test_namespace.py b/tests/view/util/test_namespace.py new file mode 100644 index 00000000..fc5a2433 --- /dev/null +++ b/tests/view/util/test_namespace.py @@ -0,0 +1,20 @@ +from unittest import TestCase + +from bearhub.view.util.cache import DefaultMemoryCacheFactory +from bearhub.view.util.resource import get_path +from bearhub.view.util.translation import I18n + + +class TestViewUtilNamespace(TestCase): + + def test_bauh_compat_import(self): + from bauh.view.util.cache import DefaultMemoryCacheFactory as legacy_factory + + self.assertIs(legacy_factory, DefaultMemoryCacheFactory) + + def test_resource_prefers_bearhub_tree(self): + path = get_path('locale/about/en') + self.assertIn('bearhub/view/resources', path.replace('\\', '/')) + + def test_translation_class_available(self): + self.assertTrue(callable(I18n)) \ No newline at end of file