-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87079b0
commit e4bf057
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import subprocess | ||
|
||
|
||
def git_tag(): | ||
try: | ||
return subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).strip().decode('utf-8') | ||
except: | ||
return "v0.0.0" | ||
|
||
|
||
def commit_hash(): | ||
try: | ||
hash = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip().decode('utf-8') | ||
return hash, hash[:7] | ||
except: | ||
return "", "" | ||
|
||
|
||
def version_processor(request): | ||
commit, short_commit = commit_hash() | ||
return {'git_tag': git_tag(), 'commit': commit, 'short_commit': short_commit} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters