Skip to content

Commit 3f4cb25

Browse files
robtaylorColoquinte
authored andcommitted
Get version from git tag
1 parent bcdda98 commit 3f4cb25

File tree

4 files changed

+110
-92
lines changed

4 files changed

+110
-92
lines changed

_build_utils/version.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/usr/bin/env python3
2-
""" Extract version number from __init__.py
3-
"""
42

5-
import os
3+
def get_version():
4+
from dunamai import Version
5+
version = Version.from_git()
66

7+
if version.distance > 0:
8+
version.stage = "a"
9+
version.revision = version.distance
10+
version.distance = 0
11+
return version.serialize()
712

8-
ski_init = os.path.join(os.path.dirname(__file__), '../__init__.py')
913

10-
data = open(ski_init).readlines()
11-
version_line = next(line for line in data if line.startswith('__version__'))
12-
13-
version = version_line.strip().split(' = ')[1].replace('"', '').replace("'", '')
14-
15-
print(version)
14+
if __name__ == "__main__":
15+
print(get_version())

meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project(
22
'coriolis-eda',
33
'c','cpp',
4-
version: '2.5.5',
4+
version: run_command('_build_utils/version.py').stdout().strip(),
55
meson_version: '>= 1.2.0',
66
default_options: [
77
'buildtype=debugoptimized',

0 commit comments

Comments
 (0)