mirror of https://github.com/procxx/kepka.git
Add caption limit check to updates posting.
This commit is contained in:
parent
65242a503b
commit
811bef41b8
|
@ -1,7 +1,5 @@
|
||||||
import os, sys, re, subprocess, datetime
|
import os, sys, re, subprocess, datetime
|
||||||
|
|
||||||
print('Building debug version for OS X 10.8+..')
|
|
||||||
|
|
||||||
executePath = os.getcwd()
|
executePath = os.getcwd()
|
||||||
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
@ -9,7 +7,7 @@ lastCommit = ''
|
||||||
today = ''
|
today = ''
|
||||||
nextLast = False
|
nextLast = False
|
||||||
nextDate = False
|
nextDate = False
|
||||||
sending = False
|
building = True
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
if nextLast:
|
if nextLast:
|
||||||
lastCommit = arg
|
lastCommit = arg
|
||||||
|
@ -18,7 +16,7 @@ for arg in sys.argv:
|
||||||
today = arg
|
today = arg
|
||||||
nextDate = False
|
nextDate = False
|
||||||
elif arg == 'send':
|
elif arg == 'send':
|
||||||
sending = True
|
building = False
|
||||||
elif arg == 'from':
|
elif arg == 'from':
|
||||||
nextLast = True
|
nextLast = True
|
||||||
elif arg == 'date':
|
elif arg == 'date':
|
||||||
|
@ -35,15 +33,81 @@ if today == '':
|
||||||
today = datetime.datetime.now().strftime("%d_%m_%y")
|
today = datetime.datetime.now().strftime("%d_%m_%y")
|
||||||
outputFolder = 'updates/' + today
|
outputFolder = 'updates/' + today
|
||||||
|
|
||||||
if os.path.exists('../out/Debug/' + outputFolder):
|
archive = 'tdesktop_macOS_' + today + '.zip'
|
||||||
if sending:
|
|
||||||
#subprocess.call(['/Applications/Telegram.app/Contents/MacOS/Telegram', '-sendpath', 'interpret://' + scriptPath + '../../out/Debug/' + outputFolder + '/command.txt'], shell=True)
|
if building:
|
||||||
subprocess.call(scriptPath + '/../../out/Debug/Telegram.app/Contents/MacOS/Telegram -sendpath interpret://' + scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt', shell=True)
|
print('Building debug version for OS X 10.8+..')
|
||||||
finish(0)
|
|
||||||
else:
|
if os.path.exists('../out/Debug/' + outputFolder):
|
||||||
print('[ERROR] Todays updates version exists.')
|
print('[ERROR] Todays updates version exists.')
|
||||||
finish(1)
|
finish(1)
|
||||||
|
|
||||||
|
result = subprocess.call('gyp/refresh.sh', shell=True)
|
||||||
|
if result != 0:
|
||||||
|
print('[ERROR] While calling GYP.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
result = subprocess.call('xcodebuild -project Telegram.xcodeproj -alltargets -configuration Debug build', shell=True)
|
||||||
|
if result != 0:
|
||||||
|
print('[ERROR] While building Telegram.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
os.chdir('../out/Debug')
|
||||||
|
if not os.path.exists('Telegram.app'):
|
||||||
|
print('[ERROR] Telegram.app not found.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
result = subprocess.call('strip Telegram.app/Contents/MacOS/Telegram', shell=True)
|
||||||
|
if result != 0:
|
||||||
|
print('[ERROR] While stripping Telegram.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
result = subprocess.call('codesign --force --deep --sign "Developer ID Application: John Preston" Telegram.app', shell=True)
|
||||||
|
if result != 0:
|
||||||
|
print('[ERROR] While signing Telegram.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
if not os.path.exists('Telegram.app/Contents/Frameworks/Updater'):
|
||||||
|
print('[ERROR] Updater not found.')
|
||||||
|
finish(1)
|
||||||
|
elif not os.path.exists('Telegram.app/Contents/Helpers/crashpad_handler'):
|
||||||
|
print('[ERROR] crashpad_handler not found.')
|
||||||
|
finish(1)
|
||||||
|
elif not os.path.exists('Telegram.app/Contents/Resources/Icon.icns'):
|
||||||
|
print('[ERROR] Icon not found.')
|
||||||
|
finish(1)
|
||||||
|
elif not os.path.exists('Telegram.app/Contents/_CodeSignature'):
|
||||||
|
print('[ERROR] Signature not found.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
if os.path.exists(today):
|
||||||
|
subprocess.call('rm -rf ' + today, shell=True)
|
||||||
|
result = subprocess.call('mkdir -p ' + today + '/TelegramForcePortable', shell=True)
|
||||||
|
if result != 0:
|
||||||
|
print('[ERROR] Creating folder ' + today + '/TelegramForcePortable')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
result = subprocess.call('cp -r Telegram.app ' + today + '/', shell=True)
|
||||||
|
if result != 0:
|
||||||
|
print('[ERROR] Cloning Telegram.app to ' + today + '.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
result = subprocess.call('zip -r ' + archive + ' ' + today, shell=True)
|
||||||
|
if result != 0:
|
||||||
|
print('[ERROR] Adding tdesktop to archive.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
|
subprocess.call('mkdir -p ' + outputFolder, shell=True)
|
||||||
|
subprocess.call('mv ' + archive + ' ' + outputFolder + '/', shell=True)
|
||||||
|
subprocess.call('rm -rf ' + today, shell=True)
|
||||||
|
print('Finished.')
|
||||||
|
finish(0)
|
||||||
|
|
||||||
|
|
||||||
|
if not os.path.exists('../out/Debug/' + outputFolder + '/' + archive):
|
||||||
|
print('[ERROR] Not built yet.')
|
||||||
|
finish(1)
|
||||||
|
|
||||||
templatePath = scriptPath + '/../../../TelegramPrivate/updates_template.txt'
|
templatePath = scriptPath + '/../../../TelegramPrivate/updates_template.txt'
|
||||||
if not os.path.exists(templatePath):
|
if not os.path.exists(templatePath):
|
||||||
print('[ERROR] Template file "' + templatePath + '" not found.')
|
print('[ERROR] Template file "' + templatePath + '" not found.')
|
||||||
|
@ -80,77 +144,19 @@ if not len(commits):
|
||||||
print('[ERROR] No commits since last build :(')
|
print('[ERROR] No commits since last build :(')
|
||||||
finish(1)
|
finish(1)
|
||||||
|
|
||||||
result = subprocess.call('gyp/refresh.sh', shell=True)
|
|
||||||
if result != 0:
|
|
||||||
print('[ERROR] While calling GYP.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
result = subprocess.call('xcodebuild -project Telegram.xcodeproj -alltargets -configuration Debug build', shell=True)
|
|
||||||
if result != 0:
|
|
||||||
print('[ERROR] While building Telegram.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
os.chdir('../out/Debug')
|
|
||||||
if not os.path.exists('Telegram.app'):
|
|
||||||
print('[ERROR] Telegram.app not found.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
result = subprocess.call('strip Telegram.app/Contents/MacOS/Telegram', shell=True)
|
|
||||||
if result != 0:
|
|
||||||
print('[ERROR] While stripping Telegram.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
result = subprocess.call('codesign --force --deep --sign "Developer ID Application: John Preston" Telegram.app', shell=True)
|
|
||||||
if result != 0:
|
|
||||||
print('[ERROR] While signing Telegram.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
if not os.path.exists('Telegram.app/Contents/Frameworks/Updater'):
|
|
||||||
print('[ERROR] Updater not found.')
|
|
||||||
finish(1)
|
|
||||||
elif not os.path.exists('Telegram.app/Contents/Helpers/crashpad_handler'):
|
|
||||||
print('[ERROR] crashpad_handler not found.')
|
|
||||||
finish(1)
|
|
||||||
elif not os.path.exists('Telegram.app/Contents/Resources/Icon.icns'):
|
|
||||||
print('[ERROR] Icon not found.')
|
|
||||||
finish(1)
|
|
||||||
elif not os.path.exists('Telegram.app/Contents/_CodeSignature'):
|
|
||||||
print('[ERROR] Signature not found.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
if os.path.exists(today):
|
|
||||||
subprocess.call('rm -rf ' + today, shell=True)
|
|
||||||
result = subprocess.call('mkdir -p ' + today + '/TelegramForcePortable', shell=True)
|
|
||||||
if result != 0:
|
|
||||||
print('[ERROR] Creating folder ' + today + '/TelegramForcePortable')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
result = subprocess.call('cp -r Telegram.app ' + today + '/', shell=True)
|
|
||||||
if result != 0:
|
|
||||||
print('[ERROR] Cloning Telegram.app to ' + today + '.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
archive = 'tdesktop_macOS_' + today + '.zip'
|
|
||||||
result = subprocess.call('zip -r ' + archive + ' ' + today, shell=True)
|
|
||||||
if result != 0:
|
|
||||||
print('[ERROR] Adding tdesktop to archive.')
|
|
||||||
finish(1)
|
|
||||||
|
|
||||||
changelog = '\n'.join(commits)
|
changelog = '\n'.join(commits)
|
||||||
print('\n\nReady! File: ' + archive + '\nChangelog:\n' + changelog)
|
print('\n\nReady! File: ' + archive + '\nChangelog:\n' + changelog)
|
||||||
|
if len(changelog) > 1024:
|
||||||
subprocess.call('mkdir -p ' + outputFolder, shell=True)
|
print('[ERROR] Length: ' + str(len(changelog)))
|
||||||
subprocess.call('mv ' + archive + ' ' + outputFolder + '/', shell=True)
|
finish(1)
|
||||||
with open(templatePath, 'r') as template:
|
with open(templatePath, 'r') as template:
|
||||||
with open(outputFolder + '/command.txt', 'w') as f:
|
with open(scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt', 'w') as f:
|
||||||
for line in template:
|
for line in template:
|
||||||
if line.startswith('//'):
|
if line.startswith('//'):
|
||||||
continue
|
continue
|
||||||
line = line.replace('{path}', scriptPath + '/../../out/Debug/' + outputFolder + '/' + archive)
|
line = line.replace('{path}', scriptPath + '/../../out/Debug/' + outputFolder + '/' + archive)
|
||||||
line = line.replace('{caption}', 'TDesktop at ' + today.replace('_', '.') + ':\n\n' + changelog)
|
line = line.replace('{caption}', 'TDesktop at ' + today.replace('_', '.') + ':\n\n' + changelog)
|
||||||
f.write(line)
|
f.write(line)
|
||||||
|
subprocess.call(scriptPath + '/../../out/Debug/Telegram.app/Contents/MacOS/Telegram -sendpath interpret://' + scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt', shell=True)
|
||||||
subprocess.call('rm -rf ' + today, shell=True)
|
|
||||||
print('Finished.')
|
|
||||||
|
|
||||||
finish(0)
|
finish(0)
|
||||||
|
|
Loading…
Reference in New Issue