mirror of
https://github.com/deskflow/deskflow.git
synced 2026-06-25 21:12:01 +08:00
Extract 3 segment version from long version string (#7168)
* Extract 3 segment version from long version string * Update changelog * Fix for older versions of python
This commit is contained in:
parent
37301d70a3
commit
fc29ec91a9
@ -1,5 +1,6 @@
|
||||
from argparse import ArgumentParser
|
||||
from datetime import datetime, timezone
|
||||
import re
|
||||
|
||||
IGNORE_SEGMENTS = ['Github Actions:']
|
||||
|
||||
@ -11,14 +12,15 @@ if __name__ == '__main__':
|
||||
parser.add_argument('-u', '--urgency', type=str, default='low', help='Urgency of the package')
|
||||
args = parser.parse_args()
|
||||
build_time = datetime.now(timezone.utc).strftime('%a, %d %b %Y %H:%M:%S %z') # day-of-week, dd month yyyy hh:mm:ss +zzzz
|
||||
with open('ChangeLog', 'r') as in_file, open('debian/changelog', 'w+') as out_file:
|
||||
out_file.write(f'{args.name} ({args.version}) {args.distribution}; urgency={args.urgency}\n')
|
||||
version_str = re.match('^(\d+.\d+.\d+).*$', args.version).group(1)
|
||||
with open('ChangeLog', 'r', encoding='utf8') as in_file, open('debian/changelog', 'w+', encoding='utf8') as out_file:
|
||||
out_file.write('{} ({}) {}; urgency={}\n'.format(args.name, args.version, args.distribution, args.urgency))
|
||||
in_section = False
|
||||
ignore_segment = False
|
||||
|
||||
while line := in_file.readline():
|
||||
line = in_file.readline()
|
||||
while line:
|
||||
if line.startswith('v'):
|
||||
if line.startswith(f'v{args.version}'):
|
||||
if line.startswith('v{}'.format(version_str)):
|
||||
in_section = True
|
||||
elif in_section:
|
||||
break
|
||||
@ -29,10 +31,11 @@ if __name__ == '__main__':
|
||||
elif line.strip() in IGNORE_SEGMENTS:
|
||||
ignore_segment = True
|
||||
elif line.strip().endswith(':'):
|
||||
out_file.write(f'\n * {line.strip()[:-1]}')
|
||||
out_file.write('\n * {}'.format(line.strip()[:-1]))
|
||||
else:
|
||||
if in_section and not ignore_segment:
|
||||
while line.startswith(('#', '|', '-')):
|
||||
line = ' '.join(line.split()[1:])
|
||||
out_file.write(f'\n - {line}')
|
||||
out_file.write(f'\n\n -- Symless <engineering@symless.com> {build_time}')
|
||||
out_file.write('\n - {}'.format(line))
|
||||
line = in_file.readline()
|
||||
out_file.write('\n\n -- Symless <engineering@symless.com> {}\n'.format(build_time))
|
||||
|
||||
@ -16,7 +16,7 @@ Github Actions:
|
||||
- #7156 Change binary storage server
|
||||
- #7161 Use brew bundle to install dependencies
|
||||
- #7162 Add new distributions to CI
|
||||
- #7167 Use changelog when creating deb files
|
||||
- #7167 | #7168 Use changelog when creating deb files
|
||||
- #7169 Remove temporary directory when building debs
|
||||
===========
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user