sandbox.run_setup incorrectly sets `__file__` when setup_script is Unicode on Python 2 #712
Comments
From distutils PoV, it received a list of unicode string instead of a list of str string. Cython provides a list str string to setuptools. So I suspect setuptools to convert the list from str to unicode and breaks Cython build. |
After more testing the regression have been introduced by 25.1.2. |
This have been introduced by 8579495 |
This reverts commit 8579495. As we can see on pypa#709, this breaks many things (easy_install C extensions, all py3.5 tests, run with LANG=C). So instead of fixing in a hurry all new bugs due to this, I propose to revert this commit until all downsides of this change have been investigated. Related bug: pypa#709 Related bug: pypa#710 Related bug: pypa#712
Hi. Same problem here. On Windows x64, Python 2.7. I note that the last project release i named 25.1.2 instead of v25.1.2. Maybe this last version (without the v) fix the problem? Yet, i dont try. |
Not the same exact error, but similar for me with v25.1.2. This happens when we setup a virtualenv, which grabs the latest setuptools. The error is related to Unicode in a dependent package:
We're doing |
I traced the issue in the OP, and it seems to me here's what's happening:
Presumably, this issue might also occur if distutils were invoked from a directory containing non-ascii characters. I'll test that theory. |
On my mac, here's what I get:
On my Windows box, I see this instead:
In both cases, it seems Python is setting Encoding with
|
Hi,
Since setuptools 25.X, we can't build Cython if present in setup_requires list.
that works on py3 or with setuptool 24.X but not with setuptool 25.X and py2:
To reproduce you can do:
$ virtualenv venv
$ venv/bin/easy_install Cython
New python executable in /tmp/cdt.oxE640oU/venv/bin/python
Installing setuptools, pip, wheel...done.
Searching for Cython
Reading https://pypi.python.org/simple/Cython/
Downloading https://pypi.python.org/packages/c6/fe/97319581905de40f1be7015a0ea1bd336a756f6249914b148a17eefa75dc/Cython-0.24.1.tar.gz#md5=890b494a12951f1d6228c416a5789554
Best match: Cython 0.24.1
Processing Cython-0.24.1.tar.gz
Writing /tmp/easy_install-rWIiof/Cython-0.24.1/setup.cfg
Running Cython-0.24.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-rWIiof/Cython-0.24.1/egg-dist-tmp-8xzUmf
Unable to find pgen, not compiling formal grammar.
Traceback (most recent call last):
File "venv/bin/easy_install", line 11, in
sys.exit(main())
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 2271, in main
**kw
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 409, in run
self.easy_install(spec, not self.no_deps)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 664, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 694, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 875, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1114, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1100, in run_setup
run_setup(setup_script, args)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 249, in run_setup
raise
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 197, in setup_context
yield
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 168, in save_modules
saved_exc.resume()
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 143, in resume
six.reraise(type, exc, self._tb)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 156, in save_modules
yield saved
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 197, in setup_context
yield
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 246, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 276, in run
return func()
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 245, in runner
_execfile(setup_script, ns)
File "/tmp/cdt.oxE640oU/venv/local/lib/python2.7/site-packages/setuptools/sandbox.py", line 47, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-rWIiof/Cython-0.24.1/setup.py", line 238, in
File "/tmp/easy_install-rWIiof/Cython-0.24.1/setup.py", line 166, in compile_cython_modules
File "/usr/lib/python2.7/distutils/extension.py", line 109, in init
"'sources' must be a list of strings"
AssertionError: 'sources' must be a list of strings
Cheers,
The text was updated successfully, but these errors were encountered: