This simplifies the checks since the bytes type is available in all
supported python versions, while the unicode type is only available in
python2.
#!/usr/bin/python
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import os
def main(args):
- if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode):
+ if args and isinstance(args[0], bytes):
for i, x in enumerate(args):
args[i] = portage._unicode_decode(x, errors='strict')
os.environ["ROOT"] = root
args = sys.argv[2:]
- if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode):
+ if args and isinstance(args[0], bytes):
for i in range(len(args)):
args[i] = portage._unicode_decode(args[i])
if myaction is None and myoptions.deselect is True:
myaction = 'deselect'
- if myargs and sys.hexversion < 0x3000000 and \
- not isinstance(myargs[0], unicode):
+ if myargs and isinstance(myargs[0], bytes):
for i in range(len(myargs)):
myargs[i] = portage._unicode_decode(myargs[i])