About Python code
Published: September 4, 2019 - 9:30 PM
Good evening,
Upon reviewing some code examples, I am wondering about an instruction that appears in the documentation and in some packages.
Specifically in the following document https://www.wapt.fr/fr/doc/wapt-create- ... g-software
Here is the code in question:
The instruction uninstall_cmd is a function of the module setuphelpers.
This module is loaded into all files setup.py at the top of the file with the instruction
So I don't really understand the point of using WAPT.uninstall_cmd compared to a simple uninstall_cmd.
This results in the following code:
From what I understand, WAPT is an object containing methods from the setuphelpers module.
Hence the following questions:
Upon reviewing some code examples, I am wondering about an instruction that appears in the documentation and in some packages.
Specifically in the following document https://www.wapt.fr/fr/doc/wapt-create- ... g-software
Here is the code in question:
Code: Select all
for soft in installed_softwares('winscp3'):
if Version(soft['version']) < Version('5.0.2'):
run(WAPT.uninstall_cmd(soft['key']))This module is loaded into all files setup.py at the top of the file with the instruction
Code: Select all
from setuphelpers import *This results in the following code:
Code: Select all
for soft in installed_softwares('winscp3'):
if Version(soft['version']) < Version('5.0.2'):
run(uninstall_cmd(soft['key']))Hence the following questions:
- Where is this WAPT object instantiated? What is its purpose?
- Why use the uninstall_cmd of the WAPT object rather than the uninstall_cmd of the setuphelpers module?
- What is the advantage of using this method?