diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index 758a3fdfe8c..1b0daff728f 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -8,6 +8,7 @@ import distutils.errors import itertools +from setuptools.extern.six import string_types from setuptools.extern.six.moves import map, filter, filterfalse try: @@ -66,6 +67,10 @@ def __getattr__(self, attr): return orig.build_py.__getattr__(self, attr) def build_module(self, module, module_file, package): + # Ensure that package names are strings in case an ancient distutils + # library is called + if isinstance(package, string_types): + package = str(package) outfile, copied = orig.build_py.build_module(self, module, module_file, package) if copied: