MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / init_database

Function init_database

tools/python-3.11.9-amd64/Lib/msilib/__init__.py:136–173  ·  view source on GitHub ↗
(name, schema,
                  ProductName, ProductCode, ProductVersion,
                  Manufacturer)

Source from the content-addressed store, hash-verified

134 v.Close()
135
136def init_database(name, schema,
137 ProductName, ProductCode, ProductVersion,
138 Manufacturer):
139 try:
140 os.unlink(name)
141 except OSError:
142 pass
143 ProductCode = ProductCode.upper()
144 # Create the database
145 db = OpenDatabase(name, MSIDBOPEN_CREATE)
146 # Create the tables
147 for t in schema.tables:
148 t.create(db)
149 # Fill the validation table
150 add_data(db, "_Validation", schema._Validation_records)
151 # Initialize the summary information, allowing atmost 20 properties
152 si = db.GetSummaryInformation(20)
153 si.SetProperty(PID_TITLE, "Installation Database")
154 si.SetProperty(PID_SUBJECT, ProductName)
155 si.SetProperty(PID_AUTHOR, Manufacturer)
156 if AMD64:
157 si.SetProperty(PID_TEMPLATE, "x64;1033")
158 else:
159 si.SetProperty(PID_TEMPLATE, "Intel;1033")
160 si.SetProperty(PID_REVNUMBER, gen_uuid())
161 si.SetProperty(PID_WORDCOUNT, 2) # long file names, compressed, original media
162 si.SetProperty(PID_PAGECOUNT, 200)
163 si.SetProperty(PID_APPNAME, "Python MSI Library")
164 # XXX more properties
165 si.Persist()
166 add_data(db, "Property", [
167 ("ProductName", ProductName),
168 ("ProductCode", ProductCode),
169 ("ProductVersion", ProductVersion),
170 ("Manufacturer", Manufacturer),
171 ("ProductLanguage", "1033")])
172 db.Commit()
173 return db
174
175def add_tables(db, module):
176 for table in module.tables:

Callers

nothing calls this directly

Calls 5

add_dataFunction · 0.85
gen_uuidFunction · 0.85
upperMethod · 0.80
unlinkMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected