diff options
author | Guido van Rossum <guido@python.org> | 1998-03-05 04:56:37 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-03-05 04:56:37 (GMT) |
commit | 912a14c0287aff5014d14dd4dd228c4032465374 (patch) | |
tree | a1f286376e18e925f33e9accb326f34a8eef56a9 /Tools/freeze/makefreeze.py | |
parent | 1e07403bbf47e7198a735a901598cbc1eedd607f (diff) | |
download | cpython-912a14c0287aff5014d14dd4dd228c4032465374.zip cpython-912a14c0287aff5014d14dd4dd228c4032465374.tar.gz cpython-912a14c0287aff5014d14dd4dd228c4032465374.tar.bz2 |
Reindented, removed tabs.
Diffstat (limited to 'Tools/freeze/makefreeze.py')
-rw-r--r-- | Tools/freeze/makefreeze.py | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/Tools/freeze/makefreeze.py b/Tools/freeze/makefreeze.py index 97315b3..88265b0 100644 --- a/Tools/freeze/makefreeze.py +++ b/Tools/freeze/makefreeze.py @@ -10,52 +10,56 @@ header = """ static struct _frozen _PyImport_FrozenModules[] = { """ trailer = """\ - {0, 0, 0} /* sentinel */ + {0, 0, 0} /* sentinel */ }; int main(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { - PyImport_FrozenModules = _PyImport_FrozenModules; - return Py_FrozenMain(argc, argv); + PyImport_FrozenModules = _PyImport_FrozenModules; + return Py_FrozenMain(argc, argv); } """ def makefreeze(outfp, dict, debug=0): - done = [] - mods = dict.keys() - mods.sort() - for mod in mods: - m = dict[mod] - mangled = string.join(string.split(mod, "."), "__") - if m.__code__: - if debug: - print "freezing", mod, "..." - str = marshal.dumps(m.__code__) - size = len(str) - if m.__path__: - # Indicate package by negative size - size = -size - done.append((mod, mangled, size)) - writecode(outfp, mangled, str) - if debug: - print "generating table of frozen modules" - outfp.write(header) - for mod, mangled, size in done: - outfp.write('\t{"%s", M_%s, %d},\n' % (mod, mangled, size)) - outfp.write(trailer) + done = [] + mods = dict.keys() + mods.sort() + for mod in mods: + m = dict[mod] + mangled = string.join(string.split(mod, "."), "__") + if m.__code__: + if debug: + print "freezing", mod, "..." + str = marshal.dumps(m.__code__) + size = len(str) + if m.__path__: + # Indicate package by negative size + size = -size + done.append((mod, mangled, size)) + writecode(outfp, mangled, str) + if debug: + print "generating table of frozen modules" + outfp.write(header) + for mod, mangled, size in done: + outfp.write('\t{"%s", M_%s, %d},\n' % (mod, mangled, size)) + outfp.write(trailer) # Write a C initializer for a module containing the frozen python code. # The array is called M_<mod>. def writecode(outfp, mod, str): - outfp.write('static unsigned char M_%s[] = {' % mod) - for i in range(0, len(str), 16): - outfp.write('\n\t') - for c in str[i:i+16]: - outfp.write('%d,' % ord(c)) - outfp.write('\n};\n') + outfp.write('static unsigned char M_%s[] = {' % mod) + for i in range(0, len(str), 16): + outfp.write('\n\t') + for c in str[i:i+16]: + outfp.write('%d,' % ord(c)) + outfp.write('\n};\n') + +# Local Variables: +# indent-tabs-mode: nil +# End: |