Commit 1532b5de authored by Ralf Schmitt's avatar Ralf Schmitt

report filenames relative to the current directory or as absolute paths in warnings/errors.

we use relative filenames for files in the directory itself or
subdirectories, absolute paths otherwise.

this makes cython compatible with emacs compilation mode.

--HG--
extra : transplant_source : %9E%2A%91%5E%84%8Ah%B2_%E5%89%E3-%BA%EE%FBc%08%03o
parent 5c0ade92
...@@ -32,7 +32,7 @@ def context(position): ...@@ -32,7 +32,7 @@ def context(position):
def format_position(position): def format_position(position):
if position: if position:
return u"%s:%d:%d: " % (position[0].get_description(), return u"%s:%d:%d: " % (position[0].get_error_description(),
position[1], position[2]) position[1], position[2])
return u'' return u''
......
...@@ -204,6 +204,13 @@ class FileSourceDescriptor(SourceDescriptor): ...@@ -204,6 +204,13 @@ class FileSourceDescriptor(SourceDescriptor):
def get_description(self): def get_description(self):
return self.path_description return self.path_description
def get_error_description(self):
path = self.filename
cwd = os.getcwd() + os.path.sep
if path.startswith(cwd):
return path[len(cwd):]
return path
def get_filenametable_entry(self): def get_filenametable_entry(self):
return self.filename return self.filename
...@@ -239,6 +246,8 @@ class StringSourceDescriptor(SourceDescriptor): ...@@ -239,6 +246,8 @@ class StringSourceDescriptor(SourceDescriptor):
def get_description(self): def get_description(self):
return self.name return self.name
get_error_description = get_description
def get_filenametable_entry(self): def get_filenametable_entry(self):
return "stringsource" return "stringsource"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment