Skip to content

Commit bbc71c5

Browse files
committed
WIP
1 parent 1ad420d commit bbc71c5

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

mkosi/_staticversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# SPDX-License-Identifier: LGPL-2.1-or-later
2-
__version__ = "25.3.post0"
2+
__version__ = "26.dev0"

mkosi/_version.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ def version_from_git() -> Optional[str]:
5454
tag = tag.lstrip("v")
5555
if rest:
5656
numcommits, commit = rest
57-
return f"{tag}.post1.dev{numcommits}+{commit}.d{datetime.datetime.now():%Y%m%d}"
57+
nextmajor = int(tag) + 1
58+
return f"{nextmajor}.dev{numcommits}+{commit}.d{datetime.datetime.now():%Y%m%d}"
5859

5960
# we are exactly on a tag
6061
return tag
61-
except (subprocess.CalledProcessError, NotADirectoryError, FileNotFoundError):
62+
except (subprocess.CalledProcessError, NotADirectoryError, FileNotFoundError, ValueError):
6263
return None
6364

6465

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ packages = [
5050
"tmpfiles.d/*",
5151
]
5252

53-
[tool.setuptools_scm]
54-
version_scheme = "no-guess-dev"
55-
5653
[tool.isort]
5754
profile = "black"
5855
include_trailing_comma = true

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
from setuptools import setup
3+
4+
from setuptools_scm import ScmVersion
5+
6+
7+
def guess_next_major_version(version: ScmVersion) -> str:
8+
def _guess_next_major_version(version: ScmVersion) -> str:
9+
v, _ = str(version.tag).split(".", maxsplit=1)
10+
return f"{int(v) + 1}"
11+
return version.format_next_version(_guess_next_major_version, "{guessed}.dev{distance}")
12+
13+
14+
setup(use_scm_version={"version_scheme": guess_next_major_version})

tools/do-a-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ if [ -z "$1" ] ; then
77
fi
88

99
VERSION="$1"
10+
VERSION_MAJOR=${VERSION%%.*}
1011

1112
if ! git diff-index --quiet HEAD; then
1213
echo "Repo has modified files."
1314
exit 1
1415
fi
1516

1617
printf '# SPDX-License-Identifier: LGPL-2.1-or-later\n__version__ = "%s"\n' \
17-
"${VERSION}.post0" \
18+
"$((VERSION_MAJOR + 1)).dev0" \
1819
>mkosi/_staticversion.py
1920

2021
git add -p pyproject.toml mkosi
@@ -23,7 +24,6 @@ git commit -m "Release $VERSION"
2324

2425
git tag -s "v$VERSION" -m "mkosi $VERSION"
2526

26-
VERSION_MAJOR=${VERSION%%.*}
2727
VERSION="$((VERSION_MAJOR + 1))~devel"
2828

2929
git add -p mkosi

0 commit comments

Comments
 (0)