diff --git a/.dockerignore b/.dockerignore index ca86825..1bdbd68 100644 --- a/.dockerignore +++ b/.dockerignore @@ -28,4 +28,4 @@ Thumbs.db # Arch pkg artifacts *.pkg.tar.* *.log -package-manager-* \ No newline at end of file +packaging/arch/package-manager-* \ No newline at end of file diff --git a/.gitignore b/.gitignore index e8055ba..c35a250 100644 --- a/.gitignore +++ b/.gitignore @@ -15,16 +15,9 @@ dist/ build/* *.egg-info/ pkg -src/source +src/source/ package-manager-* -# debian -debian/package-manager/ -debian/debhelper-build-stamp -debian/files -debian/.debhelper/ -debian/package-manager.substvars - # Editor files .vscode/ .idea/ diff --git a/README.md b/README.md index e863cc4..0a2ba35 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ installation layers, and setup controller flow: ![PKGMGR Architecture](assets/map.png) -**Diagram status:** *Stand: 10. Dezember 2025* +**Diagram status:** *Stand: 11. Dezember 2025* **Always-up-to-date version:** https://s.veen.world/pkgmgrmp ## Installation ⚙️ diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..1e6efcf --- /dev/null +++ b/TODO.md @@ -0,0 +1,7 @@ +# to-dos + +For the following checkout the implementation map: + +- Implement TAGS +- Implement MIRROR +- Implement SIGNING_KEY \ No newline at end of file diff --git a/assets/map.png b/assets/map.png index f0fe773..1402d64 100644 Binary files a/assets/map.png and b/assets/map.png differ diff --git a/main.py b/main.py index 5f30f15..1a682cf 100755 --- a/main.py +++ b/main.py @@ -1,6 +1,14 @@ #!/usr/bin/env python3 +import sys +from pathlib import Path + +# Ensure local src/ overrides installed package +ROOT = Path(__file__).resolve().parent +SRC = ROOT / "src" +if SRC.is_dir(): + sys.path.insert(0, str(SRC)) from pkgmgr.cli import main if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/PKGBUILD b/packaging/arch/PKGBUILD similarity index 100% rename from PKGBUILD rename to packaging/arch/PKGBUILD diff --git a/packaging/debian/.gitignore b/packaging/debian/.gitignore new file mode 100644 index 0000000..06d6544 --- /dev/null +++ b/packaging/debian/.gitignore @@ -0,0 +1,6 @@ +# debian +package-manager/ +debhelper-build-stamp +files +.debhelper/ +package-manager.substvars \ No newline at end of file diff --git a/debian/changelog b/packaging/debian/changelog similarity index 100% rename from debian/changelog rename to packaging/debian/changelog diff --git a/debian/control b/packaging/debian/control similarity index 100% rename from debian/control rename to packaging/debian/control diff --git a/debian/postinst b/packaging/debian/postinst similarity index 100% rename from debian/postinst rename to packaging/debian/postinst diff --git a/debian/rules b/packaging/debian/rules similarity index 100% rename from debian/rules rename to packaging/debian/rules diff --git a/package-manager.install b/packaging/fedora/package-manager.install similarity index 100% rename from package-manager.install rename to packaging/fedora/package-manager.install diff --git a/package-manager.spec b/packaging/fedora/package-manager.spec similarity index 100% rename from package-manager.spec rename to packaging/fedora/package-manager.spec diff --git a/pyproject.toml b/pyproject.toml index 44cabc8..f2013ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,13 +39,14 @@ pkgmgr = "pkgmgr.cli:main" # ----------------------------- # setuptools configuration # ----------------------------- -# We use find_packages(), not a fixed list, -# and explicitly include pkgmgr* and config* +# Source layout: all packages live under "src/" +[tool.setuptools] +package-dir = { "" = "src", "config" = "config" } [tool.setuptools.packages.find] -where = ["."] +where = ["src", "."] include = ["pkgmgr*", "config*"] -# Ensure defaults.yaml is shipped inside wheels & nix builds [tool.setuptools.package-data] "config" = ["defaults.yaml"] + diff --git a/scripts/installation/arch/package.sh b/scripts/installation/arch/package.sh index bf646f3..96e526d 100755 --- a/scripts/installation/arch/package.sh +++ b/scripts/installation/arch/package.sh @@ -3,10 +3,21 @@ set -euo pipefail echo "[arch/package] Building Arch package (makepkg --nodeps)..." +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" +PKG_DIR="${PROJECT_ROOT}/packaging/arch" + +if [[ ! -f "${PKG_DIR}/PKGBUILD" ]]; then + echo "[arch/package] ERROR: PKGBUILD not found in ${PKG_DIR}" + exit 1 +fi + +cd "${PKG_DIR}" + if id aur_builder >/dev/null 2>&1; then echo "[arch/package] Using 'aur_builder' user for makepkg..." - chown -R aur_builder:aur_builder "$(pwd)" - su aur_builder -c "cd '$(pwd)' && rm -f package-manager-*.pkg.tar.* && makepkg --noconfirm --clean --nodeps" + chown -R aur_builder:aur_builder "${PKG_DIR}" + su aur_builder -c "cd '${PKG_DIR}' && rm -f package-manager-*.pkg.tar.* && makepkg --noconfirm --clean --nodeps" else echo "[arch/package] WARNING: user 'aur_builder' not found, running makepkg as current user..." rm -f package-manager-*.pkg.tar.* diff --git a/scripts/installation/centos/package.sh b/scripts/installation/centos/package.sh index 6447a7e..41ab893 100755 --- a/scripts/installation/centos/package.sh +++ b/scripts/installation/centos/package.sh @@ -4,8 +4,17 @@ set -euo pipefail echo "[centos/package] Setting up rpmbuild directories..." mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" +SPEC_PATH="${PROJECT_ROOT}/packaging/fedora/package-manager.spec" + +if [[ ! -f "${SPEC_PATH}" ]]; then + echo "[centos/package] ERROR: SPEC file not found: ${SPEC_PATH}" + exit 1 +fi + echo "[centos/package] Extracting version from package-manager.spec..." -version="$(grep -E '^Version:' package-manager.spec | awk '{print $2}')" +version="$(grep -E '^Version:' "${SPEC_PATH}" | awk '{print $2}')" if [[ -z "${version}" ]]; then echo "ERROR: Version missing!" exit 1 @@ -15,13 +24,13 @@ srcdir="package-manager-${version}" echo "[centos/package] Preparing source tree: ${srcdir}" rm -rf "/tmp/${srcdir}" mkdir -p "/tmp/${srcdir}" -cp -a . "/tmp/${srcdir}/" +cp -a "${PROJECT_ROOT}/." "/tmp/${srcdir}/" echo "[centos/package] Creating source tarball..." tar czf "/root/rpmbuild/SOURCES/${srcdir}.tar.gz" -C /tmp "${srcdir}" echo "[centos/package] Copying SPEC..." -cp package-manager.spec /root/rpmbuild/SPECS/ +cp "${SPEC_PATH}" /root/rpmbuild/SPECS/ echo "[centos/package] Running rpmbuild..." cd /root/rpmbuild/SPECS diff --git a/scripts/installation/debian/package.sh b/scripts/installation/debian/package.sh index b9c56d9..60939f3 100755 --- a/scripts/installation/debian/package.sh +++ b/scripts/installation/debian/package.sh @@ -3,6 +3,25 @@ set -euo pipefail echo "[debian/package] Building Debian package..." +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + +BUILD_ROOT="/tmp/package-manager-debian-build" +rm -rf "${BUILD_ROOT}" +mkdir -p "${BUILD_ROOT}" + +echo "[debian/package] Syncing project sources to ${BUILD_ROOT}..." +rsync -a \ + --exclude 'packaging/debian' \ + "${PROJECT_ROOT}/" "${BUILD_ROOT}/" + +echo "[debian/package] Overlaying debian/ metadata from packaging/debian..." +mkdir -p "${BUILD_ROOT}/debian" +cp -a "${PROJECT_ROOT}/packaging/debian/." "${BUILD_ROOT}/debian/" + +cd "${BUILD_ROOT}" + +echo "[debian/package] Running dpkg-buildpackage..." dpkg-buildpackage -us -uc -b echo "[debian/package] Installing generated DEB package..." diff --git a/scripts/installation/fedora/package.sh b/scripts/installation/fedora/package.sh index 69d15ef..33abe1c 100755 --- a/scripts/installation/fedora/package.sh +++ b/scripts/installation/fedora/package.sh @@ -4,8 +4,17 @@ set -euo pipefail echo "[fedora/package] Setting up rpmbuild directories..." mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" +SPEC_PATH="${PROJECT_ROOT}/packaging/fedora/package-manager.spec" + +if [[ ! -f "${SPEC_PATH}" ]]; then + echo "[fedora/package] ERROR: SPEC file not found: ${SPEC_PATH}" + exit 1 +fi + echo "[fedora/package] Extracting version from package-manager.spec..." -version="$(grep -E '^Version:' package-manager.spec | awk '{print $2}')" +version="$(grep -E '^Version:' "${SPEC_PATH}" | awk '{print $2}')" if [[ -z "${version}" ]]; then echo "ERROR: Version missing!" exit 1 @@ -15,13 +24,13 @@ srcdir="package-manager-${version}" echo "[fedora/package] Preparing source tree: ${srcdir}" rm -rf "/tmp/${srcdir}" mkdir -p "/tmp/${srcdir}" -cp -a . "/tmp/${srcdir}/" +cp -a "${PROJECT_ROOT}/." "/tmp/${srcdir}/" echo "[fedora/package] Creating source tarball..." tar czf "/root/rpmbuild/SOURCES/${srcdir}.tar.gz" -C /tmp "${srcdir}" echo "[fedora/package] Copying SPEC..." -cp package-manager.spec /root/rpmbuild/SPECS/ +cp "${SPEC_PATH}" /root/rpmbuild/SPECS/ echo "[fedora/package] Running rpmbuild..." cd /root/rpmbuild/SPECS diff --git a/scripts/installation/ubuntu/package.sh b/scripts/installation/ubuntu/package.sh index 7ae3b97..bd0a531 100755 --- a/scripts/installation/ubuntu/package.sh +++ b/scripts/installation/ubuntu/package.sh @@ -3,6 +3,25 @@ set -euo pipefail echo "[ubuntu/package] Building Ubuntu (Debian-style) package..." +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + +BUILD_ROOT="/tmp/package-manager-ubuntu-build" +rm -rf "${BUILD_ROOT}" +mkdir -p "${BUILD_ROOT}" + +echo "[ubuntu/package] Syncing project sources to ${BUILD_ROOT}..." +rsync -a \ + --exclude 'packaging/debian' \ + "${PROJECT_ROOT}/" "${BUILD_ROOT}/" + +echo "[ubuntu/package] Overlaying debian/ metadata from packaging/debian..." +mkdir -p "${BUILD_ROOT}/debian" +cp -a "${PROJECT_ROOT}/packaging/debian/." "${BUILD_ROOT}/debian/" + +cd "${BUILD_ROOT}" + +echo "[ubuntu/package] Running dpkg-buildpackage..." dpkg-buildpackage -us -uc -b echo "[ubuntu/package] Installing generated DEB package..." diff --git a/pkgmgr/__init__.py b/src/pkgmgr/__init__.py similarity index 100% rename from pkgmgr/__init__.py rename to src/pkgmgr/__init__.py diff --git a/pkgmgr/actions/__init__.py b/src/pkgmgr/actions/__init__.py similarity index 100% rename from pkgmgr/actions/__init__.py rename to src/pkgmgr/actions/__init__.py diff --git a/pkgmgr/actions/branch/__init__.py b/src/pkgmgr/actions/branch/__init__.py similarity index 100% rename from pkgmgr/actions/branch/__init__.py rename to src/pkgmgr/actions/branch/__init__.py diff --git a/pkgmgr/actions/changelog/__init__.py b/src/pkgmgr/actions/changelog/__init__.py similarity index 100% rename from pkgmgr/actions/changelog/__init__.py rename to src/pkgmgr/actions/changelog/__init__.py diff --git a/pkgmgr/actions/config/__init__.py b/src/pkgmgr/actions/config/__init__.py similarity index 100% rename from pkgmgr/actions/config/__init__.py rename to src/pkgmgr/actions/config/__init__.py diff --git a/pkgmgr/actions/config/add.py b/src/pkgmgr/actions/config/add.py similarity index 100% rename from pkgmgr/actions/config/add.py rename to src/pkgmgr/actions/config/add.py diff --git a/pkgmgr/actions/config/init.py b/src/pkgmgr/actions/config/init.py similarity index 100% rename from pkgmgr/actions/config/init.py rename to src/pkgmgr/actions/config/init.py diff --git a/pkgmgr/actions/config/show.py b/src/pkgmgr/actions/config/show.py similarity index 100% rename from pkgmgr/actions/config/show.py rename to src/pkgmgr/actions/config/show.py diff --git a/pkgmgr/actions/install/__init__.py b/src/pkgmgr/actions/install/__init__.py similarity index 100% rename from pkgmgr/actions/install/__init__.py rename to src/pkgmgr/actions/install/__init__.py diff --git a/pkgmgr/actions/install/capabilities.py b/src/pkgmgr/actions/install/capabilities.py similarity index 100% rename from pkgmgr/actions/install/capabilities.py rename to src/pkgmgr/actions/install/capabilities.py diff --git a/pkgmgr/actions/install/context.py b/src/pkgmgr/actions/install/context.py similarity index 100% rename from pkgmgr/actions/install/context.py rename to src/pkgmgr/actions/install/context.py diff --git a/pkgmgr/actions/install/installers/__init__.py b/src/pkgmgr/actions/install/installers/__init__.py similarity index 100% rename from pkgmgr/actions/install/installers/__init__.py rename to src/pkgmgr/actions/install/installers/__init__.py diff --git a/pkgmgr/actions/install/installers/base.py b/src/pkgmgr/actions/install/installers/base.py similarity index 100% rename from pkgmgr/actions/install/installers/base.py rename to src/pkgmgr/actions/install/installers/base.py diff --git a/pkgmgr/actions/install/installers/makefile.py b/src/pkgmgr/actions/install/installers/makefile.py similarity index 100% rename from pkgmgr/actions/install/installers/makefile.py rename to src/pkgmgr/actions/install/installers/makefile.py diff --git a/pkgmgr/actions/install/installers/nix_flake.py b/src/pkgmgr/actions/install/installers/nix_flake.py similarity index 100% rename from pkgmgr/actions/install/installers/nix_flake.py rename to src/pkgmgr/actions/install/installers/nix_flake.py diff --git a/pkgmgr/actions/install/installers/os_packages/__init__.py b/src/pkgmgr/actions/install/installers/os_packages/__init__.py similarity index 100% rename from pkgmgr/actions/install/installers/os_packages/__init__.py rename to src/pkgmgr/actions/install/installers/os_packages/__init__.py diff --git a/pkgmgr/actions/install/installers/os_packages/arch_pkgbuild.py b/src/pkgmgr/actions/install/installers/os_packages/arch_pkgbuild.py similarity index 100% rename from pkgmgr/actions/install/installers/os_packages/arch_pkgbuild.py rename to src/pkgmgr/actions/install/installers/os_packages/arch_pkgbuild.py diff --git a/pkgmgr/actions/install/installers/os_packages/debian_control.py b/src/pkgmgr/actions/install/installers/os_packages/debian_control.py similarity index 100% rename from pkgmgr/actions/install/installers/os_packages/debian_control.py rename to src/pkgmgr/actions/install/installers/os_packages/debian_control.py diff --git a/pkgmgr/actions/install/installers/os_packages/rpm_spec.py b/src/pkgmgr/actions/install/installers/os_packages/rpm_spec.py similarity index 100% rename from pkgmgr/actions/install/installers/os_packages/rpm_spec.py rename to src/pkgmgr/actions/install/installers/os_packages/rpm_spec.py diff --git a/pkgmgr/actions/install/installers/python.py b/src/pkgmgr/actions/install/installers/python.py similarity index 100% rename from pkgmgr/actions/install/installers/python.py rename to src/pkgmgr/actions/install/installers/python.py diff --git a/pkgmgr/actions/install/layers.py b/src/pkgmgr/actions/install/layers.py similarity index 100% rename from pkgmgr/actions/install/layers.py rename to src/pkgmgr/actions/install/layers.py diff --git a/pkgmgr/actions/install/pipeline.py b/src/pkgmgr/actions/install/pipeline.py similarity index 100% rename from pkgmgr/actions/install/pipeline.py rename to src/pkgmgr/actions/install/pipeline.py diff --git a/pkgmgr/actions/proxy.py b/src/pkgmgr/actions/proxy.py similarity index 100% rename from pkgmgr/actions/proxy.py rename to src/pkgmgr/actions/proxy.py diff --git a/pkgmgr/actions/release/__init__.py b/src/pkgmgr/actions/release/__init__.py similarity index 100% rename from pkgmgr/actions/release/__init__.py rename to src/pkgmgr/actions/release/__init__.py diff --git a/pkgmgr/actions/release/files.py b/src/pkgmgr/actions/release/files.py similarity index 100% rename from pkgmgr/actions/release/files.py rename to src/pkgmgr/actions/release/files.py diff --git a/pkgmgr/actions/release/git_ops.py b/src/pkgmgr/actions/release/git_ops.py similarity index 100% rename from pkgmgr/actions/release/git_ops.py rename to src/pkgmgr/actions/release/git_ops.py diff --git a/pkgmgr/actions/release/versioning.py b/src/pkgmgr/actions/release/versioning.py similarity index 100% rename from pkgmgr/actions/release/versioning.py rename to src/pkgmgr/actions/release/versioning.py diff --git a/pkgmgr/actions/repository/__init__.py b/src/pkgmgr/actions/repository/__init__.py similarity index 100% rename from pkgmgr/actions/repository/__init__.py rename to src/pkgmgr/actions/repository/__init__.py diff --git a/pkgmgr/actions/repository/clone.py b/src/pkgmgr/actions/repository/clone.py similarity index 100% rename from pkgmgr/actions/repository/clone.py rename to src/pkgmgr/actions/repository/clone.py diff --git a/pkgmgr/actions/repository/create.py b/src/pkgmgr/actions/repository/create.py similarity index 100% rename from pkgmgr/actions/repository/create.py rename to src/pkgmgr/actions/repository/create.py diff --git a/pkgmgr/actions/repository/deinstall.py b/src/pkgmgr/actions/repository/deinstall.py similarity index 100% rename from pkgmgr/actions/repository/deinstall.py rename to src/pkgmgr/actions/repository/deinstall.py diff --git a/pkgmgr/actions/repository/delete.py b/src/pkgmgr/actions/repository/delete.py similarity index 100% rename from pkgmgr/actions/repository/delete.py rename to src/pkgmgr/actions/repository/delete.py diff --git a/pkgmgr/actions/repository/list.py b/src/pkgmgr/actions/repository/list.py similarity index 100% rename from pkgmgr/actions/repository/list.py rename to src/pkgmgr/actions/repository/list.py diff --git a/pkgmgr/actions/repository/pull.py b/src/pkgmgr/actions/repository/pull.py similarity index 100% rename from pkgmgr/actions/repository/pull.py rename to src/pkgmgr/actions/repository/pull.py diff --git a/pkgmgr/actions/repository/status.py b/src/pkgmgr/actions/repository/status.py similarity index 100% rename from pkgmgr/actions/repository/status.py rename to src/pkgmgr/actions/repository/status.py diff --git a/pkgmgr/actions/repository/update.py b/src/pkgmgr/actions/repository/update.py similarity index 100% rename from pkgmgr/actions/repository/update.py rename to src/pkgmgr/actions/repository/update.py diff --git a/pkgmgr/cli/__init__.py b/src/pkgmgr/cli/__init__.py similarity index 100% rename from pkgmgr/cli/__init__.py rename to src/pkgmgr/cli/__init__.py diff --git a/pkgmgr/cli/commands/__init__.py b/src/pkgmgr/cli/commands/__init__.py similarity index 100% rename from pkgmgr/cli/commands/__init__.py rename to src/pkgmgr/cli/commands/__init__.py diff --git a/pkgmgr/cli/commands/branch.py b/src/pkgmgr/cli/commands/branch.py similarity index 100% rename from pkgmgr/cli/commands/branch.py rename to src/pkgmgr/cli/commands/branch.py diff --git a/pkgmgr/cli/commands/changelog.py b/src/pkgmgr/cli/commands/changelog.py similarity index 100% rename from pkgmgr/cli/commands/changelog.py rename to src/pkgmgr/cli/commands/changelog.py diff --git a/pkgmgr/cli/commands/config.py b/src/pkgmgr/cli/commands/config.py similarity index 100% rename from pkgmgr/cli/commands/config.py rename to src/pkgmgr/cli/commands/config.py diff --git a/pkgmgr/cli/commands/make.py b/src/pkgmgr/cli/commands/make.py similarity index 100% rename from pkgmgr/cli/commands/make.py rename to src/pkgmgr/cli/commands/make.py diff --git a/pkgmgr/cli/commands/release.py b/src/pkgmgr/cli/commands/release.py similarity index 100% rename from pkgmgr/cli/commands/release.py rename to src/pkgmgr/cli/commands/release.py diff --git a/pkgmgr/cli/commands/repos.py b/src/pkgmgr/cli/commands/repos.py similarity index 100% rename from pkgmgr/cli/commands/repos.py rename to src/pkgmgr/cli/commands/repos.py diff --git a/pkgmgr/cli/commands/tools.py b/src/pkgmgr/cli/commands/tools.py similarity index 100% rename from pkgmgr/cli/commands/tools.py rename to src/pkgmgr/cli/commands/tools.py diff --git a/pkgmgr/cli/commands/version.py b/src/pkgmgr/cli/commands/version.py similarity index 100% rename from pkgmgr/cli/commands/version.py rename to src/pkgmgr/cli/commands/version.py diff --git a/pkgmgr/cli/context.py b/src/pkgmgr/cli/context.py similarity index 100% rename from pkgmgr/cli/context.py rename to src/pkgmgr/cli/context.py diff --git a/pkgmgr/cli/dispatch.py b/src/pkgmgr/cli/dispatch.py similarity index 100% rename from pkgmgr/cli/dispatch.py rename to src/pkgmgr/cli/dispatch.py diff --git a/pkgmgr/cli/parser.py b/src/pkgmgr/cli/parser.py similarity index 100% rename from pkgmgr/cli/parser.py rename to src/pkgmgr/cli/parser.py diff --git a/pkgmgr/cli/proxy.py b/src/pkgmgr/cli/proxy.py similarity index 100% rename from pkgmgr/cli/proxy.py rename to src/pkgmgr/cli/proxy.py diff --git a/pkgmgr/core/command/__init__.py b/src/pkgmgr/core/command/__init__.py similarity index 100% rename from pkgmgr/core/command/__init__.py rename to src/pkgmgr/core/command/__init__.py diff --git a/pkgmgr/core/command/alias.py b/src/pkgmgr/core/command/alias.py similarity index 100% rename from pkgmgr/core/command/alias.py rename to src/pkgmgr/core/command/alias.py diff --git a/pkgmgr/core/command/ink.py b/src/pkgmgr/core/command/ink.py similarity index 100% rename from pkgmgr/core/command/ink.py rename to src/pkgmgr/core/command/ink.py diff --git a/pkgmgr/core/command/resolve.py b/src/pkgmgr/core/command/resolve.py similarity index 100% rename from pkgmgr/core/command/resolve.py rename to src/pkgmgr/core/command/resolve.py diff --git a/pkgmgr/core/command/run.py b/src/pkgmgr/core/command/run.py similarity index 100% rename from pkgmgr/core/command/run.py rename to src/pkgmgr/core/command/run.py diff --git a/pkgmgr/core/config/__init__.py b/src/pkgmgr/core/config/__init__.py similarity index 100% rename from pkgmgr/core/config/__init__.py rename to src/pkgmgr/core/config/__init__.py diff --git a/pkgmgr/core/config/load.py b/src/pkgmgr/core/config/load.py similarity index 92% rename from pkgmgr/core/config/load.py rename to src/pkgmgr/core/config/load.py index 49d8f94..e754fde 100644 --- a/pkgmgr/core/config/load.py +++ b/src/pkgmgr/core/config/load.py @@ -197,13 +197,8 @@ def _load_layer_dir( def _load_defaults_from_package_or_project() -> Dict[str, Any]: """ - Fallback: Versuche Defaults aus dem installierten Paket ODER - aus dem Projekt-Root zu laden: - - /config_defaults - /config - /config_defaults - /config + Fallback: load default configs from various possible install or development + layouts (pip-installed, editable install, source repo with src/ layout). """ try: import pkgmgr # type: ignore @@ -211,14 +206,25 @@ def _load_defaults_from_package_or_project() -> Dict[str, Any]: return {"directories": {}, "repositories": []} pkg_root = Path(pkgmgr.__file__).resolve().parent - project_root = pkg_root.parent + roots = set() - candidates = [ - pkg_root / "config_defaults", - pkg_root / "config", - project_root / "config_defaults", - project_root / "config", - ] + # Case 1: installed package (site-packages/pkgmgr) + roots.add(pkg_root) + + # Case 2: parent directory (site-packages/, src/) + roots.add(pkg_root.parent) + + # Case 3: src-layout during development: + # repo_root/src/pkgmgr -> repo_root + parent = pkg_root.parent + if parent.name == "src": + roots.add(parent.parent) + + # Candidate config dirs + candidates = [] + for root in roots: + candidates.append(root / "config_defaults") + candidates.append(root / "config") for cand in candidates: defaults = _load_layer_dir(cand, skip_filename=None) @@ -227,7 +233,6 @@ def _load_defaults_from_package_or_project() -> Dict[str, Any]: return {"directories": {}, "repositories": []} - # --------------------------------------------------------------------------- # Hauptfunktion # --------------------------------------------------------------------------- diff --git a/pkgmgr/core/config/save.py b/src/pkgmgr/core/config/save.py similarity index 100% rename from pkgmgr/core/config/save.py rename to src/pkgmgr/core/config/save.py diff --git a/pkgmgr/core/git/__init__.py b/src/pkgmgr/core/git/__init__.py similarity index 100% rename from pkgmgr/core/git/__init__.py rename to src/pkgmgr/core/git/__init__.py diff --git a/pkgmgr/core/repository/__init__.py b/src/pkgmgr/core/repository/__init__.py similarity index 100% rename from pkgmgr/core/repository/__init__.py rename to src/pkgmgr/core/repository/__init__.py diff --git a/pkgmgr/core/repository/dir.py b/src/pkgmgr/core/repository/dir.py similarity index 100% rename from pkgmgr/core/repository/dir.py rename to src/pkgmgr/core/repository/dir.py diff --git a/pkgmgr/core/repository/identifier.py b/src/pkgmgr/core/repository/identifier.py similarity index 100% rename from pkgmgr/core/repository/identifier.py rename to src/pkgmgr/core/repository/identifier.py diff --git a/pkgmgr/core/repository/ignored.py b/src/pkgmgr/core/repository/ignored.py similarity index 100% rename from pkgmgr/core/repository/ignored.py rename to src/pkgmgr/core/repository/ignored.py diff --git a/pkgmgr/core/repository/resolve.py b/src/pkgmgr/core/repository/resolve.py similarity index 100% rename from pkgmgr/core/repository/resolve.py rename to src/pkgmgr/core/repository/resolve.py diff --git a/pkgmgr/core/repository/selected.py b/src/pkgmgr/core/repository/selected.py similarity index 100% rename from pkgmgr/core/repository/selected.py rename to src/pkgmgr/core/repository/selected.py diff --git a/pkgmgr/core/repository/verify.py b/src/pkgmgr/core/repository/verify.py similarity index 100% rename from pkgmgr/core/repository/verify.py rename to src/pkgmgr/core/repository/verify.py diff --git a/pkgmgr/core/version/__init__.py b/src/pkgmgr/core/version/__init__.py similarity index 100% rename from pkgmgr/core/version/__init__.py rename to src/pkgmgr/core/version/__init__.py diff --git a/pkgmgr/core/version/semver.py b/src/pkgmgr/core/version/semver.py similarity index 100% rename from pkgmgr/core/version/semver.py rename to src/pkgmgr/core/version/semver.py diff --git a/pkgmgr/core/version/source.py b/src/pkgmgr/core/version/source.py similarity index 100% rename from pkgmgr/core/version/source.py rename to src/pkgmgr/core/version/source.py