1 |
commit: e8da78af846bac21363c85d4bee5d938844843be |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Oct 28 20:13:07 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 28 20:13:07 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e8da78af |
7 |
|
8 |
Check for bytes instead of unicode in args. |
9 |
|
10 |
This simplifies the checks since the bytes type is available in all |
11 |
supported python versions, while the unicode type is only available in |
12 |
python2. |
13 |
|
14 |
--- |
15 |
bin/lock-helper.py | 4 ++-- |
16 |
bin/portageq | 2 +- |
17 |
pym/_emerge/main.py | 3 +-- |
18 |
3 files changed, 4 insertions(+), 5 deletions(-) |
19 |
|
20 |
diff --git a/bin/lock-helper.py b/bin/lock-helper.py |
21 |
index 5f3ea9f..065ddcb 100755 |
22 |
--- a/bin/lock-helper.py |
23 |
+++ b/bin/lock-helper.py |
24 |
@@ -1,5 +1,5 @@ |
25 |
#!/usr/bin/python |
26 |
-# Copyright 2010 Gentoo Foundation |
27 |
+# Copyright 2010-2011 Gentoo Foundation |
28 |
# Distributed under the terms of the GNU General Public License v2 |
29 |
|
30 |
import os |
31 |
@@ -9,7 +9,7 @@ import portage |
32 |
|
33 |
def main(args): |
34 |
|
35 |
- if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode): |
36 |
+ if args and isinstance(args[0], bytes): |
37 |
for i, x in enumerate(args): |
38 |
args[i] = portage._unicode_decode(x, errors='strict') |
39 |
|
40 |
|
41 |
diff --git a/bin/portageq b/bin/portageq |
42 |
index 02f1904..40cc21d 100755 |
43 |
--- a/bin/portageq |
44 |
+++ b/bin/portageq |
45 |
@@ -847,7 +847,7 @@ def main(): |
46 |
os.environ["ROOT"] = root |
47 |
|
48 |
args = sys.argv[2:] |
49 |
- if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode): |
50 |
+ if args and isinstance(args[0], bytes): |
51 |
for i in range(len(args)): |
52 |
args[i] = portage._unicode_decode(args[i]) |
53 |
|
54 |
|
55 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
56 |
index 0dfc5f9..162f70f 100644 |
57 |
--- a/pym/_emerge/main.py |
58 |
+++ b/pym/_emerge/main.py |
59 |
@@ -1233,8 +1233,7 @@ def parse_opts(tmpcmdline, silent=False): |
60 |
if myaction is None and myoptions.deselect is True: |
61 |
myaction = 'deselect' |
62 |
|
63 |
- if myargs and sys.hexversion < 0x3000000 and \ |
64 |
- not isinstance(myargs[0], unicode): |
65 |
+ if myargs and isinstance(myargs[0], bytes): |
66 |
for i in range(len(myargs)): |
67 |
myargs[i] = portage._unicode_decode(myargs[i]) |