Hello,
a Wapt Enterprise
version of Wapt 2.4.14.143,
server = Debian, and
package creation PC = Windows 10.
I would like to know if it's possible to remove a package from its dependencies within a Python script?
For example:
A = condition,
B = package name,
C = hostname.
If condition A is true, then
remove B from C.
I've searched using wapt-get, but I haven't found anything.
Thank you in advance for your help.
[SOLVED] Removing a dependency in Python
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
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
- sfonteneau
- WAPT Expert
- Messages: 2318
- Registered: July 10, 2014 - 11:52 PM
- Contact :
Hello Benoit,
The best approach in this kind of situation is to create a meta-package and avoid dependencies, and in that case, you're free to do whatever you want
example :
Simon
The best approach in this kind of situation is to create a meta-package and avoid dependencies, and in that case, you're free to do whatever you want
example :
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
def install():
hostname = get_computername().lower()
# Si les 4 dernier caractères du poste sont "prof" alors j'installe Firefox ESR
if hostname.endswith('prof') :
WAPT.install('tis-firefox-esr')
if 'eleves' in hostname :
if WAPT.is_installed('tis-gestionnote') :
WAPT.remove('tis-gestionnote')
if installed_softwares('Mozilla Firefox') :
WAPT.install('tis-firefox-esr')
# Si la manufacture du poste est 'innotek GmbH', installer le paquet drivers smp-drivers-for-innotek
if wmi_info_basic()["System_Information"]["Manufacturer"] == 'innotek GmbH' :
WAPT.install('tis-drivers-for-innotek')
unitorga = registry_readstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine', 'Distinguished-Name')
if 'OU=Ordinateur_compta,OU=Ordinateur_administratif,DC=tranquilit,DC=local' in unitorga :
WAPT.install('tis-libreoffice-stable')
if 'mongroup' in get_computer_groups():
WAPT.install('tis-group')
Thank you for your reply, but that's not what I'm trying to do:
Here is the setup I'm posing for here:
I would like that if "pro" is true, then this package should be removed from the dependencies of the PC for which pro is true.
Here is the setup I'm posing for here:
Code: Select all
# -*- coding: utf-8 -*-
"""
Script type pour installation d'un exécutable
"""
"""
import module
"""
from setuphelpers import *
import subprocess
"""
déclarations variables
"""
# Indiquez le nom d'affichage du programme
name_app ="Adobe Acrobat"
# Indiquez le nom de l'executable servant à installer le programme
exe = "AcroRdrDCx642300820470_MUI.exe"
# Indiquez le Version du programme
min_version="2023.008.20470"
#varibles pour la mise en place du raccourci si besoin
label= ""
target = r""
silentflags =f'/sAll /rs /msi EULA_ACCEPT=YES '
#uninstall_cmd ="MsiExec.exe /x {AC76BA86-1033-FF00-7760-BC15014EA700} /quiet"
"""
déclaration fonctions
"""
# fonction qui permet d'installer l'application
def install_app():
try :
print(f"L'installation de {name_app} est en cours ...")
install_exe_if_needed(exe,silentflags=silentflags,key='',min_version=min_version)
print(f"L'application {name_app} a été installée avec succès")
# commenté les deux lignes ci-dessous avec un '#' si vous n'avez pas besoin de créer un raccourci
#create_desktop_shortcut(label,target)
#print(f"Le raccourci {label} a été créer avec succès")
except Exception as e :
print(f"L'erreur 1 suivante s'est produite : {e}")
# fonction qui permet de désinstaller l'application
def uninstall():
try:
for soft in installed_softwares():
if name_app in soft['name']:
if soft['name'] != "Adobe Acrobat 2017" and soft['name'] != "Adobe Acrobat 2020":
key= soft['key']
uninstall_cmd = f"msiexec /x {key} /quiet"
print(f"L'application {name_app} est déjà installée. Elle va être désinstallée.\nMerci de patienter ...")
subprocess.run(uninstall_cmd)
print(f"L'application {name_app} a été désinstallée avec succès")
# commenté les deux lignes ci-dessous avec un '#' si vous n'avez pas besoin de supprimer un raccourci
#remove_desktop_shortcut(label)
#print(f"Le raccourci {label} a été supprimé avec succès")
break
except Exception as e :
print(f"L'erreur 2 suivante s'est produite : {e}")
"""
main code
"""
def install():
try:
pro = False
for soft in installed_softwares():
if soft['name'] == "Adobe Acrobat 2017" or soft['name'] == "Adobe Acrobat 2020" or soft['name'] == "Adobe Creative Cloud":
print(f"Une version pro de l'application {name_app} est déjà installée.\nCette version ne sera donc pas déployé sur ce poste")
pro =True
break
if not pro:
uninstall()
install_app()
except Exception as e :
print(f"L'erreur 3 suivante s'est produite : {e}")
- sfonteneau
- WAPT Expert
- Messages: 2318
- Registered: July 10, 2014 - 11:52 PM
- Contact :
Hello Benoit,
Impossible, the dependency is at the package level, so it will come back...
You need to create a meta package for Adobe Reader:
tis-adboe-reader
and in the package something like this:
Simon
Impossible, the dependency is at the package level, so it will come back...
You need to create a meta package for Adobe Reader:
tis-adboe-reader
and in the package something like this:
Code: Select all
def install():
if installed_software('adobe reader pro'):
WAPT.install('tis-adboe-reader-pro')
else
WAPT.install('tis-adboe-reader-normal')
- sfonteneau
- WAPT Expert
- Messages: 2318
- Registered: July 10, 2014 - 11:52 PM
- Contact :
Hi Benoit,
No, the PC can't edit the packages (remove a dependency) because it doesn't have your private key.
Simon
No, the PC can't edit the packages (remove a dependency) because it doesn't have your private key.
Simon
