diff options
author | Guido van Rossum <guido@python.org> | 2007-06-12 00:28:30 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-06-12 00:28:30 +0000 |
commit | 05f66a9117bec0081305433b6ff7f5738bd592bc (patch) | |
tree | b36d086f98ba230a4ff64e943e2ed36be5ab1167 /Tools | |
parent | 96c56ecccca9fcc0750e6095ad876d7b674c7bc2 (diff) | |
download | cpython-05f66a9117bec0081305433b6ff7f5738bd592bc.tar.gz |
Minimal changes to make the "freeze" tool work again.
There are other issues left, but these were basics (e.g. keys().sort()).
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/freeze/bkfile.py | 5 | ||||
-rwxr-xr-x | Tools/freeze/freeze.py | 3 | ||||
-rw-r--r-- | Tools/freeze/makefreeze.py | 7 | ||||
-rw-r--r-- | Tools/freeze/makemakefile.py | 3 | ||||
-rw-r--r-- | Tools/freeze/parsesetup.py | 3 |
5 files changed, 10 insertions, 11 deletions
diff --git a/Tools/freeze/bkfile.py b/Tools/freeze/bkfile.py index c67a6c415a..0e895f2816 100644 --- a/Tools/freeze/bkfile.py +++ b/Tools/freeze/bkfile.py @@ -21,7 +21,10 @@ class _BkFile: self.mode = self.__file.mode self.name = self.__file.name self.read = self.__file.read - self.readinto = self.__file.readinto + try: + self.readinto = self.__file.readinto + except AttributeError: + pass self.readline = self.__file.readline self.readlines = self.__file.readlines self.seek = self.__file.seek diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py index 93b1abc3b7..80db69ea1d 100755 --- a/Tools/freeze/freeze.py +++ b/Tools/freeze/freeze.py @@ -386,8 +386,7 @@ def main(): # look for unfrozen modules (builtin and of unknown origin) builtins = [] unknown = [] - mods = dict.keys() - mods.sort() + mods = sorted(dict.keys()) for mod in mods: if dict[mod].__code__: continue diff --git a/Tools/freeze/makefreeze.py b/Tools/freeze/makefreeze.py index e359db95d2..4cd1e96990 100644 --- a/Tools/freeze/makefreeze.py +++ b/Tools/freeze/makefreeze.py @@ -33,8 +33,7 @@ def makefreeze(base, dict, debug=0, entry_point=None, fail_import=()): if entry_point is None: entry_point = default_entry_point done = [] files = [] - mods = dict.keys() - mods.sort() + mods = sorted(dict.keys()) for mod in mods: m = dict[mod] mangled = "__".join(mod.split(".")) @@ -81,8 +80,8 @@ def writecode(outfp, mod, str): outfp.write('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)) + for c in bytes(str[i:i+16]): + outfp.write('%d,' % c) outfp.write('\n};\n') ## def writecode(outfp, mod, str): diff --git a/Tools/freeze/makemakefile.py b/Tools/freeze/makemakefile.py index ff8b15a199..32e804c551 100644 --- a/Tools/freeze/makemakefile.py +++ b/Tools/freeze/makemakefile.py @@ -5,8 +5,7 @@ import os def makemakefile(outfp, makevars, files, target): outfp.write("# Makefile generated by freeze.py script\n\n") - keys = makevars.keys() - keys.sort() + keys = sorted(makevars.keys()) for key in keys: outfp.write("%s=%s\n" % (key, makevars[key])) outfp.write("\nall: %s\n\n" % target) diff --git a/Tools/freeze/parsesetup.py b/Tools/freeze/parsesetup.py index ae0bc43d57..158847614d 100644 --- a/Tools/freeze/parsesetup.py +++ b/Tools/freeze/parsesetup.py @@ -102,8 +102,7 @@ def test(): print('(name must begin with "Makefile" or "Setup")') def prdict(d): - keys = d.keys() - keys.sort() + keys = sorted(d.keys()) for key in keys: value = d[key] print("%-15s" % key, str(value)) |