Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
103f49c8f6 | ||
|
|
f5d428950e | ||
|
|
b40787ffc5 |
20
.github/workflows/publish-containers.yml
vendored
20
.github/workflows/publish-containers.yml
vendored
@@ -1,12 +1,13 @@
|
|||||||
name: Publish container images (GHCR)
|
name: Publish container images (GHCR)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_run:
|
||||||
tags:
|
workflows: ["Mark stable commit"]
|
||||||
- "v*"
|
types: [completed]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -20,13 +21,22 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
|
||||||
|
- name: Checkout workflow_run commit and refresh tags
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
git checkout -f "${{ github.event.workflow_run.head_sha }}"
|
||||||
|
git fetch --tags --force
|
||||||
|
git tag --list 'stable' 'v*' --sort=version:refname | tail -n 20
|
||||||
|
|
||||||
- name: Compute version and stable flag
|
- name: Compute version and stable flag
|
||||||
id: info
|
id: info
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SHA="$(git rev-parse HEAD)"
|
SHA="$(git rev-parse HEAD)"
|
||||||
VERSION="${GITHUB_REF_NAME#v}"
|
|
||||||
|
V_TAG="$(git tag --points-at "${SHA}" --list 'v*' | sort -V | tail -n1)"
|
||||||
|
[[ -n "$V_TAG" ]] || { echo "No version tag found"; exit 1; }
|
||||||
|
VERSION="${V_TAG#v}"
|
||||||
|
|
||||||
STABLE_SHA="$(git rev-parse -q --verify refs/tags/stable^{commit} 2>/dev/null || true)"
|
STABLE_SHA="$(git rev-parse -q --verify refs/tags/stable^{commit} 2>/dev/null || true)"
|
||||||
IS_STABLE=false
|
IS_STABLE=false
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## [1.4.1] - 2025-12-12
|
||||||
|
|
||||||
|
* Fixed (#1) stable release container publishing
|
||||||
|
|
||||||
|
|
||||||
## [1.4.0] - 2025-12-12
|
## [1.4.0] - 2025-12-12
|
||||||
|
|
||||||
* **Docker Container Building**
|
* **Docker Container Building**
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -30,6 +30,7 @@ export BASE_IMAGE_CENTOS
|
|||||||
# PYthon Unittest Pattern
|
# PYthon Unittest Pattern
|
||||||
TEST_PATTERN := test_*.py
|
TEST_PATTERN := test_*.py
|
||||||
export TEST_PATTERN
|
export TEST_PATTERN
|
||||||
|
export PYTHONPATH := src
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# System install
|
# System install
|
||||||
@@ -45,7 +46,7 @@ install:
|
|||||||
# Default: keep current auto-detection behavior
|
# Default: keep current auto-detection behavior
|
||||||
setup: setup-nix setup-venv
|
setup: setup-nix setup-venv
|
||||||
|
|
||||||
# Explicit: developer setup (Python venv + shell RC + main.py install)
|
# Explicit: developer setup (Python venv + shell RC + install)
|
||||||
setup-venv: setup-nix
|
setup-venv: setup-nix
|
||||||
@bash scripts/setup/venv.sh
|
@bash scripts/setup/venv.sh
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
rec {
|
rec {
|
||||||
pkgmgr = pyPkgs.buildPythonApplication {
|
pkgmgr = pyPkgs.buildPythonApplication {
|
||||||
pname = "package-manager";
|
pname = "package-manager";
|
||||||
version = "1.4.0";
|
version = "1.4.1";
|
||||||
|
|
||||||
# Use the git repo as source
|
# Use the git repo as source
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|||||||
14
main.py
14
main.py
@@ -1,14 +0,0 @@
|
|||||||
#!/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()
|
|
||||||
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "package-manager"
|
name = "package-manager"
|
||||||
version = "1.4.0"
|
version = "1.4.1"
|
||||||
description = "Kevin's package-manager tool (pkgmgr)"
|
description = "Kevin's package-manager tool (pkgmgr)"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Nix shell mode: do not touch venv, only run main.py install
|
# Nix shell mode: do not touch venv, only run install
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
echo "[setup] Nix mode enabled (NIX_ENABLED=1)."
|
echo "[setup] Nix mode enabled (NIX_ENABLED=1)."
|
||||||
echo "[setup] Skipping virtualenv creation and dependency installation."
|
echo "[setup] Skipping virtualenv creation and dependency installation."
|
||||||
echo "[setup] Running main.py install via system python3..."
|
echo "[setup] Running install via system python3..."
|
||||||
python3 main.py install
|
python3 -m pkgmgr install
|
||||||
echo "[setup] Setup finished (Nix mode)."
|
echo "[setup] Setup finished (Nix mode)."
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ RC_LINE='if [ -d "${HOME}/.venvs/pkgmgr" ]; then . "${HOME}/.venvs/pkgmgr/bin/ac
|
|||||||
|
|
||||||
echo "[setup] Running in normal user mode (developer setup)."
|
echo "[setup] Running in normal user mode (developer setup)."
|
||||||
|
|
||||||
echo "[setup] Ensuring main.py is executable..."
|
|
||||||
chmod +x main.py || true
|
|
||||||
|
|
||||||
echo "[setup] Ensuring global virtualenv root: ${HOME}/.venvs"
|
echo "[setup] Ensuring global virtualenv root: ${HOME}/.venvs"
|
||||||
mkdir -p "${HOME}/.venvs"
|
mkdir -p "${HOME}/.venvs"
|
||||||
|
|
||||||
@@ -90,8 +87,8 @@ for rc in "${HOME}/.bashrc" "${HOME}/.zshrc"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "[setup] Running main.py install via venv Python..."
|
echo "[setup] Running install via venv Python..."
|
||||||
"${VENV_DIR}/bin/python" main.py install
|
"${VENV_DIR}/bin/python" -m pkgmgr install
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "[setup] Developer setup complete."
|
echo "[setup] Developer setup complete."
|
||||||
|
|||||||
5
src/pkgmgr/__main__.py
Executable file
5
src/pkgmgr/__main__.py
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from pkgmgr.cli import main
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -27,7 +27,7 @@ class TestIntegrationBranchCommands(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
# argv[0] is the program name; the rest are CLI arguments.
|
# argv[0] is the program name; the rest are CLI arguments.
|
||||||
sys.argv = ["pkgmgr"] + list(extra_args)
|
sys.argv = ["pkgmgr"] + list(extra_args)
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
finally:
|
finally:
|
||||||
sys.argv = original_argv
|
sys.argv = original_argv
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ def _run_pkgmgr_help(argv_tail: list[str]) -> str:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with redirect_stdout(buffer), redirect_stderr(buffer):
|
with redirect_stdout(buffer), redirect_stderr(buffer):
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else None
|
code = exc.code if isinstance(exc.code, int) else None
|
||||||
if code not in (0, None):
|
if code not in (0, None):
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class TestIntegrationChangelogCommands(unittest.TestCase):
|
|||||||
sys.argv = ["pkgmgr", "changelog"] + list(extra_args)
|
sys.argv = ["pkgmgr", "changelog"] + list(extra_args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TestIntegrationCloneAllHttps(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
# Execute main.py as if it was called from CLI.
|
# Execute main.py as if it was called from CLI.
|
||||||
# This will run the full clone pipeline inside the container.
|
# This will run the full clone pipeline inside the container.
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
# Determine the exit code (int or string)
|
# Determine the exit code (int or string)
|
||||||
exit_code = exc.code
|
exit_code = exc.code
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ def _run_pkgmgr_config(extra_args: list[str]) -> None:
|
|||||||
sys.argv = ["pkgmgr"] + extra_args
|
sys.argv = ["pkgmgr"] + extra_args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class TestIntegrationInstalPKGMGRShallow(unittest.TestCase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Execute installation via main.py
|
# Execute installation via main.py
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
|
|
||||||
# Debug: interactive shell test
|
# Debug: interactive shell test
|
||||||
pkgmgr_help_debug()
|
pkgmgr_help_debug()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class TestIntegrationListCommands(unittest.TestCase):
|
|||||||
sys.argv = ["pkgmgr"] + args
|
sys.argv = ["pkgmgr"] + args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class TestIntegrationMakeCommands(unittest.TestCase):
|
|||||||
sys.argv = ["pkgmgr"] + extra_args
|
sys.argv = ["pkgmgr"] + extra_args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class TestIntegrationMirrorCommands(unittest.TestCase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with redirect_stdout(buffer), redirect_stderr(buffer):
|
with redirect_stdout(buffer), redirect_stderr(buffer):
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else None
|
code = exc.code if isinstance(exc.code, int) else None
|
||||||
if code not in (0, None):
|
if code not in (0, None):
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class TestPathCommandsE2E(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
# Capture stdout while running the CLI entry point.
|
# Capture stdout while running the CLI entry point.
|
||||||
with redirect_stdout(buffer):
|
with redirect_stdout(buffer):
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
# Determine the exit code (int or string)
|
# Determine the exit code (int or string)
|
||||||
exit_code = exc.code
|
exit_code = exc.code
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class TestIntegrationProxyCommands(unittest.TestCase):
|
|||||||
sys.argv = ["pkgmgr"] + args
|
sys.argv = ["pkgmgr"] + args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class TestIntegrationReleaseCommand(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
# argv[0] is the program name; the rest are CLI arguments.
|
# argv[0] is the program name; the rest are CLI arguments.
|
||||||
sys.argv = ["pkgmgr"] + list(extra_args)
|
sys.argv = ["pkgmgr"] + list(extra_args)
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
finally:
|
finally:
|
||||||
sys.argv = original_argv
|
sys.argv = original_argv
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ class TestIntegrationReleaseCommand(unittest.TestCase):
|
|||||||
# argparse will call sys.exit(), so we expect a SystemExit here.
|
# argparse will call sys.exit(), so we expect a SystemExit here.
|
||||||
with contextlib.redirect_stdout(buf), contextlib.redirect_stderr(buf):
|
with contextlib.redirect_stdout(buf), contextlib.redirect_stderr(buf):
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
finally:
|
finally:
|
||||||
sys.argv = original_argv
|
sys.argv = original_argv
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class TestIntegrationToolsCommands(unittest.TestCase):
|
|||||||
sys.argv = ["pkgmgr"] + extra_args
|
sys.argv = ["pkgmgr"] + extra_args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|||||||
@@ -18,14 +18,6 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
# Resolve project root (the repo where main.py lives, e.g. /src)
|
|
||||||
PROJECT_ROOT = os.path.abspath(
|
|
||||||
os.path.join(os.path.dirname(__file__), "..", "..")
|
|
||||||
)
|
|
||||||
MAIN_PATH = os.path.join(PROJECT_ROOT, "main.py")
|
|
||||||
|
|
||||||
|
|
||||||
def _run_main(argv: List[str]) -> None:
|
def _run_main(argv: List[str]) -> None:
|
||||||
"""
|
"""
|
||||||
Helper to run main.py with the given argv.
|
Helper to run main.py with the given argv.
|
||||||
@@ -40,7 +32,7 @@ def _run_main(argv: List[str]) -> None:
|
|||||||
try:
|
try:
|
||||||
sys.argv = ["pkgmgr"] + argv
|
sys.argv = ["pkgmgr"] + argv
|
||||||
try:
|
try:
|
||||||
runpy.run_path(MAIN_PATH, run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc: # argparse uses this for --help
|
except SystemExit as exc: # argparse uses this for --help
|
||||||
# SystemExit.code can be int, str or None; for our purposes:
|
# SystemExit.code can be int, str or None; for our purposes:
|
||||||
code = exc.code
|
code = exc.code
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class TestIntegrationVersionCommands(unittest.TestCase):
|
|||||||
sys.argv = ["pkgmgr", "version"] + extra_args
|
sys.argv = ["pkgmgr", "version"] + extra_args
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module("main", run_name="__main__")
|
runpy.run_module("pkgmgr", run_name="__main__")
|
||||||
except SystemExit as exc:
|
except SystemExit as exc:
|
||||||
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
code = exc.code if isinstance(exc.code, int) else str(exc.code)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user