Skip to content

Commit fc676e1

Browse files
committed
Ensure package name isn't unicode in Python2 distutils
Problem encountered on Ubuntu 14.04 Fixes pypa#190 If people need to fix this without this patch, they have to wrap their package names in `str()` like so: ```python #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals setup( # .... package_dir=[ str('package_name'), ] ) ```
1 parent 5675cdd commit fc676e1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

setuptools/command/build_py.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import distutils.errors
99
import itertools
1010

11+
from setuptools.extern.six import string_types
1112
from setuptools.extern.six.moves import map, filter, filterfalse
1213

1314
try:
@@ -66,6 +67,10 @@ def __getattr__(self, attr):
6667
return orig.build_py.__getattr__(self, attr)
6768

6869
def build_module(self, module, module_file, package):
70+
# Ensure that package names are strings in case an ancient distutils
71+
# library is called
72+
if isinstance(package, string_types):
73+
package = str(package)
6974
outfile, copied = orig.build_py.build_module(self, module, module_file,
7075
package)
7176
if copied:

0 commit comments

Comments
 (0)