# -*- coding: utf-8 -*-
##################################################
# This file is part of WAPT Enterprise
# All right reserved, (c) Tranquil IT Systems 2023
# For more information please refer to
# https://wapt.tranquil.it/store/licences.html
##################################################
from setuphelpers import *
"""
{
"key":"{7CA0F5AB-BCE3-491A-8A90-314D41BE0646}",
"name":"Microsoft OLE DB Driver pour SQL Server",
"version":"18.6.7.0",
"install_date":"2024-03-20 00:00:00",
"install_location":"",
"uninstall_string":"MsiExec.exe /I{7CA0F5AB-BCE3-491A-8A90-314D41BE0646}",
"publisher":"Microsoft Corporation",
"system_component":0,
"win64":true
},
{
"key":"{A3E78DD3-5ACE-4FFD-8FAD-72C4C0FD7BB3}",
"name":"Microsoft ODBC Driver 17 for SQL Server",
"version":"17.10.5.1",
"install_date":"2024-03-20 00:00:00",
"install_location":"",
"uninstall_string":"MsiExec.exe /I{A3E78DD3-5ACE-4FFD-8FAD-72C4C0FD7BB3}",
"publisher":"Microsoft Corporation",
"system_component":0,
"win64":true
},
{
"key":"{16c552e8-bf7d-4388-9ffe-2664be292062}",
"name":"Microsoft SQL Server Management Studio - 20.0",
"version":"20.0.70.0",
"install_date":"",
"install_location":"",
"uninstall_string":"\"C:\\ProgramData\\Package Cache\\{16c552e8-bf7d-4388-9ffe-2664be292062}\\SSMS-Setup-FRA.exe\" /uninstall",
"publisher":"Microsoft Corporation",
"system_component":0,
"win64":false
},
{
"key":"{49EB825D-CEF8-40C6-953D-BD1CC6A96B02}",
"name":"SQL Server Management Studio",
"version":"20.0.70.0",
"install_date":"2024-03-20 00:00:00",
"install_location":"",
"uninstall_string":"MsiExec.exe /I{49EB825D-CEF8-40C6-953D-BD1CC6A96B02}",
"publisher":"Microsoft Corp.",
"system_component":0,
"win64":false
},
{
"key":"{B28A5547-1AC6-40BD-9511-7689B8F6AD21}",
"name":"Module linguistique SQL Server Management Studio - Fran\u00e7ais",
"version":"20.0.70.0",
"install_date":"2024-03-20 00:00:00",
"install_location":"",
"uninstall_string":"MsiExec.exe /I{B28A5547-1AC6-40BD-9511-7689B8F6AD21}",
"publisher":"Microsoft Corp.",
"system_component":0,
"win64":false
},
{
"key":"{8122DAB1-ED4D-3676-BB0A-CA368196543E}",
"name":"Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0.40664",
"version":"12.0.40664",
"install_date":"2024-03-20 00:00:00",
"install_location":"",
"uninstall_string":"MsiExec.exe /X{8122DAB1-ED4D-3676-BB0A-CA368196543E}",
"publisher":"Microsoft Corporation",
"system_component":0,
"win64":false
},
{
"key":"{f3fbabb4-bcfb-45eb-8fff-9b784fd68c38}",
"name":"Microsoft Visual Studio Tools for Applications 2019",
"version":"16.0.31110",
"install_date":"",
"install_location":"",
"uninstall_string":"\"C:\\ProgramData\\Package Cache\\{f3fbabb4-bcfb-45eb-8fff-9b784fd68c38}\\vsta_setup.exe\" /uninstall",
"publisher":"Microsoft Corporation",
"system_component":0,
"win64":false
}
"""
def install():
bin_name = glob.glob("SSMS-Setup-*.exe")[0]
install_exe_if_needed(
bin_name,
silentflags="/install /quiet /norestart",
name="Microsoft SQL Server Management Studio - %s" % ".".join(control.get_software_version().split(".")[:2]),
min_version=control.get_software_version(),
timeout=1800,
accept_returncodes=[0, 3010, 1626],
)
def uninstall():
# Uninstalling software
for to_uninstall in installed_softwares("Microsoft OLE DB Driver SQL Server"):
if not uninstall_key_exists(to_uninstall["key"]):
continue
print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
run(uninstall_cmd(to_uninstall["key"]))
wait_uninstallkey_absent(to_uninstall["key"])
for to_uninstall in installed_softwares("Microsoft ODBC Driver 17 for SQL Server"):
if not uninstall_key_exists(to_uninstall["key"]):
continue
print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
run(uninstall_cmd(to_uninstall["key"]))
wait_uninstallkey_absent(to_uninstall["key"])
for to_uninstall in installed_softwares("SQL Server Management Studio"):
if not uninstall_key_exists(to_uninstall["key"]):
continue
print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
run(uninstall_cmd(to_uninstall["key"]))
wait_uninstallkey_absent(to_uninstall["key"])
for to_uninstall in installed_softwares("Microsoft Visual Studio Tools for Applications 2019"):
if not uninstall_key_exists(to_uninstall["key"]):
continue
print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
run(uninstall_cmd(to_uninstall["key"]))
wait_uninstallkey_absent(to_uninstall["key"])