diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-12 21:35:52 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-12 21:35:52 (GMT) |
commit | bb60b8ad3eefa7d98cd0d7659860209d5c411001 (patch) | |
tree | b50182c9fbbbbad4a06cff6602387dfed71e5792 /sugar/env.py | |
parent | d41c761e022ef9858c34edae9850611215665029 (diff) |
Cleanup environemnt setup
Diffstat (limited to 'sugar/env.py')
-rw-r--r-- | sugar/env.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sugar/env.py b/sugar/env.py index cbfd6c8..6d5fba0 100644 --- a/sugar/env.py +++ b/sugar/env.py @@ -7,6 +7,8 @@ try: except ImportError: from sugar.__installed__ import * +import sugar.setup + def add_to_python_path(path): sys.path.insert(0, path) if os.environ.has_key('PYTHONPATH'): @@ -14,6 +16,25 @@ def add_to_python_path(path): else: os.environ['PYTHONPATH'] = path +def add_to_bin_path(path): + if os.environ.has_key('PATH'): + old_path = os.environ['PATH'] + os.environ['PATH'] = path + ':' + old_path + else: + os.environ['PATH'] = path + +def setup(): + for path in sugar_python_path: + add_to_python_path(path) + + for path in sugar_bin_path: + add_to_bin_path(path) + + if sugar_source_dir: + source = os.path.join(sugar_source_dir, 'activities') + runner = os.path.join(sugar_source_dir, 'shell/sugar-activity-factory') + sugar.setup.setup_activities(source, get_activities_dir(), runner) + def get_user_dir(): if os.environ.has_key('SUGAR_NICK_NAME'): nick = get_nick_name() |