diff options
Diffstat (limited to 'pym/portage/manifest.py')
-rw-r--r-- | pym/portage/manifest.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py index b2f1ff2dc..25886bb1e 100644 --- a/pym/portage/manifest.py +++ b/pym/portage/manifest.py @@ -4,6 +4,7 @@ import errno import io import re +import sys import warnings import portage @@ -24,6 +25,11 @@ from portage.const import (MANIFEST1_HASH_FUNCTIONS, MANIFEST2_HASH_DEFAULTS, MANIFEST2_HASH_FUNCTIONS, MANIFEST2_IDENTIFIERS, MANIFEST2_REQUIRED_HASH) from portage.localization import _ +if sys.hexversion >= 0x3000000: + _unicode = str +else: + _unicode = unicode + # Characters prohibited by repoman's file.name check. _prohibited_filename_chars_re = re.compile(r'[^a-zA-Z0-9._\-+:]') @@ -108,6 +114,14 @@ class Manifest2Entry(ManifestEntry): def __ne__(self, other): return not self.__eq__(other) + if sys.hexversion < 0x3000000: + + __unicode__ = __str__ + + def __str__(self): + return _unicode_encode(self.__unicode__(), + encoding=_encodings['repo.content'], errors='strict') + class Manifest(object): parsers = (parseManifest2,) def __init__(self, pkgdir, distdir, fetchlist_dict=None, @@ -289,7 +303,7 @@ class Manifest(object): # thin manifests with no DIST entries, myentries is # non-empty for all currently known use cases. write_atomic(self.getFullname(), "".join("%s\n" % - str(myentry) for myentry in myentries)) + _unicode(myentry) for myentry in myentries)) else: # With thin manifest, there's no need to have # a Manifest file if there are no DIST entries. |