Commit d07824dc authored by Kirill Smelkov's avatar Kirill Smelkov

setup: Fix egg_info after addition of δbtail.go

`python setup.py egg_info` stopped working after we added non-ASCII
files, e.g. δbtail.go in 2ab4be93 (wcfs: xbtree: ΔBtail) and δftail.go
in f980471f (wcfs: zdata: ΔFtail):

    (neo) (z-dev) (g.env) kirr@deca:~/src/neo/src/lab.nexedi.com/nexedi/wendelin.core$ python setup.py egg_info
    running egg_info
    writing requirements to wendelin.core.egg-info/requires.txt
    writing wendelin.core.egg-info/PKG-INFO
    writing top-level names to wendelin.core.egg-info/top_level.txt
    writing dependency_links to wendelin.core.egg-info/dependency_links.txt
    writing entry points to wendelin.core.egg-info/entry_points.txt
    package init file '__init__.py' not found (or not a regular file)
    /usr/lib/python2.7/distutils/filelist.py:64: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
      sortable_files.sort()
    Traceback (most recent call last):
      File "setup.py", line 416, in <module>
        """.splitlines()]
      File "/home/kirr/src/tools/go/pygolang/golang/pyx/build.py", line 118, in setup
        setuptools_dso.setup(**kw)
      File "/home/kirr/src/wendelin/venv/z-dev/lib/python2.7/site-packages/setuptools_dso/__init__.py", line 37, in setup
        _setup(**kws)
      File "/home/kirr/src/wendelin/venv/z-dev/lib/python2.7/site-packages/setuptools/__init__.py", line 162, in setup
        return distutils.core.setup(**attrs)
      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 "/home/kirr/src/wendelin/venv/z-dev/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
        self.find_sources()
      File "/home/kirr/src/wendelin/venv/z-dev/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
        mm.run()
      File "/home/kirr/src/wendelin/venv/z-dev/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 538, in run
        self.filelist.sort()
      File "/usr/lib/python2.7/distutils/filelist.py", line 64, in sort
        sortable_files.sort()
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 0: ordinal not in range(128)

This happens becuase by default setuptools collects filenames as str, not
unicode, and our git_lsfiles - also registered into setuptools.file_finders
entrypoint - collects filenames as unicode. Previously everything was working
because there was no on-ASCII filenames, and so unicode vs str coercion worked
automatically. But now, after there is filename like 'δbtail.go', it stopped to
work and raises UnicodeDecodeError.

-> Fix it by adjusting git_lsfiles to collect filenames as UTF-8 encoded
strings instead of unicode.
parent 083251b3
...@@ -246,11 +246,11 @@ def git_lsfiles(dirname): ...@@ -246,11 +246,11 @@ def git_lsfiles(dirname):
# FIXME dirname is currently ignored # FIXME dirname is currently ignored
# XXX non-ascii names, etc # XXX non-ascii names, etc
for _ in runcmd(['git', 'ls-files']).splitlines(): for _ in runcmd(['git', 'ls-files']).splitlines():
yield _.decode('utf8') # XXX utf8 hardcoded yield _
# XXX recursive submodules # XXX recursive submodules
for _ in runcmd(['git', 'submodule', 'foreach', '--quiet', \ for _ in runcmd(['git', 'submodule', 'foreach', '--quiet', \
r'git ls-files | sed "s|\(.*\)\$|$path/\1|g"']).splitlines(): r'git ls-files | sed "s|\(.*\)\$|$path/\1|g"']).splitlines():
yield _.decode('utf8') # XXX utf8 hardcoded yield _
# if we are in git checkout - inject git_lsfiles to setuptools.file_finders # if we are in git checkout - inject git_lsfiles to setuptools.file_finders
# entry-point on the fly. # entry-point on the fly.
......
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