OLD | NEW |
(Empty) | |
| 1 import sys |
| 2 import msilib |
| 3 import argparse |
| 4 |
| 5 def main(): |
| 6 # Check arguments |
| 7 parser = argparse.ArgumentParser(description='Embed .mst transform into
the MSI database.') |
| 8 parser.add_argument('storageName', metavar='storageName', help="The name
of the storage (language name)") |
| 9 parser.add_argument('databasePath', metavar='databasePath', help="Path t
o MSI in which to embed") |
| 10 parser.add_argument('importPath', metavar='importPath', help="Path to tr
ansform file (.mst)") |
| 11 |
| 12 args = parser.parse_args(); |
| 13 # Open database and create a view on the _Storages table |
| 14 sqlQuery = "SELECT `Name`,`Data` FROM _Storages" |
| 15 database = msilib.OpenDatabase(args.databasePath, 1) |
| 16 view = database.OpenView(sqlQuery) |
| 17 |
| 18 # Create and Insert the row with 2 fields. |
| 19 record = msilib.CreateRecord(2) |
| 20 record.SetString(1, args.storageName) |
| 21 view.Execute(record) |
| 22 |
| 23 # Insert storage - copy data into stream |
| 24 record.SetStream(2, args.importPath) |
| 25 view.Modify(3, record) |
| 26 database.Commit() |
| 27 |
| 28 if __name__ == "__main__": |
| 29 main() |
OLD | NEW |