Page 1 sur 1

[RESOLU] Template setup.py

Posté : 14 mai 2024 - 10:05
par yann83
Bonjour,

Il s'agit d'un serveur WAPT entreprise 2.5.4 15342
Sur serveur Centos 7 avec des clients Windows 10 22H2

Est-il possible de modifier le setup.py par défaut ?

Voila le genre de template que j'aimerai :

Code : Tout sélectionner

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

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
import collections
import os

def count_lines(filename, maxlines=10):
    with open(filename, 'r') as file:
        lines = file.readlines()
    ilines = len(lines)
    if 0 < ilines < maxlines:
        return ilines
    elif ilines > maxlines:
        return maxlines
    else:
        return 0


def read_last_n_lines(filename, n=10):
    with open(filename, 'r') as file:
        lines = collections.deque(file, n)
    return list(lines)


# -------- A modifier --------
progName = 'Test'
setupExe = 'Setup_TEST.exe'
UninstallExePath='C:\\MESAPPLIS\\TEST\\unins000.exe'
UninstallRegKey='704E94B1-8A91-4728-B343-33B4EAC1031A_is1'
logfile = 'C:\\MESLOGS\\WAPT_Setup_TEST.LOG'
unins_logfile = 'C:\\MESLOGS\\Uninstall_TEST.LOG'


def install():
    # Declaring local variables

    # Installing the software
    print("Installing: " + progName)
    install_exe_if_needed(setupExe,
        silentflags='/VERYSILENT /LOG=' + logfile,
        key=UninstallRegKey
    )

    if os.path.exists(logfile):
        nbLines = count_lines(logfile)
        if nbLines > 0:
            for line in read_last_n_lines(logfile, nbLines):
               print(line.strip())
    else:
        print('no log found')


def uninstall():
    run(UninstallExePath + ' /VERYSILENT /LOG=' + unins_logfile)

Re: Template setup.py

Posté : 16 mai 2024 - 11:45
par sfonteneau
Bonjour

Il n'y a pas qu'un template il y en a plusieurs :

Vous pouvez modifier les template ici :
C:\Program Files (x86)\wapt\templates

Cependant a chaque upgrade de wapt ils seront écraser