Pagina 1 di 1

[RISOLTO] Condivisione dei pacchetti Webots

Pubblicato: 14 aprile 2025 - 17:05
di olaplanche
Buongiorno,

Condivido il mio pacchetto per il software webots, per il quale ho spinto la configurazione software iniziale un po' oltre rispetto al pacchetto tis (lingua francese, nessuna telemetria e disattivazione dell'aggiornamento automatico) ;)

Codice: Seleziona tutto

# -*- coding: utf-8 -*-
from setuphelpers import *

try:
    from waptenterprise.waptservice.enterprise import get_active_sessions, start_interactive_process
except:
    from waptservice.enterprise import get_active_sessions, start_interactive_process

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls

def install():
    # Declaring local variables
    bin_name= glob.glob("webot*.exe")[0]
    
    def get_version(app_registry_dict):
        return app_registry_dict["version"].replace("R", "").replace("b",".2").replace("a",".1")

    # Uninstalling others versions
    for uninstall in installed_softwares(name="Webots"):
        print("Removing: %s" % (uninstall["name"]))
        killalltasks(control.get_impacted_process_list())
        run(uninstall_cmd(uninstall["key"]))

    # Installing the software
    install_exe_if_needed(
        bin_name,
        silentflags="/VERYSILENT /ALLUSERS",
        key="Webots_is1",
        min_version=control.get_software_version(),
        get_version=get_version
    )

    # Installing Windows Firewall rules
    print('Add Windows Firewall rules')
    add_netfirewallrule(r"webots-bin", r"C:\program files\webots\msys64\mingw64\bin\webots-bin.exe", profile="Domain")

def session_setup():
    # Declaring local variables
    version= "R" + control.get_software_version().replace(".2","b").replace(".1","a")

    # Set french language
    registry_set(HKEY_CURRENT_USER,r'SOFTWARE\\Cyberbotics\\Webots-%s\\General' % version,'language','fr',type=REG_SZ)

    # Disable UpdateOnStartup
    registry_set(HKEY_CURRENT_USER,r'SOFTWARE\\Cyberbotics\\Webots-%s\\General' % version,'checkWebotsUpdateOnStartup','false',type=REG_SZ)

    # Disable telemetry
    registry_set(HKEY_CURRENT_USER,r'SOFTWARE\\Cyberbotics\\Webots-%s\\General' % version,'telemetry','false',type=REG_SZ)

def audit():
    run_session_setup(control.package)
    return "OK"

def run_session_setup(package_name):
    for session_id in get_active_sessions():
        start_interactive_process("wapt-get", "--hide session-setup %s -f" % package_name, session_id=session_id)  # , minimize=True

def uninstall():
    print('Uninstalling Windows Firewall rules')
    remove_netfirewallrule("webots-bin")

Re: Condivisione dei pacchetti Webots

Pubblicato: 17 aprile 2025 - 15:34
di dcardon
Ciao Olivier,

Ingrid si è occupata del pacchetto; è in wapt-testing [1] e dovrebbe essere disponibile sullo store a breve. Grazie per la condivisione. :-)

Contrassegno l'argomento come risolto.

Cordiali saluti,

Denis

[1] https://wapt.tranquil.it/wapt-testing/t ... EPROD.wapt