PipxInterface/Pipx.py

Sun, 15 Sep 2024 15:48:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 15 Sep 2024 15:48:45 +0200
changeset 80
f59f1bcc4c6f
parent 78
5efcdee9c170
child 81
b6280afecc83
permissions
-rw-r--r--

Added a "backward compatibility" comment.

2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de>
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the pipx GUI logic.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import contextlib
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
11 import functools
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 import json
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 import os
10
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
14 import pathlib
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import sysconfig
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
17 from PyQt6.QtCore import QObject, QProcess, pyqtSignal
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from eric7 import Preferences
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
20 from eric7.EricWidgets import EricMessageBox
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 from eric7.SystemUtilities import OSUtilities
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
23 try:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
24 from eric7.EricCore.EricProcess import EricProcess
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
25 except ImportError:
80
f59f1bcc4c6f Added a "backward compatibility" comment.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 78
diff changeset
26 # backward compatibility for eric-ide < 24.10
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
27 from .PipxProcess import PipxProcess as EricProcess
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
28
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
29 from .PipxExecDialog import PipxExecDialog
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
30
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 class Pipx(QObject):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
34 Class implementing the pipx interface.
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
35
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
36 @signal outdatedPackage(package:str, latestVer:str, oudatedDeps:bool) emitted with
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
37 the result of a check for outdated status of a package
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
40 outdatedPackage = pyqtSignal(str, str, bool)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
41
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 def __init__(self, parent=None):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 Constructor
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 @param parent reference to the user interface object
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @type QObject
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 super().__init__(parent)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.__ui = parent
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
53 self.__pipxProcesses = []
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
54
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 ############################################################################
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 ## Utility methods
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 ############################################################################
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 def getPipxVersion(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 Public method to get the version of the installed pipx package.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 @return string containing the pipx version number
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 @rtype str
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
66 ok, output = self.__runPipxProcess(["--version"])
59
a5e7feb2310c Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
67 if ok:
a5e7feb2310c Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
68 return output.strip()
a5e7feb2310c Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
69 else:
a5e7feb2310c Fixed a few issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 49
diff changeset
70 return ""
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 def getPipxVersionTuple(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 Public method to get the version tuple of the installed pipx package.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 @return tuple containing the elements of the pipx version number
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 @rtype tuple of (int, int, int)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
79 from pipx.version import version_tuple # noqa: I102
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 return version_tuple
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 def getPipxPaths(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 Public method to get the paths used by pipx.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 @return dictionary containing the various pipx paths. The keys are
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 'venvsPath', 'appsPath' and 'manPath'.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 @rtype dict[str, Path]
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
91 from pipx.paths import ctx # noqa: I102
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 return {
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 "venvsPath": ctx.venvs,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 "appsPath": ctx.bin_dir,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 "manPath": ctx.man_dir,
8
02b45cd11e64 Added the display of the path standalone Python interpreters are installed to.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
97 "pythonPath": ctx.standalone_python_cachedir,
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 }
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 def getPipxStrPaths(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 Public method to get the paths used by pipx.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 @return dictionary containing the various pipx paths. The keys are
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 'venvsPath', 'appsPath' and 'manPath'.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 @rtype dict[str, str]
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
108 from pipx.paths import ctx # noqa: I102
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 return {
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 "venvsPath": str(ctx.venvs),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 "appsPath": str(ctx.bin_dir),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 "manPath": str(ctx.man_dir),
8
02b45cd11e64 Added the display of the path standalone Python interpreters are installed to.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
114 "pythonPath": str(ctx.standalone_python_cachedir),
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 }
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 def __getPipxExecutable(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 Private method to get the path name of the pipx executable.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 @return path name of the pipx executable
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 @rtype str
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 binDir = sysconfig.get_path("scripts")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 pipx = os.path.join(binDir, "pipx")
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
126 if OSUtilities.isWindowsPlatform():
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 pipx += ".exe"
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 return pipx
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
131 def __runPipxProcess(self, args):
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 """
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
133 Private method to execute pipx with the given arguments.
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 @param args list of command line arguments for pipx
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 @type list of str
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 @return tuple containing a flag indicating success and the output
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 of the process
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 @rtype tuple of (bool, str)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 ioEncoding = Preferences.getSystem("IOEncoding")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 process = QProcess()
10
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
144 process.start(self.__getPipxExecutable(), args)
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 procStarted = process.waitForStarted()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 if procStarted:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 finished = process.waitForFinished(30000)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 if finished:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 if process.exitCode() == 0:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 output = str(process.readAllStandardOutput(), ioEncoding, "replace")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 return True, output
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 else:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 error = str(process.readAllStandardError(), ioEncoding, "replace")
19
70b187d5a9df Created translations and did the German translation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
154 msg = self.tr("<p>Message: {0}</p>").format(error) if error else ""
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 return (
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 False,
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.tr("<p>pipx exited with an error ({0}).</p>{1}").format(
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 process.exitCode(), msg
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 ),
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 )
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 else:
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 process.terminate()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 process.waitForFinished(2000)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 process.kill()
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 process.waitForFinished(3000)
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 return False, self.tr("pipx did not finish within 30 seconds.")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 return False, self.tr("pipx could not be started.")
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169
10
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
170 def __metadataDecoderHook(self, jsonDict):
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
171 """
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
172 Private method to allow the JSON decoding of Path objects of a spec metadata
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
173 file as created by 'pipx list --json'.
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
174
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
175 @param jsonDict JSON dictionary to be decoded
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
176 @type dict
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
177 @return decoded Path object or the dictionary unaltered
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
178 @rtype dict or pathlib.Path
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
179 """
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
180 if jsonDict.get("__type__") == "Path" and "__Path__" in jsonDict:
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
181 return pathlib.Path(jsonDict["__Path__"])
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
182 return jsonDict
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
183
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
184 def __runPipxAsyncProcess(self, args, callback=None, timeout=30000):
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
185 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
186 Private method to execute pipx with the given arguments asynchronously.
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
187
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
188 @param args list of command line arguments for pipx
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
189 @type list of str
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
190 @param callback reference to the function to be called a success flag and the
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
191 process output or error message (defaults to None)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
192 @type function (optional)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
193 @param timeout timeout for the process in milliseconds (defaults to 30000)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
194 @type int (optional)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
195 @return reference to the generated process object
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
196 @rtype QProcess
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
197 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
198 process = EricProcess(timeout=timeout)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
199 process.finished.connect(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
200 functools.partial(self.__asyncProcessFinished, callback, process)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
201 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
202 process.errorOccurred.connect(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
203 functools.partial(self.__asyncProcessError, process)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
204 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
205 self.__pipxProcesses.append(process)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
206 process.start(self.__getPipxExecutable(), args)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
207 return process
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
208
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
209 def __asyncProcessError(self, process, error):
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
210 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
211 Private method to handle a process error signal.
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
212
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
213 @param process reference to the process
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
214 @type QProcess
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
215 @param error error that occurred
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
216 @type QProcess.ProcessError
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
217 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
218 if error == QProcess.ProcessError.FailedToStart:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
219 with contextlib.suppress(ValueError):
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
220 self.__pipxProcesses.remove(process)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
221 EricMessageBox.critical(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
222 None, self.tr("pipx Start Error"), self.tr("pipx could not be started.")
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
223 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
224 else:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
225 EricMessageBox.critical(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
226 None,
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
227 self.tr("pipx Runtime Error"),
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
228 self.tr(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
229 "<p>The pipx process reported an error.</p><p>Error: {0}</p>"
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
230 ).format(process.errorString()),
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
231 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
232
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
233 def __asyncProcessFinished(self, callback, process, _exitCode, exitStatus):
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
234 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
235 Private method to handle the process finished signal.
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
236
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
237 @param callback reference to the function to be called a success flag and the
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
238 process output or error message
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
239 @type function
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
240 @param process reference to the process
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
241 @type QProcess
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
242 @param _exitCode exit code of the process
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
243 @type int
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
244 @param exitStatus exit status of the process
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
245 @type QProcess.ExitStatus
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
246 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
247 if process.timedOut():
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
248 msg = self.tr("pipx did not finish within {0} seconds.").format(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
249 process.timeoutInterval() // 1_000
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
250 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
251 if callback:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
252 callback(False, msg)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
253 else:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
254 EricMessageBox.critical(None, self.tr("pipx Timeout Error"), msg)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
255
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
256 elif exitStatus == QProcess.ExitStatus.NormalExit:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
257 ioEncoding = Preferences.getSystem("IOEncoding")
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
258 if process.exitCode() == 0:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
259 output = str(process.readAllStandardOutput(), ioEncoding, "replace")
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
260 if callback:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
261 callback(True, output)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
262 else:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
263 error = str(process.readAllStandardError(), ioEncoding, "replace")
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
264 msg = self.tr("<p>Message: {0}</p>").format(error) if error else ""
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
265 if callback:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
266 callback(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
267 False,
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
268 self.tr("<p>pipx exited with an error ({0}).</p>{1}").format(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
269 process.exitCode(), msg
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
270 ),
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
271 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
272 else:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
273 EricMessageBox.critical(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
274 None,
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
275 self.tr("pipx Execution Error"),
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
276 self.tr("<p>pipx exited with an error ({0}).</p>{1}").format(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
277 process.exitCode(), msg
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
278 ),
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
279 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
280
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
281 with contextlib.suppress(ValueError):
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
282 self.__pipxProcesses.remove(process)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
283
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 ############################################################################
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
285 ## pipx interpreter list function (modified from original to work here)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
286 ############################################################################
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
287
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
288 def getPipxInterpretersList(self):
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
289 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
290 Public method returning a list all standalone interpreters.
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
291
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
292 @return dictionary containing data of standalone interpreters
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
293 @rtype dict
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
294 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
295 from pipx.commands.interpreter import ( # noqa: I102
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
296 get_installed_standalone_interpreters,
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
297 get_interpreter_users,
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
298 get_venvs_using_standalone_interpreter,
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
299 )
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
300 from pipx.paths import ctx # noqa: I102
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
301 from pipx.venv import VenvContainer # noqa: I102
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
302
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
303 interpreters = get_installed_standalone_interpreters()
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
304 venvs = get_venvs_using_standalone_interpreter(VenvContainer(ctx.venvs))
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
305
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
306 interpretersDict = {
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
307 "path": str(ctx.standalone_python_cachedir),
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
308 "interpreters": {},
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
309 }
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
310 for interpreter in interpreters:
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
311 usedBy = get_interpreter_users(interpreter, venvs)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
312 interpretersDict["interpreters"][interpreter.name] = {
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
313 "used": bool(usedBy),
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
314 "used_by": [
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
315 (p.main_package.package, p.main_package.package_version)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
316 for p in usedBy
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
317 ],
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
318 }
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
319 return interpretersDict
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
320
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
321 ############################################################################
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 ## Command methods
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 ############################################################################
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 def getInstalledPackages(self):
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 """
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 Public method to get the installed packages.
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 @return list of dictionaries containing the installed packages and apps
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 @rtype list of dict[str, str | list]
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
332 from pipx.paths import ctx # noqa: I102
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
333
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 packages = []
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
336 ok, output = self.__runPipxProcess(["list", "--json"])
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
337 if ok and output:
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
338 with contextlib.suppress(json.JSONDecodeError):
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
339 data = json.loads(output, object_hook=self.__metadataDecoderHook)
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
340 for venvName in data["venvs"]:
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
341 metadata = data["venvs"][venvName]["metadata"]
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
342 package = {
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
343 "name": venvName,
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
344 "version": metadata["main_package"]["package_version"],
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
345 "apps": [],
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
346 "python": metadata["python_version"],
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
347 "is_standalone": (
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
348 str(metadata["source_interpreter"]).startswith(
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
349 str(ctx.standalone_python_cachedir.resolve())
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
350 )
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
351 if metadata["source_interpreter"]
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
352 else False
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
353 ),
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
354 }
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
355 for appPath in metadata["main_package"]["app_paths"]:
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
356 package["apps"].append((appPath.name, str(appPath)))
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
357 packages.append(package)
2
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358
26430067aa09 Added the main pipx interface widget and the pipx commands interface (basic variant each).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 return packages
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
360
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
361 def installPackages(
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
362 self,
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
363 packages,
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
364 interpreterVersion="",
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
365 fetchMissingInterpreter=False,
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
366 forceVenvModification=False,
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
367 systemSitePackages=False,
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
368 ):
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
369 """
12
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
370 Public method to install a list of packages with the given options.
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
371
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
372 @param packages list of packages to install
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
373 @type list of str
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
374 @param interpreterVersion version of the Python interpreter (defaults to "")
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
375 @type str (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
376 @param fetchMissingInterpreter flag indicating to fetch a standalone Python
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
377 build from GitHub if the specified Python version is not found locally
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
378 on the system (defaults to False)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
379 @type bool (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
380 @param forceVenvModification flag indicating to allow modification of already
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
381 existing virtual environments (defaults to False)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
382 @type bool (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
383 @param systemSitePackages flag indicating to give access to the system
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
384 site-packages directory (defaults to False)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
385 @type bool (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
386 """
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
387 args = ["install"]
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
388 if Preferences.getPip("PipSearchIndex"):
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
389 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
390 args += ["--index-url", indexUrl]
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
391 if interpreterVersion:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
392 args += ["--python", interpreterVersion]
12
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
393 if fetchMissingInterpreter:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
394 args.append("--fetch-missing-python")
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
395 if forceVenvModification:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
396 args.append("--force")
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
397 if systemSitePackages:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
398 args.append("--system-site-packages")
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
399 args += packages
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
400 dia = PipxExecDialog(self.tr("Install Packages"))
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
401 res = dia.startProcess(self.__getPipxExecutable(), args)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
402 if res:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
403 dia.exec()
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
404
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
405 def installAllPackages(
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
406 self,
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
407 specFile,
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
408 interpreterVersion="",
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
409 fetchMissingInterpreter=False,
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
410 forceVenvModification=False,
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
411 systemSitePackages=False,
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
412 ):
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
413 """
12
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
414 Public method to install all packages define by a given spec metadata file
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
415 with given options.
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
416
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
417 @param specFile path of the spec metadata file
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
418 @type str
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
419 @param interpreterVersion version of the Python interpreter (defaults to "")
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
420 @type str (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
421 @param fetchMissingInterpreter flag indicating to fetch a standalone Python
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
422 build from GitHub if the specified Python version is not found locally
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
423 on the system (defaults to False)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
424 @type bool (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
425 @param forceVenvModification flag indicating to allow modification of already
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
426 existing virtual environments (defaults to False)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
427 @type bool (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
428 @param systemSitePackages flag indicating to give access to the system
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
429 site-packages directory (defaults to False)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
430 @type bool (optional)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
431 """
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
432 args = ["install-all"]
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
433 if Preferences.getPip("PipSearchIndex"):
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
434 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
435 args += ["--index-url", indexUrl]
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
436 if interpreterVersion:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
437 args += ["--python", interpreterVersion]
12
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
438 if fetchMissingInterpreter:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
439 args.append("--fetch-missing-python")
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
440 if forceVenvModification:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
441 args.append("--force")
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
442 if systemSitePackages:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
443 args.append("--system-site-packages")
10
89e0e6e5ca7a Added functionality to create a spec metadata file and to use it for the 'install-all' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
444 args.append(specFile)
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
445 dia = PipxExecDialog(self.tr("Install All Packages"))
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
446 res = dia.startProcess(self.__getPipxExecutable(), args)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
447 if res:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
448 dia.exec()
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
449
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
450 def createSpecMetadataFile(self, specFile):
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
451 """
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
452 Public method to create a spec metadata file.
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
453
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
454 @param specFile path of the spec metadata file
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
455 @type str
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
456 @return tuple containing a flag indicating success and an error message in case
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
457 of failure
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
458 @rtype tuple of (bool, str)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
459 """
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
460 ok, output = self.__runPipxProcess(["list", "--json"])
9
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
461 if ok:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
462 try:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
463 with open(specFile, "w") as f:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
464 f.write(output)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
465 return True, ""
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
466 except IOError as err:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
467 return False, str(err)
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
468 else:
2ab7d3ac8283 Implemented the 'pipx install' and 'pipx install-all' functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8
diff changeset
469 return False, output
11
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
470
12
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
471 def reinstallPackage(
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
472 self,
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
473 package,
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
474 interpreterVersion="",
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
475 fetchMissingInterpreter=False,
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
476 ):
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
477 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
478 Public method to reinstall the given package with given options.
12
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
479
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
480 @param package name of the package to reinstall
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
481 @type str
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
482 @param interpreterVersion version of the Python interpreter (defaults to "")
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
483 @type str (optional)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
484 @param fetchMissingInterpreter flag indicating to fetch a standalone Python
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
485 build from GitHub if the specified Python version is not found locally
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
486 on the system (defaults to False)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
487 @type bool (optional)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
488 """
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
489 args = ["reinstall"]
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
490 if interpreterVersion:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
491 args += ["--python", interpreterVersion]
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
492 if fetchMissingInterpreter:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
493 args.append("--fetch-missing-python")
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
494 args.append(package)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
495 dia = PipxExecDialog(self.tr("Re-Install Package"))
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
496 res = dia.startProcess(self.__getPipxExecutable(), args)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
497 if res:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
498 dia.exec()
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
499
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
500 def reinstallAllPackages(
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
501 self,
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
502 interpreterVersion="",
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
503 fetchMissingInterpreter=False,
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
504 skipPackages=None,
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
505 ):
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
506 """
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
507 Public method to reinstall all packages with given options.
12
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
508
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
509 @param interpreterVersion version of the Python interpreter (defaults to "")
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
510 @type str (optional)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
511 @param fetchMissingInterpreter flag indicating to fetch a standalone Python
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
512 build from GitHub if the specified Python version is not found locally
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
513 on the system (defaults to False)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
514 @type bool (optional)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
515 @param skipPackages list of packages to be skipped by the 'reinstall-all'
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
516 command (defaults to None)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
517 @type list of str (optional)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
518 """
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
519 args = ["reinstall-all"]
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
520 if interpreterVersion:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
521 args += ["--python", interpreterVersion]
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
522 if fetchMissingInterpreter:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
523 args.append("--fetch-missing-python")
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
524 if skipPackages:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
525 args += ["--skip"] + skipPackages
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
526 dia = PipxExecDialog(self.tr("Re-Install All Packages"))
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
527 res = dia.startProcess(self.__getPipxExecutable(), args)
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
528 if res:
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
529 dia.exec()
a09f763d5e1f Added functionality to reinstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11
diff changeset
530
11
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
531 def uninstallPackage(self, package):
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
532 """
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
533 Public method to uninstall the given package.
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
534
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
535 @param package name of the package to be uninstalled
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
536 @type str
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
537 """
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
538 args = ["uninstall", package]
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
539 dia = PipxExecDialog(self.tr("Uninstall Package"))
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
540 res = dia.startProcess(self.__getPipxExecutable(), args)
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
541 if res:
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
542 dia.exec()
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
543
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
544 def uninstallAllPackages(self):
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
545 """
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
546 Public method to uninstall all pipx managed packages.
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
547 """
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
548 args = ["uninstall-all"]
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
549 dia = PipxExecDialog(self.tr("Uninstall All Packages"))
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
550 res = dia.startProcess(self.__getPipxExecutable(), args)
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
551 if res:
6af0704c8175 Added functionality to uninstall single or all pipx managed packages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
552 dia.exec()
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
553
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
554 def upgradePackage(self, package):
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
555 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
556 Public method to upgrade the given package.
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
557
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
558 @param package name of the package
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
559 @type str
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
560 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
561 args = ["upgrade"]
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
562 if Preferences.getPip("PipSearchIndex"):
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
563 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
564 args += ["--index-url", indexUrl]
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
565 args.append(package)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
566 dia = PipxExecDialog(self.tr("Upgrade Package"))
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
567 res = dia.startProcess(self.__getPipxExecutable(), args)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
568 if res:
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
569 dia.exec()
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
570
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
571 def upgradeAllPackages(self):
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
572 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
573 Public method to upgrade all package.
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
574 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
575 args = ["upgrade-all"]
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
576 dia = PipxExecDialog(self.tr("Upgrade All Packages"))
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
577 res = dia.startProcess(self.__getPipxExecutable(), args)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
578 if res:
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
579 dia.exec()
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
580
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
581 def upgradeSharedLibraries(self):
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
582 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
583 Public method to upgrade shared libraries.
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
584 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
585 args = ["upgrade-shared"]
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
586 dia = PipxExecDialog(self.tr("Upgrade Shared Libraries"))
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
587 res = dia.startProcess(self.__getPipxExecutable(), args)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
588 if res:
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
589 dia.exec()
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
590
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
591 def upgradeInterpreters(self, dialogParent=None):
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
592 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
593 Public method to upgrade the installed interpreters to the latest available
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
594 micro/patch version.
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
595
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
596 @param dialogParent parent widget of the execution dialog
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
597 @type QWidget
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
598 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
599 args = ["interpreter", "upgrade"]
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
600 dia = PipxExecDialog(self.tr("Upgrade Interpreters"), parent=dialogParent)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
601 res = dia.startProcess(self.__getPipxExecutable(), args)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
602 if res:
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
603 dia.exec()
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
604
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
605 def pruneInterpreters(self, dialogParent=None):
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
606 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
607 Public method to prune unused interpreters.
15
2fb8d19c38ae Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 14
diff changeset
608
14
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
609 @param dialogParent parent widget of the execution dialog
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
610 @type QWidget
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
611 """
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
612 args = ["interpreter", "prune"]
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
613 dia = PipxExecDialog(self.tr("Prune Unused Interpreters"), parent=dialogParent)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
614 res = dia.startProcess(self.__getPipxExecutable(), args)
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
615 if res:
12413552ae0d Added functionality to upgrade single or all pipx managed packages and to manage the standalone interpreters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
616 dia.exec()
23
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
617
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
618 def ensurePath(self):
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
619 """
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
620 Public method to ensure that the directory where pipx stores apps is
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
621 in your PATH environment variable.
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
622 """
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
623 args = ["ensurepath"]
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
624 dia = PipxExecDialog(self.tr("Ensure PATH Modifications"))
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
625 res = dia.startProcess(self.__getPipxExecutable(), args)
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
626 if res:
4c18addf12b2 Added an interface to the `pipx ensurepath` command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
627 dia.exec()
49
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
628
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
629 ############################################################################
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
630 ## Special methods based on 'runpip'
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
631 ############################################################################
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
632
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
633 def checkPackageOutdated(self, package):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
634 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
635 Public method to check, if a given package is outdated.
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
636
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
637 @param package name of the package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
638 @type str
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
639 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
640 args = ["runpip", package, "list", "--outdated", "--format", "json"]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
641 if Preferences.getPip("PipSearchIndex"):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
642 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
643 args += ["--index-url", indexUrl]
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
644 self.__runPipxAsyncProcess(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
645 args, callback=functools.partial(self.__checkPackageOutdatedCb, package)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
646 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
647
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
648 def __checkPackageOutdatedCb(self, package, ok, output):
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
649 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
650 Private method handling the pipx process output of a check for an outdated
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
651 package.
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
652
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
653 @param package name of the package
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
654 @type str
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
655 @param ok flag indicating the process ended successfully
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
656 @type bool
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
657 @param output output of the pipx process or an error message
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
658 @type str
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
659 """
49
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
660 if not ok:
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
661 EricMessageBox.information(
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
662 None,
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
663 self.tr("Check Outdated Package"),
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
664 self.tr(
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
665 "<p>The status of package <b>{0}</b> could not be determined.</p>"
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
666 "<p>Reason: {1}</p>"
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
667 ).format(package, output),
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
668 )
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
669 self.outdatedPackage.emit(package, "", False)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
670 return
49
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
671
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
672 outdatedList = json.loads(output)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
673 # check if the main package is in the list
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
674 for outdatedPackage in outdatedList:
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
675 if outdatedPackage["name"] == package:
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
676 self.outdatedPackage.emit(
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
677 package, outdatedPackage["latest_version"], len(outdatedList) > 1
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
678 )
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
679 return
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
680
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
681 self.outdatedPackage.emit(package, "", bool(outdatedList))
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
682
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
683 def getPackageVersion(self, package):
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
684 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
685 Public method to get the version of a package.
49
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
686
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
687 @param package package name
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
688 @type str
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
689 @return package version
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
690 @rtype str
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
691 """
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
692 packagesList = self.__getPackageDependencies(package=package)
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
693 for pack in packagesList:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
694 if pack["name"] == package:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
695 return pack["version"]
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
696 else:
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
697 return ""
49
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
698
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
699 def __getPackageDependencies(self, package, uptodate=False, outdated=False):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
700 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
701 Private method to get a list of dependencies of a given package.
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
702
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
703 @param package name of the package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
704 @type str
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
705 @param uptodate DESCRIPTION (defaults to False)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
706 @type TYPE (optional)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
707 @param outdated DESCRIPTION (defaults to False)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
708 @type TYPE (optional)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
709 @return list of dictionaries as returned by 'pip'
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
710 @rtype list[dict[str: str]]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
711 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
712 if outdated:
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
713 args = ["runpip", package, "list", "--format", "json", "--outdated"]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
714 elif uptodate:
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
715 args = ["runpip", package, "list", "--format", "json", "--uptodate"]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
716 else:
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
717 args = ["runpip", package, "list", "--format", "json"]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
718 if Preferences.getPip("PipSearchIndex"):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
719 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
720 args += ["--index-url", indexUrl]
78
5efcdee9c170 Changed the long running "outdated" actions to use an asynchronous process with timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 59
diff changeset
721 ok, output = self.__runPipxProcess(args)
49
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
722 if not ok:
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
723 EricMessageBox.information(
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
724 None,
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
725 self.tr("Get Package Dependencies"),
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
726 self.tr(
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
727 "<p>The status of dependencies of package <b>{0}</b> could not"
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
728 " be determined.</p><p>Reason: {1}</p>"
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
729 ).format(package, output),
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
730 )
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
731 return []
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
732
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
733 return json.loads(output)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
734
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
735 def getOutdatedPackageDependencies(self, package):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
736 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
737 Public method to get the list of outdated package dependencies.
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
738
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
739 @param package name of the package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
740 @type str
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
741 @return list of tuples containing the dependency name, version and latest
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
742 version
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
743 @rtype list of tuple of (str, str, str)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
744 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
745 outdatedList = self.__getPackageDependencies(package=package, outdated=True)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
746 return [
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
747 (d["name"], d["version"], d["latest_version"])
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
748 for d in outdatedList
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
749 if d["name"] != package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
750 ]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
751
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
752 def getUptodatePackageDependencies(self, package):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
753 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
754 Public method to get the list of up-to-date package dependencies.
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
755
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
756 @param package name of the package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
757 @type str
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
758 @return list of tuples containing the dependency name and version
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
759 @rtype list of tuple of (str, str)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
760 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
761 uptodateList = self.__getPackageDependencies(package=package, uptodate=True)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
762 return [(d["name"], d["version"]) for d in uptodateList if d["name"] != package]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
763
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
764 def getAllPackageDependencies(self, package):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
765 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
766 Public method to get the list of package dependencies.
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
767
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
768 @param package name of the package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
769 @type str
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
770 @return list of tuples containing the dependency name and version
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
771 @rtype list of tuple of (str, str)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
772 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
773 dependenciesList = self.__getPackageDependencies(package=package)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
774 return [
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
775 (d["name"], d["version"]) for d in dependenciesList if d["name"] != package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
776 ]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
777
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
778 def upgradePackageDependencies(self, package):
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
779 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
780 Public method to upgrade the dependencies of the given package.
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
781
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
782 @param package name of the package
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
783 @type str
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
784 """
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
785 outdatedDependencies = [
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
786 d[0] for d in self.getOutdatedPackageDependencies(package=package)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
787 ]
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
788 args = [
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
789 "runpip",
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
790 package,
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
791 "install",
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
792 "--upgrade",
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
793 "--prefer-binary",
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
794 ] + outdatedDependencies
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
795
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
796 dia = PipxExecDialog(self.tr("Upgrade Dependencies"))
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
797 res = dia.startProcess(self.__getPipxExecutable(), args)
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
798 if res:
ec976c5b88ae Implemented actions to show the dependencies of a package and upgrade them using 'runpip' because 'pipx' doesn't upgrade them when upgrading the package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 32
diff changeset
799 dia.exec()

eric ide

mercurial