Skip to content

Commit

Permalink
fix version gen
Browse files Browse the repository at this point in the history
  • Loading branch information
SalimTerryLi committed Oct 11, 2021
1 parent 87a5665 commit 98873f0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions port/esp32/integrate_btstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,26 @@
# add support for idf-component-manager
parsed_btstack_version = '0.0'
with open('../../CHANGELOG.md', 'r') as f:
dev_version = False
while True:
rawline = f.readline()
if not rawline:
break
matchobj = re.match(r'^##[\s]+(?:(?:Release v)|(?:))([^\n]+)[\s]*$', rawline)
if matchobj is not None:
parsed_btstack_version = matchobj.groups()[0]
print('BTstack version: ' + parsed_btstack_version)
break
if matchobj.groups()[0] == 'Unreleased':
dev_version = True
else:
if re.match(r'^[\d]+(?:(?:.[\d]+)|(?:))(?:(?:.[\d]+)|(?:))(?:(?:.[\d]+)|(?:))$', matchobj.groups()[0]) is None:
continue
parsed_btstack_version = matchobj.groups()[0]
if dev_version:
ver_num = parsed_btstack_version.split('.')
ver_num[len(ver_num)-1] = str(int(ver_num[len(ver_num)-1]) + 1)
parsed_btstack_version = '.'.join(ver_num)
parsed_btstack_version += '-alpha'
print('BTstack version: ' + parsed_btstack_version)
break
with open(IDF_BTSTACK + '/idf_component.yml', 'w') as f:
f.write(component_manager_yml.replace('BTSTACK_VERSION', parsed_btstack_version))

Expand Down

0 comments on commit 98873f0

Please sign in to comment.