23
23
24
24
from genesis .api import *
25
25
from genesis .com import *
26
- from genesis .utils import BackgroundWorker , detect_platform , shell , shell_status , download
26
+ from genesis .utils import BackgroundWorker , detect_platform , shell , shell_cs , shell_status , download
27
27
import genesis
28
28
29
29
RETRY_LIMIT = 10
@@ -238,6 +238,7 @@ def load(plugin, cat=''):
238
238
239
239
info = PluginInfo ()
240
240
try :
241
+ d = None
241
242
# Save info
242
243
info .id = plugin
243
244
info .ptype = mod .TYPE
@@ -285,7 +286,7 @@ def load(plugin, cat=''):
285
286
break
286
287
info .deps = deps
287
288
for req in deps :
288
- PluginLoader .verify_dep (req , cat )
289
+ d = PluginLoader .verify_dep (req , cat )
289
290
290
291
PluginLoader .__classes [plugin ] = []
291
292
PluginLoader .__submods [plugin ] = {}
@@ -312,6 +313,8 @@ def load(plugin, cat=''):
312
313
# Store the whole plugin
313
314
setattr (genesis .plugins , plugin , mod )
314
315
PluginLoader .notify_plugins_changed ()
316
+ if d :
317
+ return d
315
318
except BaseRequirementError , e :
316
319
info .problem = e
317
320
raise e
@@ -390,7 +393,7 @@ def unload(plugin):
390
393
@staticmethod
391
394
def verify_dep (dep , cat = '' ):
392
395
"""
393
- Verifies that given plugin dependency is satisfied. Returns bool
396
+ Verifies that given plugin dependency is satisfied.
394
397
"""
395
398
platform = PluginLoader .platform
396
399
log = PluginLoader .log
@@ -441,8 +444,12 @@ def verify_dep(dep, cat=''):
441
444
exec ('import %s' % dep ['binary' ])
442
445
except :
443
446
# Let's try to install it anyway
444
- shell ('pip%s install %s' % ('2' if platform in ['arkos' , 'arch' ] else '' , dep ['package' ]))
445
- raise ModuleRequirementError (dep , True )
447
+ s = shell_cs ('pip%s install %s' % ('2' if platform in ['arkos' , 'arch' ] else '' , dep ['package' ]))
448
+ if s [0 ] != 0 :
449
+ raise ModuleRequirementError (dep , False )
450
+ else :
451
+ return 'Restart Genesis for changes to take effect.'
452
+ raise ModuleRequirementError (dep , False )
446
453
else :
447
454
p = False
448
455
s = shell ('pip%s freeze' % '2' if platform in ['arkos' , 'arch' ] else '' )
@@ -729,8 +736,9 @@ def str_req(self):
729
736
730
737
class LiveInstall (BackgroundWorker ):
731
738
def run (self , rm , id , load , cat ):
732
- rm .install (id , load = load , cat = cat )
733
- cat .put_message ('info' , 'Plugin installed. Refresh page for changes to take effect.' )
739
+ d = rm .install (id , load = load , cat = cat )
740
+ if d :
741
+ cat .put_message ('info' , 'Plugin installed. %s' % str (d ))
734
742
ComponentManager .get ().rescan ()
735
743
ConfManager .get ().rescan ()
736
744
cat ._reloadfw = True
0 commit comments