Merge branch 'fix/file-error'
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
## [0.7.8] - 2025-12-09
|
||||||
|
|
||||||
|
* Missing pyproject.toml doesn't lead to an error during release
|
||||||
|
|
||||||
|
|
||||||
## [0.7.7] - 2025-12-09
|
## [0.7.7] - 2025-12-09
|
||||||
|
|
||||||
* Added TEST_PATTERN parameter to execute dedicated tests
|
* Added TEST_PATTERN parameter to execute dedicated tests
|
||||||
|
|||||||
2
PKGBUILD
2
PKGBUILD
@@ -1,7 +1,7 @@
|
|||||||
# Maintainer: Kevin Veen-Birkenbach <info@veen.world>
|
# Maintainer: Kevin Veen-Birkenbach <info@veen.world>
|
||||||
|
|
||||||
pkgname=package-manager
|
pkgname=package-manager
|
||||||
pkgver=0.7.7
|
pkgver=0.7.8
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Local-flake wrapper for Kevin's package-manager (Nix-based)."
|
pkgdesc="Local-flake wrapper for Kevin's package-manager (Nix-based)."
|
||||||
arch=('any')
|
arch=('any')
|
||||||
|
|||||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
|||||||
|
package-manager (0.7.8-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Missing pyproject.toml doesn't lead to an error during release
|
||||||
|
|
||||||
|
-- Kevin Veen-Birkenbach <kevin@veen.world> Tue, 09 Dec 2025 21:03:24 +0100
|
||||||
|
|
||||||
package-manager (0.7.7-1) unstable; urgency=medium
|
package-manager (0.7.7-1) unstable; urgency=medium
|
||||||
|
|
||||||
* Added TEST_PATTERN parameter to execute dedicated tests
|
* Added TEST_PATTERN parameter to execute dedicated tests
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
rec {
|
rec {
|
||||||
pkgmgr = pyPkgs.buildPythonApplication {
|
pkgmgr = pyPkgs.buildPythonApplication {
|
||||||
pname = "package-manager";
|
pname = "package-manager";
|
||||||
version = "0.7.7";
|
version = "0.7.8";
|
||||||
|
|
||||||
# Use the git repo as source
|
# Use the git repo as source
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Name: package-manager
|
Name: package-manager
|
||||||
Version: 0.7.7
|
Version: 0.7.8
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Wrapper that runs Kevin's package-manager via Nix flake
|
Summary: Wrapper that runs Kevin's package-manager via Nix flake
|
||||||
|
|
||||||
@@ -77,6 +77,9 @@ echo ">>> package-manager removed. Nix itself was not removed."
|
|||||||
/usr/lib/package-manager/
|
/usr/lib/package-manager/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 09 2025 Kevin Veen-Birkenbach <kevin@veen.world> - 0.7.8-1
|
||||||
|
- Missing pyproject.toml doesn't lead to an error during release
|
||||||
|
|
||||||
* Tue Dec 09 2025 Kevin Veen-Birkenbach <kevin@veen.world> - 0.7.7-1
|
* Tue Dec 09 2025 Kevin Veen-Birkenbach <kevin@veen.world> - 0.7.7-1
|
||||||
- Added TEST_PATTERN parameter to execute dedicated tests
|
- Added TEST_PATTERN parameter to execute dedicated tests
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ def _open_editor_for_changelog(initial_message: Optional[str] = None) -> str:
|
|||||||
# File update helpers (pyproject + extra packaging + changelog)
|
# File update helpers (pyproject + extra packaging + changelog)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
def update_pyproject_version(
|
def update_pyproject_version(
|
||||||
pyproject_path: str,
|
pyproject_path: str,
|
||||||
new_version: str,
|
new_version: str,
|
||||||
@@ -99,13 +98,25 @@ def update_pyproject_version(
|
|||||||
version = "X.Y.Z"
|
version = "X.Y.Z"
|
||||||
|
|
||||||
and replaces the version part with the given new_version string.
|
and replaces the version part with the given new_version string.
|
||||||
|
|
||||||
|
If the file does not exist, it is skipped without failing the release.
|
||||||
"""
|
"""
|
||||||
|
if not os.path.exists(pyproject_path):
|
||||||
|
print(
|
||||||
|
f"[INFO] pyproject.toml not found at: {pyproject_path}, "
|
||||||
|
"skipping version update."
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(pyproject_path, "r", encoding="utf-8") as f:
|
with open(pyproject_path, "r", encoding="utf-8") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
except FileNotFoundError:
|
except OSError as exc:
|
||||||
print(f"[ERROR] pyproject.toml not found at: {pyproject_path}")
|
print(
|
||||||
sys.exit(1)
|
f"[WARN] Could not read pyproject.toml at {pyproject_path}: {exc}. "
|
||||||
|
"Skipping version update."
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
pattern = r'^(version\s*=\s*")([^"]+)(")'
|
pattern = r'^(version\s*=\s*")([^"]+)(")'
|
||||||
new_content, count = re.subn(
|
new_content, count = re.subn(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "package-manager"
|
name = "package-manager"
|
||||||
version = "0.7.7"
|
version = "0.7.8"
|
||||||
description = "Kevin's package-manager tool (pkgmgr)"
|
description = "Kevin's package-manager tool (pkgmgr)"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
|
|||||||
@@ -80,6 +80,21 @@ class TestUpdatePyprojectVersion(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertNotEqual(cm.exception.code, 0)
|
self.assertNotEqual(cm.exception.code, 0)
|
||||||
|
|
||||||
|
def test_update_pyproject_version_missing_file_is_skipped(self) -> None:
|
||||||
|
"""
|
||||||
|
If pyproject.toml does not exist, the function must not raise
|
||||||
|
and must not create the file. It should simply be skipped.
|
||||||
|
"""
|
||||||
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
|
path = os.path.join(tmpdir, "pyproject.toml")
|
||||||
|
self.assertFalse(os.path.exists(path))
|
||||||
|
|
||||||
|
# Must not raise an exception
|
||||||
|
update_pyproject_version(path, "1.2.3", preview=False)
|
||||||
|
|
||||||
|
# Still no file created
|
||||||
|
self.assertFalse(os.path.exists(path))
|
||||||
|
|
||||||
|
|
||||||
class TestUpdateFlakeVersion(unittest.TestCase):
|
class TestUpdateFlakeVersion(unittest.TestCase):
|
||||||
def test_update_flake_version_normal(self) -> None:
|
def test_update_flake_version_normal(self) -> None:
|
||||||
@@ -352,11 +367,11 @@ class TestUpdateSpecChangelog(unittest.TestCase):
|
|||||||
with open(path, "r", encoding="utf-8") as f:
|
with open(path, "r", encoding="utf-8") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
# Neue Stanza muss nach %changelog stehen
|
# New stanza must appear after the %changelog marker
|
||||||
self.assertIn("%changelog", content)
|
self.assertIn("%changelog", content)
|
||||||
self.assertIn("Fedora changelog entry", content)
|
self.assertIn("Fedora changelog entry", content)
|
||||||
self.assertIn("Test Maintainer <test@example.com>", content)
|
self.assertIn("Test Maintainer <test@example.com>", content)
|
||||||
# Alte Einträge müssen erhalten bleiben
|
# Old entries must still be present
|
||||||
self.assertIn("Old Maintainer <old@example.com>", content)
|
self.assertIn("Old Maintainer <old@example.com>", content)
|
||||||
|
|
||||||
def test_update_spec_changelog_preview_does_not_write(self) -> None:
|
def test_update_spec_changelog_preview_does_not_write(self) -> None:
|
||||||
@@ -396,7 +411,7 @@ class TestUpdateSpecChangelog(unittest.TestCase):
|
|||||||
with open(path, "r", encoding="utf-8") as f:
|
with open(path, "r", encoding="utf-8") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
# Im Preview-Modus darf nichts verändert werden
|
# In preview mode, the spec file must not change
|
||||||
self.assertEqual(content, original)
|
self.assertEqual(content, original)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user