1.1 --- a/generator.py Fri Dec 09 00:09:01 2016 +0100
1.2 +++ b/generator.py Fri Dec 09 16:22:37 2016 +0100
1.3 @@ -31,7 +31,7 @@
1.4 encode_symbol, encode_tablename, \
1.5 encode_type_attribute, decode_type_attribute, \
1.6 is_type_attribute
1.7 -from os import listdir
1.8 +from os import listdir, mkdir
1.9 from os.path import exists, isdir, join, split
1.10 from referencing import Reference
1.11
1.12 @@ -111,7 +111,23 @@
1.13 if debug and exists(join(templates, "%s-debug" % filename)):
1.14 continue
1.15
1.16 - copy(join(templates, filename), target)
1.17 + pathname = join(templates, filename)
1.18 +
1.19 + # Copy files into the target directory.
1.20 +
1.21 + if not isdir(pathname):
1.22 + copy(pathname, target)
1.23 +
1.24 + # Copy directories (such as the native code directory).
1.25 +
1.26 + else:
1.27 + target = join(self.output, filename)
1.28 +
1.29 + if not exists(target):
1.30 + mkdir(target)
1.31 +
1.32 + for filename in listdir(pathname):
1.33 + copy(join(pathname, filename), target)
1.34
1.35 def write_structures(self):
1.36
1.37 @@ -964,9 +980,11 @@
1.38 function_name = "__main_%s" % encode_path(name)
1.39 print >>f_signatures, "void %s();" % function_name
1.40
1.41 - # Omit the native module.
1.42 + # Omit the native modules.
1.43
1.44 - if name != "native":
1.45 + parts = name.split(".")
1.46 +
1.47 + if parts[0] != "native":
1.48 print >>f_code, """\
1.49 %s();""" % function_name
1.50