Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: installer/emb.py

Issue 4565805475823616: Issue 1984 - Do not use VBScript in installer build tools (Closed)
Patch Set: Created April 13, 2015, 10:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | installer/emb.vbs » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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()
OLDNEW
« no previous file with comments | « no previous file | installer/emb.vbs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld