@@ -118,6 +118,21 @@ def package_version(dependency_version):
118118VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -consoleApp ${console_app} -innerFolder ${inner_folder} -arguments $arguments
119119"""
120120
121+ INSTALLER_EXE_TEMPLATE = r"""$ErrorActionPreference = 'Stop'
122+ Import-Module vm.common -Force -DisableNameChecking
123+
124+ $toolName = '{tool_name}'
125+ $category = VM-Get-Category($MyInvocation.MyCommand.Definition)
126+
127+ $exeUrl = '{target_url}'
128+ $exeSha256 = '{target_hash}'
129+
130+ $toolDir = Join-Path ${{Env:RAW_TOOLS_DIR}} $toolName
131+ $executablePath = (Join-Path $toolDir '{target_file}')
132+ VM-Install-With-Installer $toolName $category "EXE" "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /Dir=`"$($toolDir)`"" `
133+ $executablePath $exeUrl -sha256 $exeSha256
134+ """
135+
121136"""
122137Needs the following format strings:
123138 tool_name="...", category="..."
@@ -228,6 +243,17 @@ def package_version(dependency_version):
228243VM-Uninstall $toolName $category
229244"""
230245
246+ UNINSTALLER_EXE_TEMPLATE = r"""$ErrorActionPreference = 'Continue'
247+ Import-Module vm.common -Force -DisableNameChecking
248+
249+ $toolName = '{tool_name}'
250+ $category = VM-Get-Category($MyInvocation.MyCommand.Definition)
251+
252+ VM-Uninstall-With-Uninstaller $toolName $category "EXE" "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-"
253+
254+ VM-Uninstall $toolName $category
255+ """
256+
231257"""
232258Needs the following format strings:
233259 tool_name="...", category="..."
@@ -280,6 +306,23 @@ def create_zip_exe_template(packages_path, **kwargs):
280306 )
281307
282308
309+ def create_installer_exe_template (packages_path , ** kwargs ):
310+ create_template (
311+ INSTALLER_EXE_TEMPLATE ,
312+ uninstall_template = UNINSTALLER_EXE_TEMPLATE ,
313+ packages_path = packages_path ,
314+ pkg_name = kwargs .get ("pkg_name" ),
315+ version = kwargs .get ("version" ),
316+ authors = kwargs .get ("authors" ),
317+ description = kwargs .get ("description" ),
318+ tool_name = kwargs .get ("tool_name" ),
319+ category = kwargs .get ("category" ),
320+ target_url = kwargs .get ("target_url" ),
321+ target_hash = kwargs .get ("target_hash" ),
322+ target_file = kwargs .get ("target_file" ),
323+ )
324+
325+
283326def create_node_template (packages_path , ** kwargs ):
284327 create_template (
285328 NODE_TEMPLATE ,
@@ -388,6 +431,7 @@ def create_template(
388431 category = "" ,
389432 target_url = "" ,
390433 target_hash = "" ,
434+ target_file = "" ,
391435 shim_path = "" ,
392436 dependency = "" ,
393437 console_app = "" ,
@@ -427,6 +471,7 @@ def create_template(
427471 arguments = arguments ,
428472 target_url = target_url ,
429473 target_hash = target_hash ,
474+ target_file = target_file ,
430475 shim_path = shim_path ,
431476 console_app = console_app ,
432477 inner_folder = inner_folder ,
@@ -476,6 +521,22 @@ def get_script_directory():
476521 "target_hash" ,
477522 ],
478523 },
524+ "INSTALLER_EXE" : {
525+ "cb" : create_installer_exe_template ,
526+ "doc" : "An installer distributed as an EXE file" ,
527+ "example" : "<url>/tool.exe" ,
528+ "arguments" : [
529+ "pkg_name" ,
530+ "version" ,
531+ "authors" ,
532+ "description" ,
533+ "tool_name" ,
534+ "category" ,
535+ "target_url" ,
536+ "target_hash" ,
537+ "target_file" ,
538+ ],
539+ },
479540 "NODE" : {
480541 "cb" : create_node_template ,
481542 "doc" : "An tool from the JavaScript Package Registry installed with npm" ,
@@ -627,6 +688,7 @@ def main(argv=None):
627688 parser .add_argument ("--dependency" , type = str , default = "" , help = "Metapackage dependency" )
628689 parser .add_argument ("--target_url" , type = str , default = "" , help = "URL to target file (zip or executable)" )
629690 parser .add_argument ("--target_hash" , type = str , default = "" , help = "SHA256 hash of target file (zip or executable)" )
691+ parser .add_argument ("--target_file" , type = str , default = "" , help = "EXE name/path under the installed tool folder" )
630692 parser .add_argument ("--shim_path" , type = str , default = "" , help = "Metapackage shim path" )
631693 parser .add_argument (
632694 "--console_app" ,
0 commit comments