[RESOLVED] DSN-CTL Packet

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

June 25, 2024 - 4:37 PM

Hello, for those who might need to install the DSN-CTL software in their accounting department, I've created a package that works for me.
"DSN-CTL The DSN-CTL control tool is offered for free use to small declarants, but is subject to a specific license and annual usage fee in other cases (companies with more than 20 employees or multiple establishments, third-party declarants, software publishers, etc.)."
https://dsn-ctl.fr/

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
 # Détection du nom de l'exécutable à la racine du paquet
binary_name = glob.glob("DSN*.EXE")[0]
 # Détection du nom de l'application en supprimant le .exe à la fin de la chaine, exemple 'DSN-CTL-V24R01'
app_name = binary_name.split(".exe")[0] 
parts = app_name.split("-")
soft_name = "-".join(parts[:2]) # utile pour rechercher les versions installées
# répertoire d'installation
app_dir = makepath(programfiles32, app_name)
# répertoire de l'exécutable
app_dir_binaries = app_dir

def install():
    #  Uninstalling existing versions
    print(r'Suppression de toutes les versions installées de %s' %soft_name)
    for soft in installed_softwares(soft_name): 
        old_version = soft['key']
        print(r'Désinstallation de %s' %old_version)
        run(WAPT.uninstall_cmd(soft['key']))

    # Installing the software
    print(r"Installation de %s" %binary_name)
    install_exe_if_needed(binary_name,
        silentflags='/VERYSILENT /SUPPRESSMSGBOXES /NORESTART',
        key='%s_is1' %app_name,
        min_version=control.get_software_version()
    )
    # Create shortcut on public desktop
    create_desktop_shortcut(app_name, target=makepath(app_dir_binaries,binary_name))

def uninstall():
    print(r'Suppression des raccourcis %s sur le bureau Public' %app_name)
    for filename in glob.glob(makepath(r"%s\%s*" %(common_desktop(),soft_name))):
        print(r'Suppression de %s' %filename)
        os.remove(filename)

def audit():
    if isfile(makepath(app_dir_binaries,binary_name)):
        return("OK")
    else:
        return("Erreur : %s est introuvable !" %binary_name)
            
def update_package():
    """ You can do a CTRL F9 in pyscripter to update the package """
    import re,requests,glob

    url = 'https://dsn-ctl.fr/%s.exe' %app_name
    filename = '%s.exe' %app_name

    if not isfile(filename):
        print(r'Downloading  %s from %s'%(filename,url))
        wget(url,filename)

    exes = glob.glob('*.exe')
    for fn in exes:
        if fn != filename:
            remove_file(fn)

    # updates control version from filename, increment package version.
    control = PackageEntry().load_control_from_wapt ('.')
    version_dsn =  get_version_from_binary(filename)
    # Changing version of the package
    control.version = "%s-%s" % (version_dsn, int(control.version.split("-")[-1]) + 1)
    control.save_control_to_wapt()
    print("Changing package version to: %s in WAPT\\control" % control.version)

    if __name__ == '__main__':
      update_package()
       
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

July 4, 2024 - 3:17 PM

Hi Gaël,

Amel has taken care of the package. It's now available in the store. Thanks for the contribution. :-)

I'm marking the topic as resolved.

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked