Commit de5e5d50 authored by Jérome Perrin's avatar Jérome Perrin

bootstrap: fix call to easy_install.scripts

This function is supposed to be called with script names and a directory
to store the scripts, as described in
https://github.com/buildout/buildout/blob/2.7.1/src/zc/buildout/easy_install.txt#L478

Passing an absolute path for script name and None as directory was OK on
python <= 3.5, because:
  os.path.join(None, '/absolute/path')
returns '/absolute/path', but on python >= 3.6 this is no longer the
case and failed with:

    Traceback (most recent call last):
      File "slapos.buildout/src/zc/buildout/buildout.py", line 2240, in main
        getattr(buildout, command)(args)
      File "slapos.buildout/src/zc/buildout/buildout.py", line 643, in install
        self._install_parts(install_args)
      File "slapos.buildout/src/zc/buildout/buildout.py", line 658, in _install_parts
        self._setup_directories()
      File "slapos.rebootstrap/slapos/rebootstrap/__init__.py", line 37, in wrapper
        return getattr(self, attr)(*args, **kw)
      File "slapos.rebootstrap/slapos/rebootstrap/__init__.py", line 72, in _setup_directories
        setup_script(new_bin, self.wanted_python)
      File "slapos.rebootstrap/slapos/rebootstrap/bootstrap.py", line 31, in setup_script
        python,
      File "slapos.buildout/src/zc/buildout/easy_install.py", line 1313, in scripts
        sname = os.path.join(dest, sname)
      File "python3/lib/python3.6/posixpath.py", line 80, in join
        a = os.fspath(a)
    TypeError: expected str, bytes or os.PathLike object, not NoneType

Change the parameters to respect the original signature.
parent 56deb5b9
......@@ -21,13 +21,17 @@ def get_distributions():
def setup_script(path, python=sys.executable):
from zc.buildout import easy_install
executable_path = os.path.realpath(path)
assert os.path.isabs(executable_path)
try:
if sys.executable != python:
easy_install.sys = FakeSysExecutable(python)
easy_install.scripts(
((os.path.realpath(path), 'zc.buildout.buildout', 'main'),),
((os.path.basename(executable_path), 'zc.buildout.buildout', 'main'),),
get_distributions(),
python)
python,
os.path.dirname(executable_path)
)
finally:
easy_install.sys = sys
......
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