Skip to content

Commit 3060639

Browse files
committed
Simplify writing of file
1 parent 369b98e commit 3060639

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

exasol/toolbox/nox/_package_version.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import nox
1010
from nox import Session
1111

12-
from exasol.toolbox.error import ToolboxError
1312
from exasol.toolbox.util.version import Version
1413
from noxconfig import (
1514
PROJECT_CONFIG,
@@ -36,11 +35,8 @@
3635
# fmt: on
3736

3837

39-
def write_version_module(version: Version, version_file: Path, exists_ok: bool = True) -> None:
40-
if version_file.exists() and not exists_ok:
41-
raise ToolboxError(f"Version file [{version_file}] already exists.")
42-
version_file.unlink(missing_ok=True)
43-
with open(version_file, "w", encoding="utf-8") as f:
38+
def write_version_module(version: Version, version_file: Path) -> None:
39+
with version_file.open(mode="w", encoding="utf-8") as f:
4440
f.write(
4541
_VERSION_MODULE_TEMPLATE.format(
4642
major=version.major, minor=version.minor, patch=version.patch

0 commit comments

Comments
 (0)