diff options
author | 2010-12-10 00:09:17 -0200 | |
---|---|---|
committer | 2010-12-10 00:09:17 -0200 | |
commit | 6a2dbc6debdffdd8ff179cc12b955e8ea295505b (patch) | |
tree | 36278b4a29660d57bf5ebc3e44d0b4930ae0888e | |
parent | fixed a bunch of tests (diff) | |
download | g-octave-6a2dbc6debdffdd8ff179cc12b955e8ea295505b.tar.gz g-octave-6a2dbc6debdffdd8ff179cc12b955e8ea295505b.tar.bz2 g-octave-6a2dbc6debdffdd8ff179cc12b955e8ea295505b.zip |
encoding fixes
-rw-r--r-- | g_octave/checksum.py | 7 | ||||
-rw-r--r-- | g_octave/description.py | 4 | ||||
-rw-r--r-- | g_octave/fetch.py | 2 | ||||
-rwxr-xr-x | scripts/g-octave | 2 |
4 files changed, 7 insertions, 8 deletions
diff --git a/g_octave/checksum.py b/g_octave/checksum.py index 22e47d2..13be7ad 100644 --- a/g_octave/checksum.py +++ b/g_octave/checksum.py @@ -29,11 +29,8 @@ config = Config() def sha1_compute(filename): - with open(filename) as fp: - content = fp.read() - if py3k: - content = bytes(content, 'utf-8') - return sha1(content).hexdigest() + with open(filename, 'rb') as fp: + return sha1(fp.read()).hexdigest() def sha1_check(db, p): description = db[p] diff --git a/g_octave/description.py b/g_octave/description.py index 96825fb..dde116d 100644 --- a/g_octave/description.py +++ b/g_octave/description.py @@ -72,8 +72,10 @@ class Description(object): # current key key = None - with open(file, 'r') as fp: + with open(file, 'rb') as fp: for line in fp: + + line = line.decode('iso-8859-15') line_splited = line.split(':') # 'key: value' found? diff --git a/g_octave/fetch.py b/g_octave/fetch.py index a78ed4b..0a35852 100644 --- a/g_octave/fetch.py +++ b/g_octave/fetch.py @@ -72,7 +72,7 @@ class GitHub: ) commits = {} with closing(urllib.urlopen(url)) as fp: - commits = json.load(fp) + commits = json.loads(fp.read().decode('utf-8')) return commits['commits'] def fetch_db(self, branch='master'): diff --git a/scripts/g-octave b/scripts/g-octave index 8951f43..876bcf7 100755 --- a/scripts/g-octave +++ b/scripts/g-octave @@ -285,7 +285,7 @@ def main(): updates.extract() log.info('Checking SHA1 checksums ...') - out.ebegin('Checking SHA1 checksums ...') + out.ebegin('Checking SHA1 checksums') if sha1_check_db(DescriptionTree()): out.eend(0) else: |