Commit b0a428d4 authored by Robert Bradshaw's avatar Robert Bradshaw

Included files dependency fix in cythonize.

parent 3d6d9687
...@@ -330,7 +330,7 @@ class DependencyTree(object): ...@@ -330,7 +330,7 @@ class DependencyTree(object):
@cached_method @cached_method
def included_files(self, filename): def included_files(self, filename):
# This is messy because included files are textually included, resolving # This is messy because included files are textually included, resolving
# cimports (and other includes) relative to the including file. # cimports (but not includes) relative to the including file.
all = set() all = set()
for include in self.parse_dependencies(filename)[1]: for include in self.parse_dependencies(filename)[1]:
include_path = join_path(os.path.dirname(filename), include) include_path = join_path(os.path.dirname(filename), include)
...@@ -340,20 +340,22 @@ class DependencyTree(object): ...@@ -340,20 +340,22 @@ class DependencyTree(object):
if '.' + os.path.sep in include_path: if '.' + os.path.sep in include_path:
include_path = os.path.normpath(include_path) include_path = os.path.normpath(include_path)
all.add(include_path) all.add(include_path)
all.update(self.included_files(include_path))
else: else:
print("Unable to locate '%s' referenced from '%s'" % (filename, include)) print("Unable to locate '%s' referenced from '%s'" % (filename, include))
return all return all
@cached_method @cached_method
def cimports_and_externs(self, filename): def cimports_and_externs(self, filename):
# This is really ugly. Nested cimports are resolved with respect to the
# includer, but includes are resolved with respect to the includee.
cimports, includes, externs = self.parse_dependencies(filename)[:3] cimports, includes, externs = self.parse_dependencies(filename)[:3]
cimports = set(cimports) cimports = set(cimports)
externs = set(externs) externs = set(externs)
for include in self.included_files(filename): for include in self.included_files(filename):
# include file recursion resolved by self.included_files(source_filename) included_cimports, included_externs = self.cimports_and_externs(include)
deps = self.parse_dependencies(filename) cimports.update(included_cimports)
cimports.update(deps[0]) externs.update(included_externs)
externs.update(deps[2])
return tuple(cimports), normalize_existing(filename, externs) return tuple(cimports), normalize_existing(filename, externs)
def cimports(self, filename): def cimports(self, filename):
......
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