Commit 6624c4fd authored by Stefan Behnel's avatar Stefan Behnel

merge 0.22.x branch into master

parents 33096f91 a74bdd5a
...@@ -16,6 +16,9 @@ Features added ...@@ -16,6 +16,9 @@ Features added
Bugs fixed Bugs fixed
---------- ----------
* Runtime reported file paths of source files (e.g for profiling and tracing)
are now relative to the build root directory instead of the main source file.
0.22 (2015-02-11) 0.22 (2015-02-11)
================= =================
......
...@@ -701,15 +701,19 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -701,15 +701,19 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
full_module_path = path.join(*self.full_module_name.split('.')) full_module_path = path.join(*self.full_module_name.split('.'))
module_abspath = path.splitext(path.abspath( module_abspath = path.splitext(path.abspath(
self.compilation_source.source_desc.get_filenametable_entry() ))[0] self.compilation_source.source_desc.get_filenametable_entry() ))[0]
module_rootpath = module_abspath[:-len(full_module_path)] root_path = module_abspath[:-len(full_module_path)]
workdir = path.abspath(os.getcwd()) + os.sep
if root_path.startswith(workdir):
# prefer relative paths to current directory (which is most likely the project root)
root_path = workdir
code.putln("") code.putln("")
code.putln("static const char *%s[] = {" % Naming.filetable_cname) code.putln("static const char *%s[] = {" % Naming.filetable_cname)
if code.globalstate.filename_list: if code.globalstate.filename_list:
for source_desc in code.globalstate.filename_list: for source_desc in code.globalstate.filename_list:
file_abspath = path.abspath(source_desc.get_filenametable_entry()) file_abspath = path.abspath(source_desc.get_filenametable_entry())
if file_abspath.startswith(module_rootpath): if file_abspath.startswith(root_path):
filename = file_abspath[len(module_rootpath):] filename = file_abspath[len(root_path):]
else: else:
filename = path.basename(file_abspath) filename = path.basename(file_abspath)
escaped_filename = filename.replace("\\", "\\\\").replace('"', r'\"') escaped_filename = filename.replace("\\", "\\\\").replace('"', r'\"')
......
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