1 |
Author: zmedico |
2 |
Date: 2009-02-28 08:27:56 +0000 (Sat, 28 Feb 2009) |
3 |
New Revision: 12733 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/repoman |
7 |
Log: |
8 |
When checking ebuild content, use codecs.open() to force utf_8 encoding for |
9 |
py3k compatibility (all ebuilds should have utf_8 encoding). |
10 |
|
11 |
|
12 |
Modified: main/trunk/bin/repoman |
13 |
=================================================================== |
14 |
--- main/trunk/bin/repoman 2009-02-28 05:43:29 UTC (rev 12732) |
15 |
+++ main/trunk/bin/repoman 2009-02-28 08:27:56 UTC (rev 12733) |
16 |
@@ -1444,14 +1444,18 @@ |
17 |
# Syntax Checks |
18 |
relative_path = os.path.join(x, y + ".ebuild") |
19 |
full_path = os.path.join(repodir, relative_path) |
20 |
- f = open(full_path) |
21 |
try: |
22 |
- for check_name, e in run_checks(f, pkg): |
23 |
- stats[check_name] += 1 |
24 |
- fails[check_name].append(relative_path + ': %s' % e) |
25 |
- finally: |
26 |
- f.close() |
27 |
- del f |
28 |
+ # All ebuilds should have utf_8 encoding. |
29 |
+ f = codecs.open(full_path, mode='r', encoding='utf_8') |
30 |
+ try: |
31 |
+ for check_name, e in run_checks(f, pkg): |
32 |
+ stats[check_name] += 1 |
33 |
+ fails[check_name].append(relative_path + ': %s' % e) |
34 |
+ finally: |
35 |
+ f.close() |
36 |
+ except UnicodeDecodeError: |
37 |
+ # A file.UTF8 failure will have already been recorded above. |
38 |
+ pass |
39 |
|
40 |
if options.force: |
41 |
# The dep_check() calls are the most expensive QA test. If --force |