summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSérgio Almeida <mephx.x@gmail.com>2009-07-31 23:29:02 +0100
committerSérgio Almeida <mephx.x@gmail.com>2009-07-31 23:29:02 +0100
commitbf683ea4d54db55262dae3419729672b1933837f (patch)
treed19a9c4f4415b967a922ac9577b5c385b3523963
parentMerge branch 'uselect' (diff)
downloaduselect-bf683ea4d54db55262dae3419729672b1933837f.tar.gz
uselect-bf683ea4d54db55262dae3419729672b1933837f.tar.bz2
uselect-bf683ea4d54db55262dae3419729672b1933837f.zip
uprofile now uses PWD instead of HOME for profile storage
-rw-r--r--uio.py10
-rw-r--r--umodule.py6
-rwxr-xr-xuprofile.py1
3 files changed, 14 insertions, 3 deletions
diff --git a/uio.py b/uio.py
index c54754f..2a3bb50 100644
--- a/uio.py
+++ b/uio.py
@@ -35,13 +35,18 @@ class FileSystem:
self.home = os.getenv('HOME')
self.uid = pwd.getpwuid(os.getuid())[0]
self.environment = self.home + '/.uselect/'
+
+ def set_type(self, type):
+ if type == 'profile':
+ self.environment = './.uprofile/'
+
+ def prepare_environment(self):
if not os.path.exists(self.environment):
os.mkdir(self.environment)
if not os.path.exists(self.environment + 'bin/'):
os.mkdir(self.environment + 'bin/')
if not os.path.exists(self.environment + 'env.d/'):
os.mkdir(self.environment + 'env.d/')
-
def get_env(self):
env = []
for param in os.environ.keys():
@@ -307,8 +312,7 @@ class PrintSystem:
[bold + '-nc', bullet + space + 'No Colors'], \
[bold + '-version', bullet + space + 'Version Information']])
-
-
+
class ProfilePrintSystem(PrintSystem):
def print_ui(self, profile = None, profiles = None, args = None, \
diff --git a/umodule.py b/umodule.py
index 26ce7bf..5cc05bb 100644
--- a/umodule.py
+++ b/umodule.py
@@ -321,6 +321,7 @@ class ProfileAction(Action):
def do_action(self, args, modules):
if args[0] == 'activate':
+ filesystem.prepare_environment()
self.output.append('Setting Folder Profile...')
for module in modules:
for action in module[1]:
@@ -382,6 +383,11 @@ class Path(Action, Sym):
Implementation of do_target for Path.
Activates/Deactivates targets.
"""
+
+ # TODO: implement clear
+
+ filesystem.prepare_environment()
+
i = target[2]
link = target[1]
filesystem.create_symlink(link.targets[i], \
diff --git a/uprofile.py b/uprofile.py
index cc04512..129bd02 100755
--- a/uprofile.py
+++ b/uprofile.py
@@ -19,6 +19,7 @@ from uio import printsystem
verbose = False
printsystem.set_type('profile')
+filesystem.set_type('profile')
class Profile(Module):