From fa9e2bfd4b3648f08ed3a88ce737d432ab97cce1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 8 Oct 2020 15:13:36 +0800 Subject: [PATCH] tools/setup-virtualenv.sh: pass --use-feature=2020-resolver to pip as long as pip supports this option, pass it to `pip install` to silence warnings and errors like: ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. autopep8 1.5.4 requires pycodestyle>=2.6.0, but you'll have pycodestyle 2.5.0 which is incompatible. pytest-cov 2.10.1 requires pytest>=4.6, but you'll have pytest 3.10.1 which is incompatible. Signed-off-by: Kefu Chai --- src/tools/setup-virtualenv.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/tools/setup-virtualenv.sh b/src/tools/setup-virtualenv.sh index af945e2c5a46f..f799784b45141 100755 --- a/src/tools/setup-virtualenv.sh +++ b/src/tools/setup-virtualenv.sh @@ -66,9 +66,17 @@ else DISABLE_PIP_VERSION_CHECK= fi +if pip --help | grep -q use-feature; then + USE_FEATURE=--use-feature=2020-resolver +else + USE_FEATURE= +fi + # older versions of pip will not install wrap_console scripts # when using wheel packages -pip $DISABLE_PIP_VERSION_CHECK --log $DIR/log.txt install --upgrade 'pip >= 6.1' +pip $DISABLE_PIP_VERSION_CHECK --log $DIR/log.txt install \ + $USE_FEATURE \ + --upgrade 'pip >= 6.1' if pip --help | grep -q disable-pip-version-check; then DISABLE_PIP_VERSION_CHECK=--disable-pip-version-check @@ -80,7 +88,10 @@ if test -d wheelhouse ; then export NO_INDEX=--no-index fi -pip $DISABLE_PIP_VERSION_CHECK --log $DIR/log.txt install $NO_INDEX --find-links=file://$(pwd)/wheelhouse 'tox >=2.9.1' +pip $DISABLE_PIP_VERSION_CHECK --log $DIR/log.txt install \ + $USE_FEATURE \ + $NO_INDEX \ + --find-links=file://$(pwd)/wheelhouse 'tox >=2.9.1' require_files=$(ls *requirements*.txt 2>/dev/null) || true constraint_files=$(ls *constraints*.txt 2>/dev/null) || true @@ -91,6 +102,8 @@ if test "$require"; then if ! test -f $md5 || ! md5sum -c wheelhouse/md5 > /dev/null; then NO_INDEX='' fi - pip --exists-action i $DISABLE_PIP_VERSION_CHECK --log $DIR/log.txt install $NO_INDEX \ - --find-links=file://$(pwd)/wheelhouse $require $constraint + pip --exists-action i $DISABLE_PIP_VERSION_CHECK --log $DIR/log.txt install \ + $USE_FEATURE \ + $NO_INDEX \ + --find-links=file://$(pwd)/wheelhouse $require $constraint fi -- 2.39.5