Skip to content

Commit

Permalink
Adding better default version
Browse files Browse the repository at this point in the history
  • Loading branch information
john-westcott-iv committed Jan 31, 2024
1 parent 1e47433 commit 4f4d478
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pre-commit-user
.docker-compose-built

# Ignore the build version file
ansible_base._version.py
ansible_base/_version.py

# Python & setuptools
__pycache__
Expand Down
2 changes: 1 addition & 1 deletion ansible_base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
try:
from ._version import version
except ImportError:
version = '0.0.0.dev'
version = 'Unknown'

from typing import Tuple, Union

Expand Down
7 changes: 6 additions & 1 deletion ansible_base/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
version = '0.0.0.dev'
import datetime
import subprocess

calver_now = datetime.datetime.now().strftime("%Y.%m.%d")
shaw = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
version = f'{calver_now}-{shaw}'

0 comments on commit 4f4d478

Please sign in to comment.