--- a/PipxInterface/Pipx.py Thu Jun 27 16:20:56 2024 +0200 +++ b/PipxInterface/Pipx.py Thu Jun 27 17:50:51 2024 +0200 @@ -206,7 +206,7 @@ systemSitePackages=False ): """ - Public method + Public method to install a list of packages with the given options. @param packages list of packages to install @type list of str @@ -229,8 +229,8 @@ args += ["--index-url", indexUrl] if interpreterVersion: args += ["--python", interpreterVersion] - if fetchMissingInterpreter: - args.append("--fetch-missing-python") + if fetchMissingInterpreter: + args.append("--fetch-missing-python") if forceVenvModification: args.append("--force") if systemSitePackages: @@ -250,7 +250,8 @@ systemSitePackages=False ): """ - Public method + Public method to install all packages define by a given spec metadata file + with given options. @param specFile path of the spec metadata file @type str @@ -273,8 +274,8 @@ args += ["--index-url", indexUrl] if interpreterVersion: args += ["--python", interpreterVersion] - if fetchMissingInterpreter: - args.append("--fetch-missing-python") + if fetchMissingInterpreter: + args.append("--fetch-missing-python") if forceVenvModification: args.append("--force") if systemSitePackages: @@ -306,6 +307,68 @@ else: return False, output + def reinstallPackage( + self, + package, + interpreterVersion="", + fetchMissingInterpreter=False, + ): + """ + Public method to reinstall the given package with given options + + @param package name of the package to reinstall + @type str + @param interpreterVersion version of the Python interpreter (defaults to "") + @type str (optional) + @param fetchMissingInterpreter flag indicating to fetch a standalone Python + build from GitHub if the specified Python version is not found locally + on the system (defaults to False) + @type bool (optional) + """ + args = ["reinstall"] + if interpreterVersion: + args += ["--python", interpreterVersion] + if fetchMissingInterpreter: + args.append("--fetch-missing-python") + args.append(package) + dia = PipxExecDialog(self.tr("Re-Install Package")) + res = dia.startProcess(self.__getPipxExecutable(), args) + if res: + dia.exec() + + def reinstallAllPackages( + self, + interpreterVersion="", + fetchMissingInterpreter=False, + skipPackages=None, + ): + """ + Public method to reinstall all packages with given options + + @param package name of the package to reinstall + @type str + @param interpreterVersion version of the Python interpreter (defaults to "") + @type str (optional) + @param fetchMissingInterpreter flag indicating to fetch a standalone Python + build from GitHub if the specified Python version is not found locally + on the system (defaults to False) + @type bool (optional) + @param skipPackages list of packages to be skipped by the 'reinstall-all' + command (defaults to None) + @type list of str (optional) + """ + args = ["reinstall-all"] + if interpreterVersion: + args += ["--python", interpreterVersion] + if fetchMissingInterpreter: + args.append("--fetch-missing-python") + if skipPackages: + args += ["--skip"] + skipPackages + dia = PipxExecDialog(self.tr("Re-Install All Packages")) + res = dia.startProcess(self.__getPipxExecutable(), args) + if res: + dia.exec() + def uninstallPackage(self, package): """ Public method to uninstall the given package.