Corrections to gen_versioninfo.py script

- Use main() function
- Call utils.change_cwd()
- Import info text
- Don't use fstrings
This commit is contained in:
bitraid 2018-06-10 02:24:47 +03:00
parent 1e5b325ea5
commit 00199ae60e
No known key found for this signature in database
GPG Key ID: 140D99CA504654D3
2 changed files with 33 additions and 33 deletions

View File

@ -234,7 +234,7 @@ def build_windows():
artifacts = []
utils.print_title("Updating VersionInfo file")
gen_versioninfo
gen_versioninfo.main()
utils.print_title("Running pyinstaller 32bit")
_maybe_remove(out_32)

View File

@ -29,7 +29,11 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
os.pardir))
import qutebrowser
from scripts import utils
def main():
utils.change_cwd()
out_filename = 'misc/file_version_info.txt'
filevers = qutebrowser.__version_info__ + (0,)
@ -37,35 +41,31 @@ prodvers = qutebrowser.__version_info__ + (0,)
str_filevers = qutebrowser.__version__
str_prodvers = qutebrowser.__version__
comment_text = """\
A keyboard-focused browser with a minimal GUI.\
"""
copyright_text = """\
© 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>\
"""
trademark_text = """\
qutebrowser is free software under the GNU General Public License\
"""
comment_text = qutebrowser.__doc__
copyright_text = qutebrowser.__copyright__
trademark_text = "qutebrowser is free software under the GNU General Public License"
ffi = vs.FixedFileInfo(filevers, prodvers)
kids = [vs.StringFileInfo(
[vs.StringTable('040904B0',
[vs.StringStruct('Comments', f'{comment_text}'),
[vs.StringStruct('Comments', comment_text),
vs.StringStruct('CompanyName', "qutebrowser.org"),
vs.StringStruct('FileDescription', "qutebrowser"),
vs.StringStruct('FileVersion', f'{str_filevers}'),
vs.StringStruct('FileVersion', str_filevers),
vs.StringStruct('InternalName', "qutebrowser"),
vs.StringStruct('LegalCopyright', f'{copyright_text}'),
vs.StringStruct('LegalTrademarks', f'{trademark_text}'),
vs.StringStruct('LegalCopyright', copyright_text),
vs.StringStruct('LegalTrademarks', trademark_text),
vs.StringStruct('OriginalFilename', "qutebrowser.exe"),
vs.StringStruct('ProductName', "qutebrowser"),
vs.StringStruct('ProductVersion', f'{str_prodvers}')])]),
vs.StringStruct('ProductVersion', str_prodvers)])]),
vs.VarFileInfo([vs.VarStruct('Translation', [1033, 1200])])]
file_version_info = vs.VSVersionInfo(ffi, kids)
with open(out_filename, 'w', encoding='utf-8') as f:
f.write(f'{file_version_info}')
f.write(str(file_version_info))
f.close()
if __name__ == '__main__':
main()