Commit 1319d728 authored by Martin v. Löwis's avatar Martin v. Löwis

Revert previous change: _get gives bytes in 3.x.

Instead, have get_metadata decode from utf-8.

--HG--
branch : distribute
extra : rebase_source : 6050e699017705a297d45334e985978535fd245f
parent 0fb87f9b
...@@ -1126,10 +1126,16 @@ class NullProvider: ...@@ -1126,10 +1126,16 @@ class NullProvider:
def has_metadata(self, name): def has_metadata(self, name):
return self.egg_info and self._has(self._fn(self.egg_info,name)) return self.egg_info and self._has(self._fn(self.egg_info,name))
if sys.version_info <= (3,):
def get_metadata(self, name): def get_metadata(self, name):
if not self.egg_info: if not self.egg_info:
return "" return ""
return self._get(self._fn(self.egg_info,name)) return self._get(self._fn(self.egg_info,name))
else:
def get_metadata(self, name):
if not self.egg_info:
return ""
return self._get(self._fn(self.egg_info,name)).decode("utf-8")
def get_metadata_lines(self, name): def get_metadata_lines(self, name):
return yield_lines(self.get_metadata(name)) return yield_lines(self.get_metadata(name))
...@@ -1239,7 +1245,7 @@ class DefaultProvider(EggProvider): ...@@ -1239,7 +1245,7 @@ class DefaultProvider(EggProvider):
return open(self._fn(self.module_path, resource_name), 'rb') return open(self._fn(self.module_path, resource_name), 'rb')
def _get(self, path): def _get(self, path):
stream = open(path, 'rU') stream = open(path, 'rb')
try: try:
return stream.read() return stream.read()
finally: finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment