Skip to content

Commit

Permalink
Get version from git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
robtaylor authored and Coloquinte committed Dec 6, 2023
1 parent bcdda98 commit 3f4cb25
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 92 deletions.
20 changes: 10 additions & 10 deletions _build_utils/version.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env python3
""" Extract version number from __init__.py
"""

import os
def get_version():
from dunamai import Version
version = Version.from_git()

if version.distance > 0:
version.stage = "a"
version.revision = version.distance
version.distance = 0
return version.serialize()

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

data = open(ski_init).readlines()
version_line = next(line for line in data if line.startswith('__version__'))

version = version_line.strip().split(' = ')[1].replace('"', '').replace("'", '')

print(version)
if __name__ == "__main__":
print(get_version())
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'coriolis-eda',
'c','cpp',
version: '2.5.5',
version: run_command('_build_utils/version.py').stdout().strip(),
meson_version: '>= 1.2.0',
default_options: [
'buildtype=debugoptimized',
Expand Down
Loading

0 comments on commit 3f4cb25

Please sign in to comment.