Skip to content

Commit

Permalink
unicode fixes for entry points on py3
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Feb 4, 2017
1 parent 09cb6d6 commit d762557
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions conda_build/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ def convert(package_file, output_dir=".", show_imports=False, platforms=None, fo
"""Convert changes a package from one platform to another. It applies only to things that are
portable, such as pure python, or header-only C/C++ libraries."""
from .convert import conda_convert
if not platforms:
platforms = []
platforms = _ensure_list(platforms)
if package_file.endswith('tar.bz2'):
return conda_convert(package_file, output_dir=output_dir, show_imports=show_imports,
platforms=platforms, force=force, verbose=verbose, quiet=quiet,
Expand Down
11 changes: 8 additions & 3 deletions conda_build/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ def get_pure_py_file_map(t, platform):
pathmember = None

# is None when info/has_prefix does not exist
has_prefix_files = t.extractfile("info/has_prefix").read()
has_prefix_files = None
if 'info/has_prefix' in t.getnames():
has_prefix_files = t.extractfile("info/has_prefix").read().decode()
if has_prefix_files:
fieldnames = ['prefix', 'type', 'path']
csv_dialect = csv.Sniffer().sniff(has_prefix_files)
Expand Down Expand Up @@ -369,8 +371,11 @@ def get_pure_py_file_map(t, platform):
writer = csv.DictWriter(output, fieldnames=fieldnames, dialect=csv_dialect)
writer.writerows(has_prefix_files.values())
member = t.getmember('info/has_prefix')
member.size = len(output.getvalue())
file_map['info/has_prefix'] = member, bytes_io(output.getvalue())
output_val = output.getvalue()
if hasattr(output_val, 'encode'):
output_val = output_val.encode()
member.size = len(output_val)
file_map['info/has_prefix'] = member, bytes_io(output_val)

return file_map

Expand Down

0 comments on commit d762557

Please sign in to comment.