Page 1 of 1

[RESOLVED] Chrome package improvement

Published: February 27, 2020 - 9:55 PM
by f4242
Hi,

I found the method of installing Chrome in `update_package()` to get its version number rather cumbersome and sometimes failing until I restarted my VM. I found this alternative. The goal is to extract the "Comments" field from the MSI package, which contains the version number. I haven't found a clean way to extract it, but it works using `findstr`.

Code: Select all

run('for /f %a in (\'findstr "Copyright" "GoogleChromeStandaloneEnterprise64-fr.msi" ^|find "Copyright"\') do echo %a > version_chrome')
with open("version_chrome") as f:
        version_chrome = f.read()
and a little further on

Code: Select all

pe.version = version_chrome.strip() + '-0'
The code can probably be improved to be native Python, but it gives you an idea.

Re: Chrome package improvement

Published: February 28, 2020 - 5:22 PM
by sfonteneau
For your information, I modified it like this

Code: Select all

bin_name = "GoogleChromeStandaloneEnterprise64-fr.msi"
# Get version from description msi
db = msilib.OpenDatabase(bin_name, msilib.MSIDBOPEN_READONLY)
description = db.GetSummaryInformation(1).GetProperty(6)
version = description.split(' ',1)[0]

Re: Chrome package improvement

Published: March 4, 2020 - 7:12 PM
by f4242
Ah, much cleaner :)

! Thank you!