PipInterface/Pip.py

Thu, 21 Feb 2019 19:55:35 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 21 Feb 2019 19:55:35 +0100
branch
pypi
changeset 6795
6e2ed2aac325
parent 6793
cca6a35f3ad2
child 6798
3985c1a67fa2
permissions
-rw-r--r--

PipInterface: continued with the pip interface widget.

6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6619
diff changeset
3 # Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Package implementing the pip GUI logic.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from __future__ import unicode_literals
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 try:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 str = unicode # __IGNORE_EXCEPTION__
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 except NameError:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 pass
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import os
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import sys
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
18 import json
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
20 from PyQt5.QtCore import pyqtSlot, QObject, QProcess
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 from PyQt5.QtWidgets import QMenu, QInputDialog, QDialog
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
23 from E5Gui import E5MessageBox
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 from E5Gui.E5Action import E5Action
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 from E5Gui.E5Application import e5App
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 from .PipDialog import PipDialog
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 import Preferences
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 import Globals
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
31 ##
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
32 ##import UI.PixmapCache
6744
f5249a9927c9 Added a specific icon for the PyPI related menu and config entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
33
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 class Pip(QObject):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 Class implementing the pip GUI logic.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
39 DefaultPyPiUrl = "https://pypi.org"
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
40 DefaultIndexUrlXml = DefaultPyPiUrl + "/pypi"
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
41 DefaultIndexUrlPip = DefaultPyPiUrl + "/simple"
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
42
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
43 def __init__(self, parent=None):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 Constructor
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
47 @param parent parent
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
48 @type QObject
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 super(Pip, self).__init__(parent)
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
51 ##
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
52 ## self.__virtualenvManager = e5App().getObject("VirtualEnvManager")
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
53 ## self.__project = e5App().getObject("Project")
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
54 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
55 ## self.__menus = {} # dictionary with references to menus
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
56 ##
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
57 ## self.__plugin.currentEnvironmentChanged.connect(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
58 ## self.__handleTearOffMenu)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
60 ## def initActions(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
61 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
62 ## Public method to define the actions.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
63 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
64 ## self.actions = []
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
65 ##
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
66 ## self.selectEnvironmentAct = E5Action(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
67 ## self.tr('Virtual Environment for pip'),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
68 ## self.tr('&Virtual Environment for pip'),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
69 ## 0, 0,
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
70 ## self, 'pip_select_environment')
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
71 ## self.selectEnvironmentAct.setStatusTip(self.tr(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
72 ## 'Selects the virtual environment to be used for pip'))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
73 ## self.selectEnvironmentAct.setWhatsThis(self.tr(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
74 ## """<b>Virtual Environment for pip</b>"""
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
75 ## """<p>This selects the virtual environment to be used for pip."""
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
76 ## """</p>"""
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
77 ## ))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
78 ## self.selectEnvironmentAct.triggered.connect(self.__selectPipVirtualenv)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
79 ## self.actions.append(self.selectEnvironmentAct)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
80 ##
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
81 ## ##############################################
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
82 ## ## Actions for listing packages
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
83 ## ##############################################
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
84 ##
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
85 ## self.listPackagesAct = E5Action(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
86 ## self.tr('List Installed Packages'),
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
87 ## self.tr('&List Installed Packages...'),
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
88 ## 0, 0,
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
89 ## self, 'pip_list_packages')
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
90 ## self.listPackagesAct.setStatusTip(self.tr(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
91 ## 'List all installed packages with versions'))
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
92 ## self.listPackagesAct.setWhatsThis(self.tr(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
93 ## """<b>List Installed Packages</b>"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
94 ## """<p>This lists all the installed packages together"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
95 ## """ with their versions.</p>"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
96 ## ))
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
97 ## self.listPackagesAct.triggered.connect(self.__listPackages)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
98 ## self.actions.append(self.listPackagesAct)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
99 ##
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
100 ## self.listUptodatePackagesAct = E5Action(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
101 ## self.tr('List Up-to-date Packages'),
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
102 ## self.tr('List Up-to-&date Packages...'),
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
103 ## 0, 0,
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
104 ## self, 'pip_list_uptodate_packages')
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
105 ## self.listUptodatePackagesAct.setStatusTip(self.tr(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
106 ## 'List all installed, up-to-date packages with versions'))
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
107 ## self.listUptodatePackagesAct.setWhatsThis(self.tr(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
108 ## """<b>List Up-to-date Packages</b>"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
109 ## """<p>This lists all the installed, up-to-date packages together"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
110 ## """ with their versions.</p>"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
111 ## ))
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
112 ## self.listUptodatePackagesAct.triggered.connect(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
113 ## self.__listUptodatePackages)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
114 ## self.actions.append(self.listUptodatePackagesAct)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
115 ##
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
116 ## self.listOutdatedPackagesAct = E5Action(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
117 ## self.tr('List Outdated Packages'),
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
118 ## self.tr('List &Outdated Packages...'),
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
119 ## 0, 0,
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
120 ## self, 'pip_list_outdated_packages')
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
121 ## self.listOutdatedPackagesAct.setStatusTip(self.tr(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
122 ## 'List all installed, outdated packages with versions'))
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
123 ## self.listOutdatedPackagesAct.setWhatsThis(self.tr(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
124 ## """<b>List Up-to-date Packages</b>"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
125 ## """<p>This lists all the installed, outdated packages together"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
126 ## """ with their current and latest versions.</p>"""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
127 ## ))
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
128 ## self.listOutdatedPackagesAct.triggered.connect(
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
129 ## self.__listOutdatedPackages)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
130 ## self.actions.append(self.listOutdatedPackagesAct)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
131 ##
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
132 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
133 ## ## Actions for installing packages
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
134 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
135 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
136 ## self.installPackagesAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
137 ## self.tr('Install Packages'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
138 ## self.tr('&Install Packages'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
139 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
140 ## self, 'pip_install_packages')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
141 ## self.installPackagesAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
142 ## 'Install packages according to user input'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
143 ## self.installPackagesAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
144 ## """<b>Install Packages</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
145 ## """<p>This installs packages according to user input.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
146 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
147 ## self.installPackagesAct.triggered.connect(self.__installPackages)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
148 ## self.actions.append(self.installPackagesAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
149 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
150 ## self.installLocalPackageAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
151 ## self.tr('Install Local Package'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
152 ## self.tr('Install Local Package'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
153 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
154 ## self, 'pip_install_local_package')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
155 ## self.installLocalPackageAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
156 ## 'Install a package from local storage'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
157 ## self.installLocalPackageAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
158 ## """<b>Install Local Package</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
159 ## """<p>This installs a package available on local storage.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
160 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
161 ## self.installLocalPackageAct.triggered.connect(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
162 ## self.__installLocalPackage)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
163 ## self.actions.append(self.installLocalPackageAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
164 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
165 ## self.installRequirementsAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
166 ## self.tr('Install Requirements'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
167 ## self.tr('Install Requirements'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
168 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
169 ## self, 'pip_install_requirements')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
170 ## self.installRequirementsAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
171 ## 'Install packages according to a requirements file'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
172 ## self.installRequirementsAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
173 ## """<b>Install Requirements</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
174 ## """<p>This installs packages according to a requirements"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
175 ## """ file.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
176 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
177 ## self.installRequirementsAct.triggered.connect(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
178 ## self.__installRequirements)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
179 ## self.actions.append(self.installRequirementsAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
180 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
181 ## self.installPipAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
182 ## self.tr('Install Pip'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
183 ## self.tr('Install Pip'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
184 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
185 ## self, 'pip_install_pip')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
186 ## self.installPipAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
187 ## 'Install the pip package itself'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
188 ## self.installPipAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
189 ## """<b>Install Pip</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
190 ## """<p>This installs the pip package itself.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
191 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
192 ## self.installPipAct.triggered.connect(self.__installPip)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
193 ## self.actions.append(self.installPipAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
194 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
195 ## self.repairPipAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
196 ## self.tr('Repair Pip'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
197 ## self.tr('Repair Pip'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
198 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
199 ## self, 'pip_repair_pip')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
200 ## self.repairPipAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
201 ## 'Repair the pip package'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
202 ## self.repairPipAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
203 ## """<b>Repair Pip</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
204 ## """<p>This repairs the pip package by re-installing it.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
205 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
206 ## self.repairPipAct.triggered.connect(self.__repairPip)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
207 ## self.actions.append(self.repairPipAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
208 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
209 ## self.upgradePipAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
210 ## self.tr('Upgrade Pip'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
211 ## self.tr('Upgrade &Pip'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
212 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
213 ## self, 'pip_upgrade_pip')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
214 ## self.upgradePipAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
215 ## 'Upgrade the pip package itself'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
216 ## self.upgradePipAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
217 ## """<b>Upgrade Pip</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
218 ## """<p>This upgrades the pip package itself.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
219 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
220 ## self.upgradePipAct.triggered.connect(self.upgradePip)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
221 ## self.actions.append(self.upgradePipAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
222 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
223 ## self.upgradePackagesAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
224 ## self.tr('Upgrade Packages'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
225 ## self.tr('&Upgrade Packages'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
226 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
227 ## self, 'pip_upgrade_packages')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
228 ## self.upgradePackagesAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
229 ## 'Upgrade packages according to user input'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
230 ## self.upgradePackagesAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
231 ## """<b>Upgrade Packages</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
232 ## """<p>This upgrades packages according to user input.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
233 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
234 ## self.upgradePackagesAct.triggered.connect(self.__upgradePackages)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
235 ## self.actions.append(self.upgradePackagesAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
236 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
237 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
238 ## ## Actions for uninstalling packages
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
239 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
240 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
241 ## self.uninstallPackagesAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
242 ## self.tr('Uninstall Packages'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
243 ## self.tr('Uninstall Packages'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
244 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
245 ## self, 'pip_uninstall_packages')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
246 ## self.uninstallPackagesAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
247 ## 'Uninstall packages according to user input'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
248 ## self.uninstallPackagesAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
249 ## """<b>Uninstall Packages</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
250 ## """<p>This uninstalls packages according to user input.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
251 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
252 ## self.uninstallPackagesAct.triggered.connect(self.__uninstallPackages)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
253 ## self.actions.append(self.uninstallPackagesAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
254 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
255 ## self.uninstallRequirementsAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
256 ## self.tr('Uninstall Requirements'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
257 ## self.tr('Uninstall Requirements'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
258 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
259 ## self, 'pip_uninstall_requirements')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
260 ## self.uninstallRequirementsAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
261 ## 'Uninstall packages according to a requirements file'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
262 ## self.uninstallRequirementsAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
263 ## """<b>Uninstall Requirements</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
264 ## """<p>This uninstalls packages according to a requirements"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
265 ## """ file.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
266 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
267 ## self.uninstallRequirementsAct.triggered.connect(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
268 ## self.__uninstallRequirements)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
269 ## self.actions.append(self.uninstallRequirementsAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
270 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
271 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
272 ## ## Actions for generating requirements files
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
273 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
274 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
275 ## self.generateRequirementsAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
276 ## self.tr('Generate Requirements'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
277 ## self.tr('&Generate Requirements...'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
278 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
279 ## self, 'pip_generate_requirements')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
280 ## self.generateRequirementsAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
281 ## 'Generate the contents of a requirements file'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
282 ## self.generateRequirementsAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
283 ## """<b>Generate Requirements</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
284 ## """<p>This generates the contents of a requirements file.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
285 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
286 ## self.generateRequirementsAct.triggered.connect(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
287 ## self.__generateRequirements)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
288 ## self.actions.append(self.generateRequirementsAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
289 ##
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
290 ## ##############################################
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
291 ## ## Actions for generating requirements files
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
292 ## ##############################################
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
293 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
294 ## self.searchPyPIAct = E5Action(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
295 ## self.tr('Search PyPI'),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
296 ## self.tr('&Search PyPI...'),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
297 ## 0, 0,
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
298 ## self, 'pip_search_pypi')
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
299 ## self.searchPyPIAct.setStatusTip(self.tr(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
300 ## 'Open a dialog to search the Python Package Index'))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
301 ## self.searchPyPIAct.setWhatsThis(self.tr(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
302 ## """<b>Search PyPI</b>"""
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
303 ## """<p>This opens a dialog to search the Python Package"""
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
304 ## """ Index.</p>"""
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
305 ## ))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
306 ## self.searchPyPIAct.triggered.connect(self.__searchPyPI)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
307 ## self.actions.append(self.searchPyPIAct)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
308 ##
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
309 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
310 ## ## Actions for editing configuration files
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
311 ## ##############################################
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
312 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
313 ## self.editUserConfigAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
314 ## self.tr('Edit User Configuration'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
315 ## self.tr('Edit User Configuration...'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
316 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
317 ## self, 'pip_edit_user_config')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
318 ## self.editUserConfigAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
319 ## 'Open the per user configuration file in an editor'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
320 ## self.editUserConfigAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
321 ## """<b>Edit User Configuration</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
322 ## """<p>This opens the per user configuration file in an editor."""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
323 ## """</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
324 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
325 ## self.editUserConfigAct.triggered.connect(self.__editUserConfiguration)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
326 ## self.actions.append(self.editUserConfigAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
327 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
328 ## self.editVirtualenvConfigAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
329 ## self.tr('Edit Current Virtualenv Configuration'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
330 ## self.tr('Edit Current Virtualenv Configuration...'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
331 ## 0, 0,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
332 ## self, 'pip_edit_virtualenv_config')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
333 ## self.editVirtualenvConfigAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
334 ## 'Open the current virtualenv configuration file in an editor'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
335 ## self.editVirtualenvConfigAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
336 ## """<b>Edit Current Virtualenv Configuration</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
337 ## """<p>This opens the current virtualenv configuration file in"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
338 ## """ an editor. </p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
339 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
340 ## self.editVirtualenvConfigAct.triggered.connect(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
341 ## self.__editVirtualenvConfiguration)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
342 ## self.actions.append(self.editVirtualenvConfigAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
343 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
344 ## self.pipConfigAct = E5Action(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
345 ## self.tr('Configure'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
346 ## self.tr('Configure...'),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
347 ## 0, 0, self, 'pip_configure')
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
348 ## self.pipConfigAct.setStatusTip(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
349 ## 'Show the configuration dialog with the Python Package Management'
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
350 ## ' page selected'
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
351 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
352 ## self.pipConfigAct.setWhatsThis(self.tr(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
353 ## """<b>Configure</b>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
354 ## """<p>Show the configuration dialog with the Python Package"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
355 ## """ Management page selected.</p>"""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
356 ## ))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
357 ## self.pipConfigAct.triggered.connect(self.__pipConfigure)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
358 ## self.actions.append(self.pipConfigAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
359 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
360 ## def initMenu(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
361 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
362 ## Public slot to initialize the menu.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
363 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
364 ## @return the menu generated
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
365 ## @rtype QMenu
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
366 ## """
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
367 ## self.__menus = {} # clear menus references
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
368 ##
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
369 ## menu = QMenu()
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
370 ## menu.setTearOffEnabled(True)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
371 ## menu.setIcon(UI.PixmapCache.getIcon("pypi.png"))
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
372 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
373 ## menu.addAction(self.selectEnvironmentAct)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
374 ## menu.addSeparator()
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
375 ## menu.addAction(self.listPackagesAct)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
376 ## menu.addAction(self.listUptodatePackagesAct)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
377 ## menu.addAction(self.listOutdatedPackagesAct)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
378 ## menu.addSeparator()
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
379 ## menu.addAction(self.installPipAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
380 ## menu.addSeparator()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
381 ## menu.addAction(self.installPackagesAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
382 ## menu.addAction(self.installLocalPackageAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
383 ## menu.addAction(self.installRequirementsAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
384 ## menu.addSeparator()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
385 ## menu.addAction(self.upgradePipAct)
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
386 ## menu.addAction(self.upgradePackagesAct)
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
387 ## menu.addSeparator()
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
388 ## menu.addAction(self.uninstallPackagesAct)
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
389 ## menu.addAction(self.uninstallRequirementsAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
390 ## menu.addSeparator()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
391 ## menu.addAction(self.generateRequirementsAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
392 ## menu.addSeparator()
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
393 ## menu.addAction(self.searchPyPIAct)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
394 ## menu.addSeparator()
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
395 ## menu.addAction(self.repairPipAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
396 ## menu.addSeparator()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
397 ## menu.addAction(self.editUserConfigAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
398 ## menu.addAction(self.editVirtualenvConfigAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
399 ## menu.addSeparator()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
400 ## menu.addAction(self.pipConfigAct)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
401 ##
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
402 ## self.__menus["main"] = menu
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
403 ##
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
404 ## menu.aboutToShow.connect(self.__aboutToShowMenu)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
405 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
406 ## return menu
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
407 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
408 ## def __aboutToShowMenu(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
409 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
410 ## Private slot to set the action enabled status.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
411 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
412 ## enable = bool(Preferences.getPip("CurrentEnvironment"))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
413 ## for act in self.actions:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
414 ## if act not in [self.selectEnvironmentAct,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
415 ## self.installPipAct,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
416 ## self.editUserConfigAct,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
417 ## self.editVirtualenvConfigAct,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
418 ## self.pipConfigAct]:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
419 ## act.setEnabled(enable)
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
420 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
421 ## def getMenu(self, name):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
422 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
423 ## Public method to get a reference to the requested menu.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
424 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
425 ## @param name name of the menu
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
426 ## @type str
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
427 ## @return reference to the menu or None, if no
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
428 ## menu with the given name exists
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
429 ## @rtype QMenu or None
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
430 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
431 ## if name in self.__menus:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
432 ## return self.__menus[name]
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
433 ## else:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
434 ## return None
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
435 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
436 ## def getMenuNames(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
437 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
438 ## Public method to get the names of all menus.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
439 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
440 ## @return menu names
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
441 ## @rtype list of str
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
442 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
443 ## return list(self.__menus.keys())
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
444 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
445 ## def __handleTearOffMenu(self, venvName):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
446 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
447 ## Private slot to handle a change of the selected virtual environment.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
448 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
449 ## @param venvName logical name of the virtual environment
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
450 ## @type str
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
451 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
452 ## if self.__menus["main"].isTearOffMenuVisible():
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
453 ## # determine, if torn off menu needs to be refreshed
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
454 ## enabled = self.listPackagesAct.isEnabled()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
455 ## if ((bool(venvName) and not enabled) or
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
456 ## (not bool(venvName) and enabled)):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
457 ## self.__menus["main"].hideTearOffMenu()
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 ##########################################################################
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 ## Methods below implement some utility functions
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 ##########################################################################
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
463 def runProcess(self, args, interpreter):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 Public method to execute the current pip with the given arguments.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 The selected pip executable is called with the given arguments and
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 waited for its end.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
470 @param args list of command line arguments
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
471 @type list of str
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
472 @param interpreter path of the Python interpreter to be used
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
473 @type str
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 @return tuple containing a flag indicating success and the output
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
475 of the process
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
476 @rtype tuple of (bool, str)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 ioEncoding = Preferences.getSystem("IOEncoding")
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 process = QProcess()
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
481 process.start(interpreter, args)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 procStarted = process.waitForStarted()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 if procStarted:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 finished = process.waitForFinished(30000)
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 if finished:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 if process.exitCode() == 0:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 output = str(process.readAllStandardOutput(), ioEncoding,
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 'replace')
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 return True, output
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 else:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
491 return (False,
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
492 self.tr("python exited with an error ({0}).")
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
493 .format(process.exitCode()))
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 else:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 process.terminate()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 process.waitForFinished(2000)
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 process.kill()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 process.waitForFinished(3000)
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
499 return False, self.tr("python did not finish within"
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
500 " 30 seconds.")
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
502 return False, self.tr("python could not be started.")
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 def __getUserConfig(self):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 Private method to get the name of the user configuration file.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
508 @return path of the user configuration file
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
509 @rtype str
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 # Unix: ~/.config/pip/pip.conf
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 # OS X: ~/Library/Application Support/pip/pip.conf
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 # Windows: %APPDATA%\pip\pip.ini
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 # Environment: $PIP_CONFIG_FILE
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 try:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 return os.environ["PIP_CONFIG_FILE"]
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 except KeyError:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 pass
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 if Globals.isWindowsPlatform():
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 config = os.path.join(os.environ["APPDATA"], "pip", "pip.ini")
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 elif Globals.isMacPlatform():
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 config = os.path.expanduser(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 "~/Library/Application Support/pip/pip.conf")
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 else:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 config = os.path.expanduser("~/.config/pip/pip.conf")
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 return config
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 def __getVirtualenvConfig(self):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 Private method to get the name of the virtualenv configuration file.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
535 @return path of the virtualenv configuration file
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
536 @rtype str
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 # Unix, OS X: $VIRTUAL_ENV/pip.conf
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 # Windows: %VIRTUAL_ENV%\pip.ini
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
541 # TODO: modify to use venvName
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 if Globals.isWindowsPlatform():
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 pip = "pip.ini"
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 else:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 pip = "pip.conf"
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 try:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
547 venvDirectory = os.environ["VIRTUAL_ENV"]
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 except KeyError:
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
549 venvName = Preferences.getPip("CurrentEnvironment")
6394
17ecf4a340e7 pip: improved the determination of the default environment for editing the pip configuration file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6361
diff changeset
550 if not venvName:
17ecf4a340e7 pip: improved the determination of the default environment for editing the pip configuration file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6361
diff changeset
551 self.__selectPipVirtualenv()
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
552 venvName = Preferences.getPip("CurrentEnvironment")
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
553 venvManager = e5App().getObject("VirtualEnvManager")
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
554 if venvManager.isGlobalEnvironment(venvName):
6394
17ecf4a340e7 pip: improved the determination of the default environment for editing the pip configuration file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6361
diff changeset
555 venvDirectory = self.__getUserConfig()
17ecf4a340e7 pip: improved the determination of the default environment for editing the pip configuration file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6361
diff changeset
556 else:
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
557 venvDirectory = venvManager.getVirtualenvDirectory(venvName)
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
558
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
559 if venvDirectory:
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
560 config = os.path.join(venvDirectory, pip)
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
561 else:
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
562 config = ""
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
563
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
564 return config
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
565
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
566 ## def getDefaultEnvironmentString(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
567 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
568 ## Public method to get the string for the default environment.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
569 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
570 ## @return string for the default environment
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
571 ## @rtype str
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
572 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
573 ## return self.tr("<standard>")
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
574 ##
6619
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
575 def getProjectEnvironmentString(self):
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
576 """
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
577 Public method to get the string for the project environment.
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
578
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
579 @return string for the project environment
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
580 @rtype str
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
581 """
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
582 if e5App().getObject("Project").isOpen():
6619
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
583 return self.tr("<project>")
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
584 else:
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
585 return ""
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
586
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
587 def getVirtualenvInterpreter(self, venvName):
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
588 """
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
589 Public method to get the interpreter for a virtual environment.
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
591 @param venvName logical name for the virtual environment
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
592 @type str
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
593 @return interpreter path
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
594 @rtype str
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
595 """
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
596 ## if venvName == self.getDefaultEnvironmentString():
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
597 ## venvName = Preferences.getPip("CurrentEnvironment")
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
598 if venvName == self.getProjectEnvironmentString():
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
599 venvName = \
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
600 e5App().getObject("Project").getDebugProperty("VIRTUALENV")
6619
1d34365c082c pip Interface: added an entry to select the virtual environment of the current project if it has one defined.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6394
diff changeset
601 if not venvName:
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
602 # fall back to interpreter used to run eric6
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
603 return sys.executable
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
604 ## # fall back to standard if not defined
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
605 ## venvName = Preferences.getPip("CurrentEnvironment")
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
606
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
607 interpreter = \
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
608 e5App().getObject("VirtualEnvManager").getVirtualenvInterpreter(
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
609 venvName)
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
610 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
611 E5MessageBox.critical(
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
612 None,
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
613 self.tr("Interpreter for Virtual Environment"),
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
614 self.tr("""No interpreter configured for the selected"""
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
615 """ virtual environment."""))
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
616
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
617 return interpreter
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
618
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
619 def getVirtualenvNames(self):
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
620 """
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
621 Public method to get a sorted list of virtual environment names.
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
622
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
623 @return sorted list of virtual environment names
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
624 @rtype list of str
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
625 """
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
626 return sorted(
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
627 e5App().getObject("VirtualEnvManager").getVirtualenvNames())
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 ##########################################################################
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 ## Methods below implement the individual menu entries
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 ##########################################################################
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
633 ## def __selectPipVirtualenv(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
634 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
635 ## Private method to select the virtual environment to be used.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
636 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
637 ## environments = self.getVirtualenvNames()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
638 ## if environments:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
639 ## currentEnvironment = Preferences.getPip("CurrentEnvironment")
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
640 ## try:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
641 ## index = environments.index(currentEnvironment)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
642 ## except ValueError:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
643 ## index = 0
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
644 ## environment, ok = QInputDialog.getItem(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
645 ## None,
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
646 ## self.tr("Virtual Environment for pip"),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
647 ## self.tr("Select the virtual environment to be used:"),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
648 ## environments, index, False)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
649 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
650 ## if ok and environment:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
651 ## Preferences.getPip("CurrentEnvironment", environment)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
652 ## else:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
653 ## E5MessageBox.warning(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
654 ## None,
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
655 ## self.tr("Virtual Environment for pip"),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
656 ## self.tr("""No virtual environments have been configured yet."""
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
657 ## """ Please use the Virtualenv Manager to do that."""))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
658 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
659 ## def __listPackages(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
660 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
661 ## Private slot to list all installed packages.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
662 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
663 ## from .PipListDialog import PipListDialog
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
664 ## self.__listDialog = PipListDialog(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
665 ## self, "list", Preferences.getPip("PipSearchIndex"),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
666 ## self.tr("Installed Packages"))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
667 ## self.__listDialog.show()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
668 ## self.__listDialog.start()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
669 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
670 ## def __listUptodatePackages(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
671 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
672 ## Private slot to list all installed, up-to-date packages.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
673 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
674 ## from .PipListDialog import PipListDialog
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
675 ## self.__listUptodateDialog = PipListDialog(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
676 ## self, "uptodate", Preferences.getPip("PipSearchIndex"),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
677 ## self.tr("Up-to-date Packages"))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
678 ## self.__listUptodateDialog.show()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
679 ## self.__listUptodateDialog.start()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
680 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
681 ## def __listOutdatedPackages(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
682 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
683 ## Private slot to list all installed, up-to-date packages.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
684 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
685 ## from .PipListDialog import PipListDialog
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
686 ## self.__listOutdatedDialog = PipListDialog(
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
687 ## self, "outdated", Preferences.getPip("PipSearchIndex"),
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
688 ## self.tr("Outdated Packages"))
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
689 ## self.__listOutdatedDialog.show()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
690 ## self.__listOutdatedDialog.start()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
691 ##
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
692 ## def __editUserConfiguration(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
693 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
694 ## Private slot to edit the user configuration.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
695 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
696 ## self.__editConfiguration()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
697 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
698 ## def __editVirtualenvConfiguration(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
699 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
700 ## Private slot to edit the current virtualenv configuration.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
701 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
702 ## self.__editConfiguration(virtualenv=True)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
703 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
704 ## def __editConfiguration(self, virtualenv=False):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
705 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
706 ## Private method to edit a configuration.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
707 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
708 ## @param virtualenv flag indicating to edit the current virtualenv
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
709 ## configuration file
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
710 ## @type bool
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
711 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
712 ## from QScintilla.MiniEditor import MiniEditor
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
713 ## if virtualenv:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
714 ## cfgFile = self.__getVirtualenvConfig()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
715 ## if not cfgFile:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
716 ## return
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
717 ## else:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
718 ## cfgFile = self.__getUserConfig()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
719 ## cfgDir = os.path.dirname(cfgFile)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
720 ## if not cfgDir:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
721 ## E5MessageBox.critical(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
722 ## None,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
723 ## self.tr("Edit Configuration"),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
724 ## self.tr("""No valid configuration path determined."""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
725 ## """ Is a virtual environment selected? Aborting"""))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
726 ## return
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
727 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
728 ## try:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
729 ## if not os.path.isdir(cfgDir):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
730 ## os.makedirs(cfgDir)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
731 ## except OSError:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
732 ## E5MessageBox.critical(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
733 ## None,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
734 ## self.tr("Edit Configuration"),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
735 ## self.tr("""No valid configuration path determined."""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
736 ## """ Is a virtual environment selected? Aborting"""))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
737 ## return
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
738 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
739 ## if not os.path.exists(cfgFile):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
740 ## try:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
741 ## f = open(cfgFile, "w")
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
742 ## f.write("[global]\n")
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
743 ## f.close()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
744 ## except (IOError, OSError):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
745 ## # ignore these
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
746 ## pass
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
747 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
748 ## # check, if the destination is writeable
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
749 ## if not os.access(cfgFile, os.W_OK):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
750 ## E5MessageBox.critical(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
751 ## None,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
752 ## self.tr("Edit Configuration"),
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
753 ## self.tr("""No valid configuartion path determined."""
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
754 ## """ Is a virtual environment selected? Aborting"""))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
755 ## return
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
756 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
757 ## self.__editor = MiniEditor(cfgFile, "Properties")
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
758 ## self.__editor.show()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
759 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
760 def installPip(self, venvName, userSite=False):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 """
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
762 Public method to install pip.
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
764 @param venvName name of the environment to install pip into
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
765 @type str
6331
758b1cb7a2e6 pip Interface: continued adding support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
766 @param userSite flag indicating an install to the user install
758b1cb7a2e6 pip Interface: continued adding support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
767 directory
758b1cb7a2e6 pip Interface: continued adding support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
768 @type bool
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 """
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
770 interpreter = self.getVirtualenvInterpreter(venvName)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
771 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
772 return
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
773
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
774 dia = PipDialog(self.tr('Install PIP'))
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
775 if userSite:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
776 commands = [(interpreter, ["-m", "ensurepip", "--user"])]
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
777 else:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
778 commands = [(interpreter, ["-m", "ensurepip"])]
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
779 if Preferences.getPip("PipSearchIndex"):
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
780 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
781 args = ["-m", "pip", "install", "--index-url", indexUrl,
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
782 "--upgrade"]
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
783 else:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
784 args = ["-m", "pip", "install", "--upgrade"]
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
785 if userSite:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
786 args.append("--user")
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
787 args.append("pip")
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
788 commands.append((interpreter, args[:]))
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
789
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
790 res = dia.startProcesses(commands)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
791 if res:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
792 dia.exec_()
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
794 ## @pyqtSlot()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
795 ## def upgradePip(self, venvName="", userSite=False):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
796 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
797 ## Public method to upgrade pip itself.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
798 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
799 ## @param venvName name of the virtual environment to be used
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
800 ## @type str
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
801 ## @param userSite flag indicating an install to the user install
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
802 ## directory
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
803 ## @type bool
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
804 ## @return flag indicating a successful execution
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
805 ## @rtype bool
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
806 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
807 ## # Upgrading pip needs to be treated specially because
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
808 ## # it must be done using the python executable
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
809 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
810 ## if not venvName:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
811 ## from .PipSelectionDialog import PipSelectionDialog
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
812 ## dlg = PipSelectionDialog(self)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
813 ## if dlg.exec_() != QDialog.Accepted:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
814 ## return
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
815 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
816 ## venvName, userSite = dlg.getData()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
817 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
818 ## interpreter = self.getVirtualenvInterpreter(venvName)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
819 ## if not interpreter:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
820 ## return
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
821 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
822 ## if Preferences.getPip("PipSearchIndex"):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
823 ## indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
824 ## args = ["-m", "pip", "install", "--index-url", indexUrl,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
825 ## "--upgrade"]
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
826 ## else:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
827 ## args = ["-m", "pip", "install", "--upgrade"]
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
828 ## if userSite:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
829 ## args.append("--user")
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
830 ## args.append("pip")
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
831 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
832 ## dia = PipDialog(self.tr('Upgrade PIP'))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
833 ## res = dia.startProcess(interpreter, args)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
834 ## if res:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
835 ## dia.exec_()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
836 ## return res
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
837 ##
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 @pyqtSlot()
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
839 def repairPip(self, venvName):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 """
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
841 Public method to repair the pip installation.
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
842
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
843 @param venvName name of the environment to install pip into
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 @type str
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
845 @return flag indicating a successful execution
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 @rtype bool
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 """
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
848 interpreter = self.getVirtualenvInterpreter(venvName)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
849 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
850 return
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
852 # python -m pip install --ignore-installed pip
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
853 if Preferences.getPip("PipSearchIndex"):
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
854 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
855 args = ["-m", "pip", "install", "--index-url", indexUrl,
6331
758b1cb7a2e6 pip Interface: continued adding support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
856 "--ignore-installed"]
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
857 else:
6331
758b1cb7a2e6 pip Interface: continued adding support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
858 args = ["-m", "pip", "install", "--ignore-installed"]
758b1cb7a2e6 pip Interface: continued adding support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
859 args.append("pip")
758b1cb7a2e6 pip Interface: continued adding support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6327
diff changeset
860
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 dia = PipDialog(self.tr('Repair PIP'))
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
862 res = dia.startProcess(interpreter, args)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 if res:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864 dia.exec_()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 def __checkUpgradePyQt(self, packages):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868 Private method to check, if an upgrade of PyQt packages is attempted.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 @param packages list of packages to upgrade
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 @type list of str
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872 @return flag indicating to abort the upgrade attempt
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 @rtype bool
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
874 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
875 pyqtPackages = [p for p in packages
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
876 if p.lower() in ["pyqt5", "qscintilla", "sip"]]
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
877
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
878 if bool(pyqtPackages):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879 abort = not E5MessageBox.yesNo(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
880 None,
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
881 self.tr("Upgrade Packages"),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
882 self.tr(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
883 """You are trying to upgrade PyQt packages. This will"""
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
884 """ not work for the current instance of Python ({0})."""
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
885 """ Do you want to continue?""").format(sys.executable),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886 icon=E5MessageBox.Critical)
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 else:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 abort = False
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 return abort
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
892 def upgradePackages(self, packages, venvName="", userSite=False):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894 Public method to upgrade the given list of packages.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
896 @param packages list of packages to upgrade
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
897 @type list of str
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
898 @param venvName name of the virtual environment to be used
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
899 @type str
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
900 @param userSite flag indicating an install to the user install
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
901 directory
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
902 @type bool
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
903 @return flag indicating a successful execution
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
904 @rtype bool
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906 if self.__checkUpgradePyQt(packages):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 return False
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
909 if not venvName:
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
910 venvName = Preferences.getPip("CurrentEnvironment")
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
911 interpreter = self.getVirtualenvInterpreter(venvName)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
912 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
913 return
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
914
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
915 if Preferences.getPip("PipSearchIndex"):
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
916 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
917 args = ["-m", "pip", "install", "--index-url", indexUrl,
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
918 "--upgrade"]
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
919 else:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
920 args = ["-m", "pip", "install", "--upgrade"]
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
921 if userSite:
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
922 args.append("--user")
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
923 args += packages
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 dia = PipDialog(self.tr('Upgrade Packages'))
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
925 res = dia.startProcess(interpreter, args)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 if res:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 dia.exec_()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 return res
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 def __upgradePackages(self):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 Private slot to upgrade packages to be given by the user.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 from .PipPackagesInputDialog import PipPackagesInputDialog
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
935 dlg = PipPackagesInputDialog(self, self.tr("Upgrade Packages"))
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 if dlg.exec_() == QDialog.Accepted:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
937 venvName, packages, user = dlg.getData()
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 if packages:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
939 self.upgradePackages(packages, venvName=venvName,
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
940 userSite=user)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
942 def installPackages(self, packages, venvName="", userSite=False):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 Public method to install the given list of packages.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
946 @param packages list of packages to install
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
947 @type list of str
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
948 @param venvName name of the virtual environment to be used
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
949 @type str
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
950 @param userSite flag indicating an install to the user install
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
951 directory
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
952 @type bool
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 """
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
954 if not venvName:
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
955 venvName = Preferences.getPip("CurrentEnvironment")
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
956 interpreter = self.getVirtualenvInterpreter(venvName)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
957 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
958 return
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
959
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
960 if Preferences.getPip("PipSearchIndex"):
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
961 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
962 args = ["-m", "pip", "install", "--index-url", indexUrl]
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
963 else:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
964 args = ["-m", "pip", "install"]
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
965 if userSite:
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
966 args.append("--user")
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
967 args += packages
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 dia = PipDialog(self.tr('Install Packages'))
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
969 res = dia.startProcess(interpreter, args)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970 if res:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 dia.exec_()
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
972 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
973 ## def __installPackages(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
974 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
975 ## Private slot to install packages to be given by the user.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
976 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
977 ## from .PipPackagesInputDialog import PipPackagesInputDialog
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
978 ## dlg = PipPackagesInputDialog(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
979 ## self, self.tr("Install Packages"))
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
980 ## if dlg.exec_() == QDialog.Accepted:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
981 ## venvName, packages, user = dlg.getData()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
982 ## if packages:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
983 ## self.installPackages(packages, venvName=venvName,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
984 ## userSite=user)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
985 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
986 ## def __installLocalPackage(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
987 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
988 ## Private slot to install a package available on local storage.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
989 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
990 ## from .PipFileSelectionDialog import PipFileSelectionDialog
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
991 ## dlg = PipFileSelectionDialog(self, "package")
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
992 ## if dlg.exec_() == QDialog.Accepted:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
993 ## venvName, package, user = dlg.getData()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
994 ## if package and os.path.exists(package):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
995 ## self.installPackages([package], venvName=venvName,
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
996 ## userSite=user)
6294
58f82c179d2b pip Interface: added an action to install a locally available package/wheel
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6290
diff changeset
997
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
998 def __installRequirements(self):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000 Private slot to install packages as given in a requirements file.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001 """
6294
58f82c179d2b pip Interface: added an action to install a locally available package/wheel
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6290
diff changeset
1002 from .PipFileSelectionDialog import PipFileSelectionDialog
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1003 dlg = PipFileSelectionDialog(self, "requirements")
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004 if dlg.exec_() == QDialog.Accepted:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1005 venvName, requirements, user = dlg.getData()
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 if requirements and os.path.exists(requirements):
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1007 interpreter = self.getVirtualenvInterpreter(venvName)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1008 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1009 return
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
1010 if Preferences.getPip("PipSearchIndex"):
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
1011 indexUrl = Preferences.getPip("PipSearchIndex") + \
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1012 "/simple"
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1013 args = ["-m", "pip", "install", "--index-url", indexUrl]
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1014 else:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1015 args = ["-m", "pip", "install"]
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
1016 if user:
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
1017 args.append("--user")
6257
4523c5e6dd43 Added more code to properly override the PyPi index URL used by pip.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1018 args += ["--requirement", requirements]
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 dia = PipDialog(self.tr('Install Packages from Requirements'))
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1020 res = dia.startProcess(interpreter, args)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 if res:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 dia.exec_()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1024 def uninstallPackages(self, packages, venvName=""):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026 Public method to uninstall the given list of packages.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1028 @param packages list of packages to uninstall
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1029 @type list of str
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1030 @param venvName name of the virtual environment to be used
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1031 @type str
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1032 @return flag indicating a successful execution
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1033 @rtype bool
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 res = False
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036 if packages:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 from UI.DeleteFilesConfirmationDialog import \
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038 DeleteFilesConfirmationDialog
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 dlg = DeleteFilesConfirmationDialog(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 self.parent(),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1041 self.tr("Uninstall Packages"),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042 self.tr(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043 "Do you really want to uninstall these packages?"),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 packages)
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045 if dlg.exec_() == QDialog.Accepted:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1046 if not venvName:
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
1047 venvName = Preferences.getPip("CurrentEnvironment")
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1048 interpreter = self.getVirtualenvInterpreter(venvName)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1049 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1050 return
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1051 args = ["-m", "pip", "uninstall", "--yes"] + packages
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1052 dia = PipDialog(self.tr('Uninstall Packages'))
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1053 res = dia.startProcess(interpreter, args)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1054 if res:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1055 dia.exec_()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1056 return res
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1057
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1058 ## def __uninstallPackages(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1059 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1060 ## Private slot to uninstall packages to be given by the user.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1061 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1062 ## from .PipPackagesInputDialog import PipPackagesInputDialog
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1063 ## dlg = PipPackagesInputDialog(
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1064 ## self, self.tr("Uninstall Packages"), install=False)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1065 ## if dlg.exec_() == QDialog.Accepted:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1066 ## venvName, packages, _user = dlg.getData()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1067 ## if packages:
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1068 ## self.uninstallPackages(packages, venvName=venvName)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1069 ##
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1070 def __uninstallRequirements(self):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1071 """
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1072 Private slot to uninstall packages as given in a requirements file.
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1073 """
6294
58f82c179d2b pip Interface: added an action to install a locally available package/wheel
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6290
diff changeset
1074 from .PipFileSelectionDialog import PipFileSelectionDialog
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1075 dlg = PipFileSelectionDialog(self, "requirements",
6327
a1716d9210f4 pip Interface: started to add support for the '--user' option.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6301
diff changeset
1076 install=False)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1077 if dlg.exec_() == QDialog.Accepted:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1078 venvName, requirements, _user = dlg.getData()
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1079 if requirements and os.path.exists(requirements):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1080 try:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1081 f = open(requirements, "r")
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1082 reqs = f.read().splitlines()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1083 f.close()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1084 except (OSError, IOError):
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1085 return
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1086
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1087 from UI.DeleteFilesConfirmationDialog import \
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1088 DeleteFilesConfirmationDialog
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1089 dlg = DeleteFilesConfirmationDialog(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1090 self.parent(),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1091 self.tr("Uninstall Packages"),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1092 self.tr(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1093 "Do you really want to uninstall these packages?"),
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1094 reqs)
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1095 if dlg.exec_() == QDialog.Accepted:
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1096 if not venvName:
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
1097 venvName = Preferences.getPip("CurrentEnvironment")
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1098 interpreter = self.getVirtualenvInterpreter(venvName)
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1099 if not interpreter:
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1100 return
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1101 args = ["-m", "pip", "uninstall", "--requirement",
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1102 requirements]
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1103 dia = PipDialog(
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1104 self.tr('Uninstall Packages from Requirements'))
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1105 res = dia.startProcess(interpreter, args)
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1106 if res:
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1107 dia.exec_()
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1108
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1109 ## def __generateRequirements(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1110 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1111 ## Private slot to generate the contents for a requirements file.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1112 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1113 ## from .PipFreezeDialog import PipFreezeDialog
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1114 ## self.__freezeDialog = PipFreezeDialog(self)
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1115 ## self.__freezeDialog.show()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1116 ## self.__freezeDialog.start()
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1117 ##
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1118 ## def __searchPyPI(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1119 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1120 ## Private slot to search the Python Package Index.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1121 ## """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1122 ## from .PipSearchDialog import PipSearchDialog
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1123 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1124 ## if Preferences.getPip("PipSearchIndex"):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1125 ## indexUrl = Preferences.getPip("PipSearchIndex") + "/pypi"
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1126 ## else:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1127 ## indexUrl = DefaultIndexUrlXml
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1128 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1129 ## self.__searchDialog = PipSearchDialog(self, indexUrl)
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1130 ## self.__searchDialog.show()
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1131 ##
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1132 def getIndexUrl(self):
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1133 """
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1134 Public method to get the index URL for PyPI.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1135
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1136 @return index URL for PyPI
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1137 @rtype str
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1138 """
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1139 if Preferences.getPip("PipSearchIndex"):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1140 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1141 else:
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1142 indexUrl = Pip.DefaultIndexUrlPip
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1143
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1144 return indexUrl
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1145
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1146 def getIndexUrlXml(self):
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1147 """
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1148 Public method to get the index URL for XML RPC calls.
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1149
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1150 @return index URL for XML RPC calls
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1151 @rtype str
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1152 """
6785
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
1153 if Preferences.getPip("PipSearchIndex"):
058d63c537a4 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6782
diff changeset
1154 indexUrl = Preferences.getPip("PipSearchIndex") + "/pypi"
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1155 else:
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1156 indexUrl = Pip.DefaultIndexUrlXml
6342
c79ecba9cde7 pip Interface: changed to use the new VirtualEnv Manager
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6331
diff changeset
1157
6793
cca6a35f3ad2 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6792
diff changeset
1158 return indexUrl
6011
e6af0dcfbb35 Added the pip interface plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1159
6792
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1160 def getInstalledPackages(self, envName, localPackages=True,
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1161 notRequired=False, usersite=False):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1162 """
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1163 Public method to get the list of installed packages.
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1164
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1165 @param envName name of the environment to get the packages for
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1166 @type str
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1167 @param localPackages flag indicating to get local packages only
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1168 @type bool
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1169 @param notRequired flag indicating to list packages that are not
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1170 dependencies of installed packages as well
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1171 @type bool
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1172 @param usersite flag indicating to only list packages installed
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1173 in user-site
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1174 @type bool
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1175 @return list of tuples containing the package name and version
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1176 @rtype list of tuple of (str, str)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1177 """
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1178 packages = []
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1179
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1180 if envName:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1181 interpreter = self.getVirtualenvInterpreter(envName)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1182 if interpreter:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1183 args = [
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1184 "-m", "pip",
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1185 "list",
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1186 "--format=json",
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1187 ]
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1188 if localPackages:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1189 args.append("--local")
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1190 if notRequired:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1191 args.append("--not-required")
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1192 if usersite:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1193 args.append("--user")
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1194
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1195 proc = QProcess()
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1196 proc.start(interpreter, args)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1197 if proc.waitForStarted(15000):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1198 if proc.waitForFinished(30000):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1199 output = str(proc.readAllStandardOutput(),
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1200 Preferences.getSystem("IOEncoding"),
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1201 'replace').strip()
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1202 try:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1203 jsonList = json.loads(output)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1204 except Exception:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1205 jsonList = []
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1206
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1207 for package in jsonList:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1208 if isinstance(package, dict):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1209 packages.append((
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1210 package["name"],
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1211 package["version"],
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1212 ))
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1213
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1214 return packages
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1215
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1216 def getOutdatedPackages(self, envName, localPackages=True,
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1217 notRequired=False, usersite=False):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1218 """
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1219 Public method to get the list of outdated packages.
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1220
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1221 @param envName name of the environment to get the packages for
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1222 @type str
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1223 @param localPackages flag indicating to get local packages only
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1224 @type bool
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1225 @param notRequired flag indicating to list packages that are not
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1226 dependencies of installed packages as well
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1227 @type bool
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1228 @param usersite flag indicating to only list packages installed
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1229 in user-site
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1230 @type bool
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1231 @return list of tuples containing the package name, installed version
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1232 and available version
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1233 @rtype list of tuple of (str, str, str)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1234 """
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1235 packages = []
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1236
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1237 if envName:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1238 interpreter = self.getVirtualenvInterpreter(envName)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1239 if interpreter:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1240 args = [
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1241 "-m", "pip",
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1242 "list",
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1243 "--outdated",
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1244 "--format=json",
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1245 ]
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1246 if localPackages:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1247 args.append("--local")
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1248 if notRequired:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1249 args.append("--not-required")
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1250 if usersite:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1251 args.append("--user")
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1252
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1253 proc = QProcess()
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1254 proc.start(interpreter, args)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1255 if proc.waitForStarted(15000):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1256 if proc.waitForFinished(30000):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1257 output = str(proc.readAllStandardOutput(),
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1258 Preferences.getSystem("IOEncoding"),
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1259 'replace').strip()
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1260 try:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1261 jsonList = json.loads(output)
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1262 except Exception:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1263 jsonList = []
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1264
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1265 for package in jsonList:
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1266 if isinstance(package, dict):
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1267 packages.append((
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1268 package["name"],
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1269 package["version"],
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1270 package["latest_version"],
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1271 ))
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1272
9dd854f05c83 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6785
diff changeset
1273 return packages
6795
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1274 ##
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1275 ## def __pipConfigure(self):
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1276 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1277 ## Private slot to open the configuration page.
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1278 ## """
6e2ed2aac325 PipInterface: continued with the pip interface widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6793
diff changeset
1279 ## e5App().getObject("UserInterface").showPreferences("pipPage")

eric ide

mercurial