Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Krejsa <dan.krejsa@alamedanet.net>2008-11-24 08:05:00 (GMT)
committer Dan Krejsa <dan.krejsa@alamedanet.net>2008-11-24 08:05:00 (GMT)
commitde78d59735142820a97d47a47a28e3a92607bfb2 (patch)
treed954b8e7f40a913e10eaa74c0baca48f0265bf10
parent0f416b7c9afa35ba179d06f81a1cc222878d6258 (diff)
Improve absolute path handling some more.
-rwxr-xr-xghilbert.py6
-rwxr-xr-xspock.py15
-rw-r--r--sugar_and_spock.py4
3 files changed, 17 insertions, 8 deletions
diff --git a/ghilbert.py b/ghilbert.py
index e816e81..40a5928 100755
--- a/ghilbert.py
+++ b/ghilbert.py
@@ -1628,6 +1628,7 @@ class Ghilbert():
child.params = params
child.ifname = ifname
child.curdir = curdir
+ child.file = expr[1]
scanner = StreamScanner(istream)
while (1):
@@ -1665,7 +1666,7 @@ class Ghilbert():
"'%d'" % (word, scanner.lineno))
except:
print >> sys.stderr, "Error in import: %s line %d" % \
- (gh.file, scanner.lineno)
+ (child.file, scanner.lineno)
raise
finally:
istream.close()
@@ -2043,6 +2044,7 @@ class Ghilbert():
child.params = params
child.ifname = ifname
child.curdir = curdir
+ child.file = path
scanner = StreamScanner(istream)
while (1):
@@ -2080,7 +2082,7 @@ class Ghilbert():
"'%d'" % (word, scanner.lineno))
except:
print >> sys.stderr, "Error in export: %s line %d" % \
- (gh.file, scanner.lineno)
+ (child.file, scanner.lineno)
raise
finally:
istream.close()
diff --git a/spock.py b/spock.py
index 7bb8510..1e3b10d 100755
--- a/spock.py
+++ b/spock.py
@@ -87,7 +87,7 @@ class Spock:
# self.good_offset back to the start of the file), create a fresh one
if self.gh == None:
self.gh = ghilbert.Ghilbert(logger)
- self.gh.fpath = ['/']
+ self.gh.fpath = self.file_roots()
self.gh.curdir = self.curdir
self.gh.file = self.current_file
@@ -314,6 +314,17 @@ class Spock:
i1 = sb.get_iter_at_mark(m)
print >> sys.stderr, "error_end line", i1.get_line(), "off", i1.get_line_offset()
+ def file_roots(self):
+ roots = ['.', '/']
+ if os.environ.has_key('SUGAR_ACTIVITY_ROOT'):
+ roots.append(os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'],
+ 'data'))
+ if os.environ.has_key('SUGAR_BUNDLE_PATH'):
+ roots.append(os.environ['SUGAR_BUNDLE_PATH'])
+
+ if os.environ.has_key('GHILBERT_PATH'):
+ roots.extend(os.environ['GHILBERT_PATH'].split(':'))
+ return roots
def __init__(self, vbox):
@@ -321,7 +332,7 @@ class Spock:
self.current_file = None
self.curdir = '.'
self.gh = ghilbert.Ghilbert(logger)
- self.gh.fpath = ['/']
+ self.gh.fpath = self.file_roots()
self.main_view = vbox
hbox = gtk.HBox()
diff --git a/sugar_and_spock.py b/sugar_and_spock.py
index 397bdcf..554fdd5 100644
--- a/sugar_and_spock.py
+++ b/sugar_and_spock.py
@@ -49,10 +49,6 @@ class Shpock(activity.Activity):
# delegate read_file to spock...
spockObj = self.spockObj
- spockObj.gh.fpath = ['/',
- os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'],
- 'data'),
- os.environ['SUGAR_BUNDLE_PATH']]
spockObj.read_file(file_path)