Commit 3d0f134c authored by Kirill Smelkov's avatar Kirill Smelkov

setup: Fix sdist/egg_info/... on Python3

Arnaud reports that wendelin.core currently cannot be installed on
Python3:

    /opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/python3/bin/python3 /tmp/tmp1fuxchsb -q develop -mN -d /opt/slapgrid/3f9add9291086dee302fc478df4b3130/develop-eggs/tmps5jr7ymsbuild
    /opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/dist.py:476: UserWarning: Normalizing '2.0.alpha2.post1' to '2.0a2.post1'
    package init file '__init__.py' not found (or not a regular file)
    Traceback (most recent call last):
     File "/tmp/tmp1fuxchsb", line 19, in <module>
       exec(compile(f.read(), '/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/wendelin.core/setup.py', 'exec'))
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/wendelin.core/setup.py", line 426, in <module>
       """.splitlines()]
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/develop-eggs/pygolang-0.1-py3.7-linux-x86_64.egg/golang/pyx/build.py", line 118, in setup
       setuptools_dso.setup(**kw)
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools_dso-1.7-py3.7.egg/setuptools_dso/__init__.py", line 37, in setup
       _setup(**kws)
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/__init__.py", line 162, in setup
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/python3/lib/python3.7/distutils/core.py", line 148, in setup
       dist.run_commands()
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/python3/lib/python3.7/distutils/dist.py", line 966, in run_commands
       self.run_command(cmd)
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/python3/lib/python3.7/distutils/dist.py", line 985, in run_command
       cmd_obj.run()
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/develop.py", line 38, in run
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/develop.py", line 136, in install_for_development
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/python3/lib/python3.7/distutils/cmd.py", line 313, in run_command
       self.distribution.run_command(command)
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/parts/python3/lib/python3.7/distutils/dist.py", line 985, in run_command
       cmd_obj.run()
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/egg_info.py", line 296, in run
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/egg_info.py", line 303, in find_sources
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/egg_info.py", line 537, in run
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/egg_info.py", line 591, in prune_file_list
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/egg_info.py", line 452, in prune
     File "/opt/slapgrid/3f9add9291086dee302fc478df4b3130/eggs/setuptools-44.1.1-py3.7.egg/setuptools/command/egg_info.py", line 405, in _remove_files
    TypeError: cannot use a string pattern on a bytes-like object
    While:
     Installing wendelin.core.

The problem turned out to be that git-lsfiles output, that we add into
list of source files, is bytes and it breaks when those bytes get
intermixed into strings.

-> Fix it by always returning from runcmd the str type of current python.

/reported-by @arnau
parent ad6305c0
...@@ -30,6 +30,8 @@ import os ...@@ -30,6 +30,8 @@ import os
import sys import sys
from errno import EEXIST from errno import EEXIST
PY3 = (sys.version_info.major >= 3)
# tell cython to resolve `cimport wendelin.*` modules hierarchy starting at top-level. # tell cython to resolve `cimport wendelin.*` modules hierarchy starting at top-level.
# see wendelin.py for details. # see wendelin.py for details.
...@@ -248,6 +250,8 @@ def runcmd(argv): ...@@ -248,6 +250,8 @@ def runcmd(argv):
if retcode: if retcode:
raise RuntimeError("%s -> failed (status %s)" % (argv, retcode)) raise RuntimeError("%s -> failed (status %s)" % (argv, retcode))
if PY3:
output = output.decode('utf-8')
return output return output
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment