Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit edbfbe4

Browse files
committed
add custom pip function
1 parent e5f58be commit edbfbe4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Content/Scripts/upypip.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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):
@@ -70,6 +73,11 @@ def list(self):
7073
t = Thread(target=action)
7174
t.start()
7275

76+
def action(self, command):
77+
action = self.pipModuleAction
78+
t = Thread(target=action, args=(command,))
79+
t.start()
80+
7381
def uninstallAll(self):
7482
PipInstall.modules = None #our cache is no longer valid
7583
action = self.pipModuleAction
@@ -85,4 +93,5 @@ def uninstallAll(self):
8593
uninstall = _inst.uninstall
8694
uninstallAll = _inst.uninstallAll
8795
pipModuleAction = _inst.pipModuleAction
88-
listDict = _inst.listDict
96+
listDict = _inst.listDict
97+
action = _inst.action

0 commit comments

Comments
 (0)