summaryrefslogtreecommitdiff
path: root/giscanner/message.py
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-05-28 17:20:49 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-10-08 20:54:59 +0200
commitcc96177ec877153e7e5e55e6af270829da546015 (patch)
treec316058a23302adf9e63b3227d92853af692096c /giscanner/message.py
parent4d1972cedd20bb51b8c67ec030339d5d4dce12a9 (diff)
downloadgobject-introspection-cc96177ec877153e7e5e55e6af270829da546015.tar.gz
giscanner: give pointer to original comment block...
...when complaining about multiple comment blocks documenting the same identifier.
Diffstat (limited to 'giscanner/message.py')
-rw-r--r--giscanner/message.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/giscanner/message.py b/giscanner/message.py
index fc6100e0..eca425aa 100644
--- a/giscanner/message.py
+++ b/giscanner/message.py
@@ -53,9 +53,12 @@ class Position(object):
self.column or -1)
def format(self, cwd):
- filename = self.filename
- if filename.startswith(cwd):
- filename = filename[len(cwd):]
+ filename = os.path.realpath(self.filename)
+ cwd = os.path.realpath(cwd)
+ common_prefix = os.path.commonprefix((filename, cwd))
+ if common_prefix:
+ filename = os.path.relpath(filename, common_prefix)
+
if self.column is not None:
return '%s:%d:%d' % (filename, self.line, self.column)
elif self.line is not None:
@@ -73,7 +76,7 @@ class MessageLogger(object):
def __init__(self, namespace, output=None):
if output is None:
output = sys.stderr
- self._cwd = os.getcwd() + os.sep
+ self._cwd = os.getcwd()
self._output = output
self._namespace = namespace
self._enable_warnings = False