Page 1 of 1

[RESOLVED] Webots packet sharing

Published: April 14, 2025 - 5:05 PM
by olaplanche
Good morning,

I'm sharing my package for the webots software, for which I've pushed the initial software configuration a bit further than the tis package (French language, no telemetry and disable auto update) ;)

Code: Select all

# -*- 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: Webots packet sharing

Published: April 17, 2025 - 3:34 PM
by dcardon
Hi Olivier,

Ingrid has taken care of the package; it's in wapt-testing [1] and should be available on the store soon. Thanks for sharing. :-)

I'm marking the topic as resolved.

Best regards,

Denis

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