diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-12-01 13:45:58 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-12-01 13:45:58 +0100 |
| commit | fb595849bc7149619b3e47b65f145a1f66fc7dbe (patch) | |
| tree | 51c92230c4d404e24a6adca1178a65c4d0297b73 /apt | |
| parent | c8bfdda85fbd2df250fbc6d3faeb2bd5875a77d6 (diff) | |
| download | python-apt-fb595849bc7149619b3e47b65f145a1f66fc7dbe.tar.gz | |
fix debfile binary test for py3
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/debfile.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apt/debfile.py b/apt/debfile.py index 104b0814..4a82842a 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -525,12 +525,19 @@ class DebPackage(object): @staticmethod def to_strish(in_data): + # helper for py3 compat, in_data is str in py2 and bytes in py3 + def my_ord(c): + if type(c) == int: + return c + else: + return ord(c) + # convert s = "" for c in in_data: - if ord(c) < 10 or ord(c) > 127: + if my_ord(c) < 10 or my_ord(c) > 127: s += " " else: - s += c + s += chr(c) return s def _get_content(self, part, name, auto_decompress=True, auto_hex=True): |
