Commit 264eab26 authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: Circle CI job fails

Solution: install proper pip
parent e16ea57b
...@@ -10,7 +10,7 @@ jobs: ...@@ -10,7 +10,7 @@ jobs:
python-version: python-version:
type: string type: string
machine: machine:
image: ubuntu-2004:202101-01 image: ubuntu-2004:202111-01
environment: environment:
BUILD_TYPE: << parameters.build-type >> BUILD_TYPE: << parameters.build-type >>
PYTHON_VER: << parameters.python-version >> PYTHON_VER: << parameters.python-version >>
...@@ -35,6 +35,13 @@ jobs: ...@@ -35,6 +35,13 @@ jobs:
command: sudo apt-get update command: sudo apt-get update
- run: - run:
command: sudo apt install -y build-essential python${PYTHON_VER}-dev command: sudo apt install -y build-essential python${PYTHON_VER}-dev
- when:
condition:
matches:
pattern: ^3\.10$
value: << parameters.python-version >>
steps:
- run: sudo apt install -y python${PYTHON_VER}-distutils
- checkout - checkout
- run: - run:
command: ./ci_build.sh command: ./ci_build.sh
......
...@@ -5,5 +5,8 @@ set -e ...@@ -5,5 +5,8 @@ set -e
cd ../.. cd ../..
# Some machines come with preinstalled six
# which breaks test suite
pip${PYTHON_VER} uninstall -y six || true
python${PYTHON_VER} dev.py python${PYTHON_VER} dev.py
bin/test -c -vvv bin/test -c -vvv
...@@ -76,25 +76,50 @@ def install_pip(): ...@@ -76,25 +76,50 @@ def install_pip():
try: try:
import pip import pip
print('')
try:
print(subprocess.check_output(
[sys.executable] + ['-m', 'pip', '--version'],
stderr=subprocess.STDOUT,
).decode('utf8'))
print('is installed.')
except subprocess.CalledProcessError as e:
# some debian/ubuntu based machines
# have broken pip installs
# that cannot import distutils or html5lib
# thus try to install via get-pip
if (b"ImportError" in e.output or
b"ModuleNotFoundError" in e.output):
install_pip()
raise e
except ImportError: except ImportError:
install_pip() install_pip()
###################################################################### ######################################################################
def check_upgrade(package): def check_upgrade(package):
print('') print('')
print('Check %s' % package) print('Try to upgrade %s' % package)
print('') print('')
try: try:
sys.stdout.flush() sys.stdout.flush()
output = subprocess.check_output( output = subprocess.check_output(
[sys.executable] + ['-m', 'pip', 'install', '--upgrade', package], [sys.executable] + ['-m', 'pip', 'install', '--upgrade', package],
stderr=subprocess.STDOUT,
) )
was_up_to_date = b"up-to-date" in output or b"already satisfied" 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
except subprocess.CalledProcessError: except subprocess.CalledProcessError as e:
# some debian/ubuntu based machines
# have broken pip installs
# that cannot import distutils or html5lib
# thus try to install via get-pip
if (b"ImportError" in e.output or
b"ModuleNotFoundError" in e.output) :
install_pip()
return False
raise RuntimeError("Upgrade %s failed." % package) raise RuntimeError("Upgrade %s failed." % package)
......
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