# -*- coding: utf-8 -*-
##################################################
# This file is part of WAPT Enterprise
# All right reserved, (c) Tranquil IT Systems 2024
# For more information please refer to
# https://wapt.tranquil.it/store/licences.html
##################################################
from setuphelpers import *
"""
{
"key":"{541F7763-4E1B-4D16-913A-16A1D42D4673}",
"name":"Simulis Thermodynamics 64-bit",
"version":"2.0.40",
"install_date":"2024-03-28 00:00:00",
"install_location":"C:\\Program Files (x86)\\Simulis\\",
"uninstall_string":"MsiExec.exe /I{541F7763-4E1B-4D16-913A-16A1D42D4673}",
"publisher":"ProSim",
"system_component":0,
"win64":true
},
{
"key":"{7FF8292C-FCB3-4224-A0E8-987154FC0EF5}",
"name":"ProSimPlus 3 Environment",
"version":"3.7.2.0",
"install_date":"2024-03-28 00:00:00",
"install_location":"C:\\Program Files (x86)\\ProSimPlus3\\",
"uninstall_string":"MsiExec.exe /I{7FF8292C-FCB3-4224-A0E8-987154FC0EF5}",
"publisher":"ProSim",
"system_component":0,
"win64":false
},
{
"key":"{8745114A-EBEA-4FF0-ADFB-D8F6C4BECF03}",
"name":"ProSim License Manager",
"version":"2.1.1",
"install_date":"2024-03-28 00:00:00",
"install_location":"C:\\Program Files (x86)\\ProSim Licenses\\ProSim License Manager\\",
"uninstall_string":"MsiExec.exe /I{8745114A-EBEA-4FF0-ADFB-D8F6C4BECF03}",
"publisher":"ProSim",
"system_component":0,
"win64":false
},
{
"key":"{8A02A8DD-199C-44E8-BFFF-A7B08AC0C6AC}",
"name":"ProSimPlus 3 Standard Package",
"version":"3.7.2.0",
"install_date":"2024-03-28 00:00:00",
"install_location":"C:\\Program Files (x86)\\ProSimPlus3\\",
"uninstall_string":"MsiExec.exe /X{8A02A8DD-199C-44E8-BFFF-A7B08AC0C6AC}",
"publisher":"ProSim",
"system_component":0,
"win64":false
}
"""
uninstallkey = ["{8745114A-EBEA-4FF0-ADFB-D8F6C4BECF03}"]
def install():
# Installing the software
install_exe_if_needed(
"ProSimPlusEnvironment3.7.2.0.exe",
# silentflags='/v"INSTALLDIR="C:\Appli\ProSimPlus3"" /L1036 /S /v/qn',
silentflags="/L1036 /S /v/qn",
key="{7FF8292C-FCB3-4224-A0E8-987154FC0EF5}",
min_version=control.get_software_version(),
timeout=900,
)
install_exe_if_needed(
"ProSimPlusStandardPackage3.7.2.0.exe",
silentflags="/L1036 /S /v/qn",
key="{8A02A8DD-199C-44E8-BFFF-A7B08AC0C6AC}",
min_version="",
timeout=900,
)
install_exe_if_needed(
"SimulisThermodynamics64-bit2.0.40.exe",
silentflags="/L1036 /S /v/qn",
key="{541F7763-4E1B-4D16-913A-16A1D42D4673}",
min_version="",
timeout=900,
)
# print("Suppression des licences d'essais:")
# remove_tree("C:\\Program Files (x86)\\ProSim Licenses\\ProSim License Manager\\Licenses")
# mkdirs("C:\\Program Files (x86)\\ProSim Licenses\\ProSim License Manager\\Licenses")
# registry_set(HKEY_LOCAL_MACHINE, "Software\\ProSim\\Licenses\\Managers", "Server_0", "server_name:port")
# def session_setup():
# print("Définition du serveur de licence:")
# registry_set(HKEY_CURRENT_USER, "Software\\ProSim\\PLM\\MRU", "MRU1", "server_name")
def uninstall():
remove_desktop_shortcut("Démarrer avec ProSim")
remove_desktop_shortcut("Exemples ProSim")
remove_desktop_shortcut("Simulis Thermodynamics - complément pour Excel")
try:
remove_user_desktop_shortcut("Démarrer avec ProSim")
remove_user_desktop_shortcut("Exemples ProSim")
remove_user_desktop_shortcut("Simulis Thermodynamics - complément pour Excel")
except:
pass
print(remove_tree_for_all_users(r"Documents\ProSim", ignore_system_users=False))
def remove_tree_for_all_users(user_folder_relative_path, ignored_users=None, ignore_system_users=True):
r"""Remove a specific folder or folders for all user's profiles
Args:
user_folder_relative_path (str): relative path to user folder, glob patterns can be used
ignored_users (str or list of str): ignore specified users
ignore_system_users (bool): ignore default, public, all users, etc. True by default
Returns:
list: list of deleted folders
>>> print(remove_tree_for_all_users(makepath(".vscode", "extensions", "ms-toolsai.jupyter-*")))
['C:\\Users\\username\\.vscode\\extensions\\ms-toolsai.jupyter-2022.2.1001817079', 'C:\\Users\\username\\.vscode\\extensions\\ms-toolsai.jupyter-keymap-1.0.0', 'C:\\Users\\username\\.vscode\\extensions\\ms-toolsai.jupyter-renderers-1.0.6']
>>> print(remove_tree_for_all_users(makepath(".vscode", "extensions", "ms-toolsai.jupyter-")))
[]
>>> print(remove_tree_for_all_users(makepath(".vscode", "extensions", "ms-toolsai.jupyter-[a-z]*")))
['C:\\Users\\username\\.vscode\\extensions\\ms-toolsai.jupyter-keymap-1.0.0', 'C:\\Users\\username\\.vscode\\extensions\\ms-toolsai.jupyter-renderers-1.0.6']
>>> print(remove_tree_for_all_users(makepath(".vscode", "extensions", "ms-toolsai.jupyter-1.0.0")))
['/home/username/.vscode/extensions/ms-toolsai.jupyter-keymap-1.0.0']
.. versionadded:: 2.3
"""
system_users_list = ["All Users", "Default", "Default User", "Public", "Shared"]
if ignored_users is None:
ignored_users = []
if type(ignored_users) != list:
ignored_users = [ignored_users]
skipped_users = []
if ignored_users:
skipped_users.extend(ignored_users)
if ignore_system_users:
skipped_users.extend(system_users_list)
if get_os_name() == "Windows":
users_dir = makepath(systemdrive, "Users")
elif get_os_name() == "Linux":
users_dir = "/home"
elif get_os_name() == "Darwin":
users_dir = "/Users"
deleted_folders = []
for user_profile in glob.glob(f"{users_dir}/*/"):
skip = False
for skipped_user in skipped_users:
if os.path.basename(user_profile.rstrip(os.path.sep)) == skipped_user:
skip = True
break
if not skip:
for user_folder_to_delete in glob.glob(os.path.join(user_profile, user_folder_relative_path)):
deleted_folders.append(user_folder_to_delete)
remove_tree(user_folder_to_delete)
return deleted_folders