diff options
author | Guido van Rossum <guido@python.org> | 2007-06-12 00:28:30 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-06-12 00:28:30 (GMT) |
commit | 5397039504fa45f7a41b8afe5f0cb485ad4dbcf1 (patch) | |
tree | e5b8d338ccca2ffe33bd31d793d31536997d463d /Tools/freeze | |
parent | 0aa35f8709fa5c182254487c609ac4a3ba929ba6 (diff) | |
download | cpython-5397039504fa45f7a41b8afe5f0cb485ad4dbcf1.zip cpython-5397039504fa45f7a41b8afe5f0cb485ad4dbcf1.tar.gz cpython-5397039504fa45f7a41b8afe5f0cb485ad4dbcf1.tar.bz2 |
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/freeze')
-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 c67a6c4..0e895f2 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 93b1abc..80db69e 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 e359db9..4cd1e96 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 ff8b15a..32e804c 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 ae0bc43..1588476 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)) |