diff options
Diffstat (limited to 'mirrorselect/main.py')
-rwxr-xr-x | mirrorselect/main.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 528f383..55c1cb0 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -56,6 +56,12 @@ if "GENTOO_PORTAGE_EPREFIX" in EPREFIX: EPREFIX = '' +if sys.hexversion >= 0x3000000: + _unicode = str +else: + _unicode = unicode + + class MirrorSelect(object): '''Main operational class''' @@ -100,6 +106,9 @@ class MirrorSelect(object): else: var = 'GENTOO_MIRRORS' + if hasattr(hosts[0], 'decode'): + hosts = [x.decode('utf-8') for x in hosts] + mirror_string = '%s="%s"' % (var, ' '.join(hosts)) if out: @@ -127,7 +136,9 @@ class MirrorSelect(object): lines.append(mirror_string) self.output.write('\tWriting new %s\n' % config_path) + config = open(config_path, 'w') + for line in lines: config.write(line) config.write('\n') |