@@ -12,8 +12,11 @@ def __init__(self):
1212 return None
1313
1414 #blocking actions, should be run on off-thread
15- def pipModuleAction (self , command , args , verbose = True ):
16- return cmd .run ('pip ' + command + ' ' + args , cmd .PythonHomeScriptsPath (), verbose )
15+ def pipModuleAction (self , command , args = None , verbose = True ):
16+ if args :
17+ return cmd .run ('pip ' + command + ' ' + args , cmd .PythonHomeScriptsPath (), verbose )
18+ else :
19+ return cmd .run ('pip ' + command , cmd .PythonHomeScriptsPath (), verbose )
1720
1821 #use this if you need to work on the resulting list to query current dependencies
1922 def listDict (self , verbose = True ):
@@ -37,6 +40,8 @@ def isDesiredVersionSufficient(self, desired, current):
3740 return LooseVersion (desired ) <= LooseVersion (current )
3841
3942 def isInstalled (self , module , desiredVersion = None ):
43+ if desiredVersion == 'latest' :
44+ desiredVersion = None
4045 if PipInstall .modules == None :
4146 PipInstall .modules = self .listDict (False )
4247 if module in PipInstall .modules :
@@ -68,6 +73,11 @@ def list(self):
6873 t = Thread (target = action )
6974 t .start ()
7075
76+ def action (self , command ):
77+ action = self .pipModuleAction
78+ t = Thread (target = action , args = (command ,))
79+ t .start ()
80+
7181 def uninstallAll (self ):
7282 PipInstall .modules = None #our cache is no longer valid
7383 action = self .pipModuleAction
@@ -83,4 +93,5 @@ def uninstallAll(self):
8393uninstall = _inst .uninstall
8494uninstallAll = _inst .uninstallAll
8595pipModuleAction = _inst .pipModuleAction
86- listDict = _inst .listDict
96+ listDict = _inst .listDict
97+ action = _inst .action
0 commit comments