Skip to content

Commit

Permalink
get version from git tag instead of version.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
marzzzello committed Jan 16, 2022
1 parent 799132d commit f1406f8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
1 change: 0 additions & 1 deletion cat_osc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"src/patched_osc.lua"
],

"version_file" : "version.txt",
"version_template_file" : "src/version.tmpl.lua",

"header_prefix" : "--[ ",
Expand Down
3 changes: 1 addition & 2 deletions cat_server.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
"src/thumbnailer_server.lua"
],

"version_file" : "version.txt",
"version_template_file" : "src/version.tmpl.lua",

"header_prefix" : "--[ ",
"header_suffix" : " ]--"
}
}
13 changes: 5 additions & 8 deletions concat_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ def _create_version_metafile(config, config_dirname):
try:
git_branch = subprocess.check_output(['git', '-C', repo_dir, 'symbolic-ref', '--short', '-q', 'HEAD'], stderr=subprocess.DEVNULL).decode().strip()
git_commit = subprocess.check_output(['git', '-C', repo_dir, 'rev-parse', '--short', '-q', 'HEAD'], stderr=subprocess.DEVNULL).decode().strip()
git_tag = subprocess.check_output(['git', '-C', repo_dir, 'describe', '--tags', '--abbrev=0'], stderr=subprocess.DEVNULL).decode().strip()
except:
git_branch = None
git_commit = None
git_tag = None

if not git_branch:
git_branch = 'unknown'
Expand All @@ -255,15 +257,11 @@ def _create_version_metafile(config, config_dirname):
else:
git_commit = git_commit_short = 'unknown'

project_version_file = config.get('version_file')
if project_version_file:
with open(project_version_file, 'r') as in_file:
project_version = in_file.read().strip()
else:
project_version = 'unknown'
if not git_tag:
git_tag = 'unknown'

template_data = {
'version' : project_version,
'version' : git_tag,

'branch' : git_branch,
'commit' : git_commit,
Expand Down Expand Up @@ -352,4 +350,3 @@ def _print_change_writes(source_to_target, target_to_source):
file_watcher.get_changes()

time.sleep(0.25)

1 change: 0 additions & 1 deletion version.txt

This file was deleted.

0 comments on commit f1406f8

Please sign in to comment.