From 3f1041eb0aee4b418d102b3a9df126ac15d6b8d5 Mon Sep 17 00:00:00 2001 From: bitraid Date: Sun, 22 Apr 2018 20:35:34 +0300 Subject: [PATCH] gen_versioninfo.py: remove unused import, rename most variables and reformat --- scripts/dev/gen_versioninfo.py | 57 ++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/scripts/dev/gen_versioninfo.py b/scripts/dev/gen_versioninfo.py index 2a96329d8..6d7188880 100644 --- a/scripts/dev/gen_versioninfo.py +++ b/scripts/dev/gen_versioninfo.py @@ -20,49 +20,52 @@ """Generate file_version_info.txt for Pyinstaller use with Windows builds.""" -import os import os.path import sys -from PyInstaller.utils.win32 import versioninfo +from PyInstaller.utils.win32 import versioninfo as vs sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) import qutebrowser - out_filename = 'file_version_info.txt' -FileVersion = qutebrowser.__version_info__ + (0,) -ProductVersion = qutebrowser.__version_info__ + (0,) +filevers = qutebrowser.__version_info__ + (0,) +prodvers = qutebrowser.__version_info__ + (0,) +str_filevers = qutebrowser.__version__ +str_prodvers = qutebrowser.__version__ -CommentText = "A keyboard-focused browser with a minimal GUI." -CopyrightText = "© 2014-2018 Florian Bruhin (The Compiler) \ -" -TrademarkText = "qutebrowser is free software under the GNU General Public \ -License" +comment_text = """\ +A keyboard-focused browser with a minimal GUI.\ +""" +copyright_text = """\ +© 2014-2018 Florian Bruhin (The Compiler) \ +""" +trademark_text = """\ +qutebrowser is free software under the GNU General Public License\ +""" -FixedFileInfo = versioninfo.FixedFileInfo(FileVersion, ProductVersion) +ffi = vs.FixedFileInfo(filevers, prodvers) -StringFileInfo = [versioninfo.StringFileInfo( - [versioninfo.StringTable('040904B0', - [versioninfo.StringStruct('Comments',f'{CommentText}'), - versioninfo.StringStruct('CompanyName',"qutebrowser.org"), - versioninfo.StringStruct('FileDescription',"qutebrowser"), - versioninfo.StringStruct('FileVersion',f'{qutebrowser.__version__}'), - versioninfo.StringStruct('InternalName',"qutebrowser"), - versioninfo.StringStruct('LegalCopyright',f'{CopyrightText}'), - versioninfo.StringStruct('LegalTrademarks',f'{TrademarkText}'), - versioninfo.StringStruct('OriginalFilename',"qutebrowser.exe"), - versioninfo.StringStruct('ProductName',"qutebrowser"), - versioninfo.StringStruct('ProductVersion',f'{qutebrowser.__version__}')])]), - versioninfo.VarFileInfo([versioninfo.VarStruct('Translation', - [1033, 1200])])] +kids = [vs.StringFileInfo( + [vs.StringTable('040904B0', + [vs.StringStruct('Comments', f'{comment_text}'), + vs.StringStruct('CompanyName', "qutebrowser.org"), + vs.StringStruct('FileDescription', "qutebrowser"), + vs.StringStruct('FileVersion', f'{str_filevers}'), + vs.StringStruct('InternalName', "qutebrowser"), + vs.StringStruct('LegalCopyright', f'{copyright_text}'), + vs.StringStruct('LegalTrademarks', f'{trademark_text}'), + vs.StringStruct('OriginalFilename', "qutebrowser.exe"), + vs.StringStruct('ProductName', "qutebrowser"), + vs.StringStruct('ProductVersion', f'{str_prodvers}')])]), + vs.VarFileInfo([vs.VarStruct('Translation', [1033, 1200])])] -VSVersionInfo = versioninfo.VSVersionInfo(FixedFileInfo, StringFileInfo) +file_version_info = vs.VSVersionInfo(ffi, kids) with open(out_filename, 'w', encoding='utf-8') as f: - f.write(f'{VSVersionInfo}') + f.write(f'{file_version_info}') f.close()