Commit af211612 authored by Julien Muchembled's avatar Julien Muchembled

Add support for slapos.buildout >= 2.7.1+slapos004

When bootstrapping to a different version of Python, the path of
the wanted Python changes twice when using SlapOS shared parts.
This commit checks bin/buildout-rebootstrap before reusing it.
parent 74757bcb
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# #
############################################################################## ##############################################################################
import logging, os, shutil, subprocess, sys, tempfile import errno, logging, os, shutil, subprocess, sys, tempfile
from zc.buildout import easy_install, UserError from zc.buildout import easy_install, UserError
...@@ -65,7 +65,14 @@ Buildout will be restarted automatically to have this change applied. ...@@ -65,7 +65,14 @@ Buildout will be restarted automatically to have this change applied.
installed = sys.argv[0] installed = sys.argv[0]
new_bin = installed + '-rebootstrap' new_bin = installed + '-rebootstrap'
if not os.path.exists(new_bin): try:
with open(new_bin) as x:
x = x.readline().rstrip()
except IOError as e:
if e.errno != errno.ENOENT:
raise
x = None
if x != '#!' + self.wanted_python:
from .bootstrap import get_distributions, setup_script from .bootstrap import get_distributions, setup_script
if subprocess.call((self.wanted_python, '-c', if subprocess.call((self.wanted_python, '-c',
'import sys; sys.exit(sys.version_info[:2] == %r)' 'import sys; sys.exit(sys.version_info[:2] == %r)'
......
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