summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'umodule.py')
-rw-r--r--umodule.py43
1 files changed, 32 insertions, 11 deletions
diff --git a/umodule.py b/umodule.py
index 49ba10f..26ce7bf 100644
--- a/umodule.py
+++ b/umodule.py
@@ -7,12 +7,15 @@
import re
import os
+#import pdb
from uio import Counter
from uio import filesystem
from uio import printsystem
+
+
modules_dir = '/usr/share/uselect/modules/'
class Action:
@@ -141,14 +144,16 @@ class Link:
source = self.prefix + match.group(0) + self.sufix
self.targets.append(source)
if filesystem.path_exists(self.destination):
- if filesystem.real_path( \
- filesystem.environment + self.alias) == \
- source:
- self.status.append('notice')
- elif filesystem.real_path(self.destination) == source:
+ if filesystem.real_path(self.destination) == source:
self.status.append('ok')
else:
self.status.append('warning')
+ if filesystem.real_path( \
+ filesystem.environment + 'bin/' + self.alias) == \
+ source:
+ status = self.status.pop()
+ status += ' + space + notice'
+ self.status.append(status)
else:
self.status.append('error')
@@ -174,10 +179,11 @@ class Sym(Action):
return options
- def get_targets(self, links, option = None, target = None, family = []):
+ def get_targets(self, links, option = None, target = None, family = None):
"""
Builds a nested list of targets.
"""
+
parent = None
for link in links:
if isinstance(link, list) and not isinstance(link[0], int):
@@ -225,7 +231,7 @@ class Sym(Action):
links.append(target)
self.options = self.build_options(links)
-
+
if len(args) != 0:
if len(args) >= 1:
@@ -236,8 +242,7 @@ class Sym(Action):
except ValueError:
option = None
target = arg
- targets = self.get_targets(links, option = option, target = target)
-
+ targets = self.get_targets(links, option = option, target = target, family = [])
if targets != None:
for target in targets:
self.do_target(target)
@@ -270,6 +275,7 @@ class Sym(Action):
"""
self.links.append(link)
def setup(self):
+
self.links = []
def build(self):
@@ -312,9 +318,24 @@ class Var():
class ProfileAction(Action):
- def do_action(self, args):
+
+ def do_action(self, args, modules):
if args[0] == 'activate':
+ self.output.append('Setting Folder Profile...')
+ for module in modules:
+ for action in module[1]:
+ _action = module[0].get_action(action[0])
+ _action.build()
+ for arg in action[1]:
+ args = str(arg).split(" ")
+
+ _action.do_action(args)
+
+ for line in _action.output:
+ self.output.append(line)
+
self.output.append('Folder Profile Set!')
+
elif args[0] == 'default':
self.output.append('Default Profile Set!')
def build(self):
@@ -364,7 +385,7 @@ class Path(Action, Sym):
i = target[2]
link = target[1]
filesystem.create_symlink(link.targets[i], \
- filesystem.environment + link.alias)
+ filesystem.environment + 'bin/' + link.alias)
self.output.append('Setting ' + link.targets[i] \
+ ' success!')