|
| 1 | +if __name__ == "__main__": |
| 2 | + import sys |
| 3 | + |
| 4 | + if len(sys.argv) < 4: |
| 5 | + print('productName, productVersion, versionfileName are required to be passed.') |
| 6 | + sys.exit(1) |
| 7 | + |
| 8 | + productName = sys.argv[1] |
| 9 | + productVersion = sys.argv[2] |
| 10 | + output = sys.argv[3] |
| 11 | + |
| 12 | + template = f''' |
| 13 | +# UTF-8 |
| 14 | +# |
| 15 | +# For more details about fixed file info 'ffi' see: |
| 16 | +# http://msdn.microsoft.com/en-us/library/ms646997.aspx |
| 17 | +VSVersionInfo( |
| 18 | + ffi=FixedFileInfo( |
| 19 | + # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) |
| 20 | + # Set not needed items to zero 0. |
| 21 | + filevers=(1, 0, 0, 0), |
| 22 | + prodvers=(1, 0, 0, 0), |
| 23 | + # Contains a bitmask that specifies the valid bits 'flags'r |
| 24 | + mask=0x3f, |
| 25 | + # Contains a bitmask that specifies the Boolean attributes of the file. |
| 26 | + flags=0x0, |
| 27 | + # The operating system for which this file was designed. |
| 28 | + # 0x4 - NT and there is no need to change it. |
| 29 | + OS=0x4, |
| 30 | + # The general type of file. |
| 31 | + # 0x1 - the file is an application. |
| 32 | + fileType=0x1, |
| 33 | + # The function of the file. |
| 34 | + # 0x0 - the function is not defined for this fileType |
| 35 | + subtype=0x0, |
| 36 | + # Creation date and time stamp. |
| 37 | + date=(0, 0) |
| 38 | + ), |
| 39 | + kids=[ |
| 40 | + StringFileInfo( |
| 41 | + [StringTable( |
| 42 | + u'000004b0', |
| 43 | + [ |
| 44 | + StringStruct(u'Comments', u''), |
| 45 | + StringStruct(u'CompanyName', u''), |
| 46 | + StringStruct(u'FileDescription', u''), |
| 47 | + StringStruct(u'FileVersion', u'1.0.0.0'), |
| 48 | + StringStruct(u'InternalName', u''), |
| 49 | + StringStruct(u'LegalCopyright', u''), |
| 50 | + StringStruct(u'LegalTrademarks', u''), |
| 51 | + StringStruct(u'OriginalFilename', u''), |
| 52 | + StringStruct(u'ProductName', u'{productName}'), |
| 53 | + StringStruct(u'ProductVersion', u'{productVersion}'), |
| 54 | + StringStruct(u'Assembly Version', u'1.0.0.0') |
| 55 | + ] |
| 56 | + ) |
| 57 | + ]), |
| 58 | + VarFileInfo([VarStruct(u'Translation', [0, 1200]) |
| 59 | + ]) |
| 60 | + ] |
| 61 | +) |
| 62 | +''' |
| 63 | + |
| 64 | + with open(output, "w+", encoding="utf-8") as f: |
| 65 | + f.write(template) |
0 commit comments