diff options
author | Robert Bradshaw <robertwb@gmail.com> | 2014-08-14 21:04:12 -0700 |
---|---|---|
committer | Robert Bradshaw <robertwb@gmail.com> | 2014-08-14 21:04:12 -0700 |
commit | 9ebc365050d15f1bc014ea7e238e182e85679da9 (patch) | |
tree | e625b8828c55752975db343ffeacdc6fe9e6b3bd /Cython/Compiler/ModuleNode.py | |
parent | ade9b4e7436c877903d00cccd2264e28cb3df2a4 (diff) | |
parent | e3b1cc75f129e55feb9210d40d86104bafef3797 (diff) | |
download | cython-9ebc365050d15f1bc014ea7e238e182e85679da9.tar.gz |
Merge branch 'profile_abspath' of github.com:martinra/cython into martinra-profile_abspath
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index a3000fced..bb476010e 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -683,11 +683,22 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.putln_openmp("#include <omp.h>") def generate_filename_table(self, code): + import os.path as path + + full_module_path = path.join(*self.full_module_name.split('.')) + module_abspath = path.splitext(path.abspath( + self.compilation_source.source_desc.get_filenametable_entry() ))[0] + module_relpath = module_abspath[:-len(full_module_path)] + code.putln("") code.putln("static const char *%s[] = {" % Naming.filetable_cname) if code.globalstate.filename_list: for source_desc in code.globalstate.filename_list: - filename = os.path.basename(source_desc.get_filenametable_entry()) + file_abspath = path.abspath(source_desc.get_filenametable_entry()) + if file_abspath.startswith(module_relpath): + filename = file_abspath[len(module_relpath):] + else: + filename = path.basename(file_abspath) escaped_filename = filename.replace("\\", "\\\\").replace('"', r'\"') code.putln('"%s",' % escaped_filename) else: |