mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 17:51:41 -05:00
Improve updates sending script.
This commit is contained in:
parent
e5536880fb
commit
6fc4facddf
1 changed files with 75 additions and 49 deletions
|
@ -8,6 +8,7 @@ today = ''
|
|||
nextLast = False
|
||||
nextDate = False
|
||||
building = True
|
||||
composing = False
|
||||
for arg in sys.argv:
|
||||
if nextLast:
|
||||
lastCommit = arg
|
||||
|
@ -17,8 +18,11 @@ for arg in sys.argv:
|
|||
nextDate = False
|
||||
elif arg == 'send':
|
||||
building = False
|
||||
composing = False
|
||||
elif arg == 'from':
|
||||
nextLast = True
|
||||
building = False
|
||||
composing = True
|
||||
elif arg == 'date':
|
||||
nextDate = True
|
||||
|
||||
|
@ -103,11 +107,7 @@ if building:
|
|||
print('Finished.')
|
||||
finish(0)
|
||||
|
||||
|
||||
if not os.path.exists('../out/Debug/' + outputFolder + '/' + archive):
|
||||
print('[ERROR] Not built yet.')
|
||||
finish(1)
|
||||
|
||||
if composing:
|
||||
templatePath = scriptPath + '/../../../TelegramPrivate/updates_template.txt'
|
||||
if not os.path.exists(templatePath):
|
||||
print('[ERROR] Template file "' + templatePath + '" not found.')
|
||||
|
@ -146,9 +146,6 @@ if not len(commits):
|
|||
|
||||
changelog = '\n'.join(commits)
|
||||
print('\n\nReady! File: ' + archive + '\nChangelog:\n' + changelog)
|
||||
if len(changelog) > 1024:
|
||||
print('[ERROR] Length: ' + str(len(changelog)))
|
||||
finish(1)
|
||||
with open(templatePath, 'r') as template:
|
||||
with open(scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt', 'w') as f:
|
||||
for line in template:
|
||||
|
@ -157,6 +154,35 @@ with open(templatePath, 'r') as template:
|
|||
line = line.replace('{path}', scriptPath + '/../../out/Debug/' + outputFolder + '/' + archive)
|
||||
line = line.replace('{caption}', 'TDesktop at ' + today.replace('_', '.') + ':\n\n' + changelog)
|
||||
f.write(line)
|
||||
finish(0)
|
||||
|
||||
commandPath = scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt'
|
||||
if not os.path.exists(commandPath):
|
||||
print('[ERROR] Command file not found.')
|
||||
finish(1)
|
||||
|
||||
readingCaption = False
|
||||
caption = ''
|
||||
with open(commandPath, 'r') as f:
|
||||
for line in f:
|
||||
if readingCaption:
|
||||
caption = caption + line
|
||||
elif line.startswith('caption: '):
|
||||
readingCaption = True
|
||||
caption = line[len('caption: '):]
|
||||
if not caption.startswith('TDesktop at ' + today.replace('_', '.') + ':'):
|
||||
print('[ERROR] Wrong caption start.')
|
||||
finish(1)
|
||||
print('\n\nSending! File: ' + archive + '\nChangelog:\n' + caption)
|
||||
if len(caption) > 1024:
|
||||
print('[ERROR] Length: ' + str(len(caption)))
|
||||
print('vi ' + commandPath)
|
||||
finish(1)
|
||||
|
||||
if not os.path.exists('../out/Debug/' + outputFolder + '/' + archive):
|
||||
print('[ERROR] Not built yet.')
|
||||
finish(1)
|
||||
|
||||
subprocess.call(scriptPath + '/../../out/Debug/Telegram.app/Contents/MacOS/Telegram -sendpath interpret://' + scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt', shell=True)
|
||||
|
||||
finish(0)
|
||||
|
|
Loading…
Add table
Reference in a new issue