Skip to content

Commit

Permalink
ci: add ability to retrieve current version
Browse files Browse the repository at this point in the history
This script allows to retrieve the current source code version. This functionality will be used later on to bump the version automatically.
  • Loading branch information
felix-seifert committed Mar 18, 2024
1 parent 90202df commit 2f9a340
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ci/version_retriever.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python3

import importlib
import subprocess
import sys

# Insert path to roadmapper package in system path
git_repo_root = subprocess.Popen(['/bin/git', 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE) \
.communicate()[0] \
.rstrip() \
.decode('utf-8')
sys.path.insert(1, git_repo_root)


def get_current_version() -> str:
roadmapper_version_module = importlib.import_module("src.roadmapper.version")
current_version = getattr(roadmapper_version_module, "__version__")
return current_version


if __name__ == "__main__":
print(get_current_version())
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies = ['Pillow>=10.0.0', 'python-dateutil>=2.8.2', 'drawsvg>=2.2.0']
[tool.setuptools.packages.find]
where = ["src"] # list of folders that contain the packages (["."] by default)
exclude = [
"ci",
"demo",
"generate_gallery",
"test_cases",
Expand Down

0 comments on commit 2f9a340

Please sign in to comment.