From: Thomas Bechtold Date: Mon, 5 Oct 2020 13:28:29 +0000 (+0200) Subject: bootstrap: Conditionally use --use-feature=2020-resolver for pip X-Git-Tag: 1.1.0~44^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=87a68d86d371390a3a9cac1fdfdddd07e11aea60;p=teuthology.git bootstrap: Conditionally use --use-feature=2020-resolver for pip pip might be too old so the --use-feature flag is not available. That leads to: $ ./bootstrap Removing old virtualenv because it uses system site-packages created virtual environment CPython3.8.5.final.0-64 in 173ms creator CPython3Posix(dest=/home/tom/devel/ceph/teuthology/virtualenv, clear=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/tom/.local/share/virtualenv) added seed packages: pip==20.1.1, setuptools==50.3.0, wheel==0.35.1 activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator Usage: pip install [options] [package-index-options] ... pip install [options] -r [package-index-options] ... pip install [options] [-e] ... pip install [options] [-e] ... pip install [options] ... no such option: --use-feature So for the pip upgrade itself, check if the flag is available. From there on, use the new resolver. Signed-off-by: Thomas Bechtold --- diff --git a/bootstrap b/bootstrap index b2bae3cd..34425c05 100755 --- a/bootstrap +++ b/bootstrap @@ -156,8 +156,14 @@ if [ -z "$NO_CLOBBER" ] || [ ! -e ./$VENV ]; then fi -# Upgrade pip first -./$VENV/bin/pip install --use-feature=2020-resolver --upgrade pip +# be compatible with pip shipped by distro older v20.2 +if $vdir/bin/pip --use-feature=2020-resolver >/dev/null 2>&1 ; then + PIP_INSTALL="./$VENV/bin/pip install --use-feature=2020-resolver" +else + PIP_INSTALL="./$VENV/bin/pip install" +fi +# Upgrade pip first - then we have a new pip version with the --use-feature flag +$PIP_INSTALL --upgrade pip # Ensure setuptools is installed ./$VENV/bin/pip install --use-feature=2020-resolver setuptools --upgrade