[Distutils] [issue152] setuptools breaks with from __future__ import unicode_literals in setup.py

mbogosian setuptools at bugs.python.org
Sat Jul 6 08:52:05 CEST 2013


New submission from mbogosian:

unicode_literals break a bunch of stuff in setuptools. Considering they may become the default at some point, this should be fixed...? I do not know if this is related to issue 78.

To reproduce, run the attached setup.py (output below). Comment out the unicode_literals line in setup.py and try it again (everything should work).

% DISTUTILS_DEBUG=t python -c 'import setuptools ; print setuptools.__version__'
0.8
% unzip -d foo_test.zip ; cd foo_test
...
% DISTUTILS_DEBUG=t python setup.py build
options (after parsing config files):
options (after parsing command line):
option dict for 'aliases' command:
  {}
option dict for 'build' command:
  {}
option dict for 'nosetests' command:
  {'all_modules': ('setup.cfg', '1'),
   'cover_package': ('setup.cfg', 'foo'),
   'detailed_errors': ('setup.cfg', '1'),
   'verbosity': ('setup.cfg', '2'),
   'with_coverage': ('setup.cfg', '1'),
   'with_doctest': ('setup.cfg', '1')}
running build
Distribution.get_command_obj(): creating 'build' command object
running build_py
Distribution.get_command_obj(): creating 'build_py' command object
Traceback (most recent call last):
  File "setup.py", line 58, in <module>
    setuptools.setup(**_SETUP_ARGS)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/build_py.py", line 89, in run
    self.build_packages()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py", line 372, in build_packages
    self.build_module(module, module_file, package)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/build_py.py", line 106, in build_module
    outfile, copied = _build_py.build_module(self, module, module_file, package)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_py.py", line 333, in build_module
    "'package' must be a string (dot-separated), list, or tuple")
TypeError: 'package' must be a string (dot-separated), list, or tuple
% DISTUTILS_DEBUG=t python setup.py nosetests
options (after parsing config files):
options (after parsing command line):
option dict for 'aliases' command:
  {}
option dict for 'nosetests' command:
  {'all_modules': ('setup.cfg', '1'),
   'cover_package': ('setup.cfg', 'foo'),
   'detailed_errors': ('setup.cfg', '1'),
   'verbosity': ('setup.cfg', '2'),
   'with_coverage': ('setup.cfg', '1'),
   'with_doctest': ('setup.cfg', '1')}
running nosetests
Distribution.get_command_obj(): creating 'nosetests' command object
  setting options for 'nosetests' command:
    with_coverage = 1 (from setup.cfg)
    verbosity = 2 (from setup.cfg)
    cover_package = foo (from setup.cfg)
    all_modules = 1 (from setup.cfg)
    with_doctest = 1 (from setup.cfg)
    detailed_errors = 1 (from setup.cfg)
running egg_info
Distribution.get_command_obj(): creating 'egg_info' command object
Traceback (most recent call last):
  File "setup.py", line 58, in <module>
    setuptools.setup(**_SETUP_ARGS)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/commands.py", line 132, in run
    self.run_command('egg_info')
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 971, in run_command
    cmd_obj.ensure_finalized()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 103, in finalize_options
    self.ensure_dirname('egg_base')
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 269, in ensure_dirname
    "'%s' does not exist or is not a directory")
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 255, in _ensure_tested_string
    val = self._ensure_stringlike(option, what, default)
  File ".../Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 216, in _ensure_stringlike
    "'%s' must be a %s (got `%s`)" % (option, what, val)
distutils.errors.DistutilsOptionError: 'egg_base' must be a directory name (got `src`)
% ... # Comment out unicode_literals line in setup.py
% python setup.py nosetests
running nosetests
running egg_info
writing src/foo.egg-info/PKG-INFO
writing namespace_packages to src/foo.egg-info/namespace_packages.txt
writing top-level names to src/foo.egg-info/top_level.txt
writing dependency_links to src/foo.egg-info/dependency_links.txt
reading manifest file 'src/foo.egg-info/SOURCES.txt'
writing manifest file 'src/foo.egg-info/SOURCES.txt'
running build_ext
Doctest: foo.base.pity.Foo ... ok
testFoo (test.base.pity.TestFoo) ... ok

Name            Stmts   Miss  Cover   Missing
---------------------------------------------
foo                 3      0   100%
foo.base            0      0   100%
foo.base.pity       9      0   100%
---------------------------------------------
TOTAL              12      0   100%
----------------------------------------------------------------------
Ran 2 tests in 0.034s

OK

----------
files: foo_test.zip
messages: 724
nosy: mbogosian
priority: bug
status: unread
title: setuptools breaks with from __future__ import unicode_literals in setup.py
Added file: http://bugs.python.org/setuptools/file92/foo_test.zip

_______________________________________________
Setuptools tracker <setuptools at bugs.python.org>
<http://bugs.python.org/setuptools/issue152>
_______________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo_test.zip
Type: application/zip
Size: 4252 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130706/eb1b6e95/attachment.zip>


More information about the Distutils-SIG mailing list