Commit 36456192 authored by Jürgen Gmach's avatar Jürgen Gmach Committed by GitHub

Fix bootstrapping for development

- fix bootstrapping for Python 2.7

The bootstrap process uses `get-pip.py`, which in its latest version,
tries to bootstrap a Python 3 only version of pip.

We need to pass in a separate URL for a Python 2.7 compatible version of
get-pip.py.

- Handle different pip messages

e.g. on pip 20.3.4 the message for no updates is
"Requirement already up-to-date"

e.g. on pip 21.0.1 the message for no updates is
"Requirement already satisfied"
parent db3d6e2f
...@@ -6,6 +6,8 @@ Change History ...@@ -6,6 +6,8 @@ Change History
- Support python37, python38 and python39 in conditional section expressions - Support python37, python38 and python39 in conditional section expressions
- Fix bootstrapping for python27 and python35
3.0.0a2 (2020-05-25) 3.0.0a2 (2020-05-25)
==================== ====================
......
...@@ -52,8 +52,14 @@ def install_pip(): ...@@ -52,8 +52,14 @@ def install_pip():
tmp = tempfile.mkdtemp(prefix='buildout-dev-') tmp = tempfile.mkdtemp(prefix='buildout-dev-')
try: try:
get_pip = os.path.join(tmp, 'get-pip.py') get_pip = os.path.join(tmp, 'get-pip.py')
if sys.version_info < (3, ):
GET_PIP_URL = 'https://bootstrap.pypa.io/2.7/get-pip.py'
elif (sys.version_info.major, sys.version_info.minor) == (3, 5):
GET_PIP_URL = 'https://bootstrap.pypa.io/3.5/get-pip.py'
else:
GET_PIP_URL = 'https://bootstrap.pypa.io/get-pip.py'
with open(get_pip, 'wb') as f: with open(get_pip, 'wb') as f:
f.write(urlopen('https://bootstrap.pypa.io/get-pip.py').read()) f.write(urlopen(GET_PIP_URL).read())
sys.stdout.flush() sys.stdout.flush()
if subprocess.call([sys.executable, get_pip]): if subprocess.call([sys.executable, get_pip]):
...@@ -83,7 +89,7 @@ def check_upgrade(package): ...@@ -83,7 +89,7 @@ def check_upgrade(package):
output = subprocess.check_output( output = subprocess.check_output(
[sys.executable] + ['-m', 'pip', 'install', '--upgrade', package], [sys.executable] + ['-m', 'pip', 'install', '--upgrade', package],
) )
was_up_to_date = b"up-to-date" in output was_up_to_date = b"up-to-date" in output or b"already satisfied" in output
if not was_up_to_date: if not was_up_to_date:
print(output.decode('utf8')) print(output.decode('utf8'))
return not was_up_to_date return not was_up_to_date
......
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