Match used pip and setuptools constraints

This commit is contained in:
Pedro Algarvio 2021-09-22 12:57:30 +01:00 committed by Megan Wilhite
parent 5fa698d8b5
commit 4cb5c4c178
2 changed files with 28 additions and 8 deletions

View file

@ -1426,6 +1426,9 @@ repos:
- -e - -e
- lint-salt-pre-commit - lint-salt-pre-commit
- -- - --
additional_dependencies:
- setuptools<58.0
- pip>=20.2.4,<21.2
- repo: https://github.com/saltstack/mirrors-nox - repo: https://github.com/saltstack/mirrors-nox
rev: v2020.8.22 rev: v2020.8.22
@ -1438,4 +1441,7 @@ repos:
- -e - -e
- lint-tests-pre-commit - lint-tests-pre-commit
- -- - --
additional_dependencies:
- setuptools<58.0
- pip>=20.2.4,<21.2
# <---- Pre-Commit ------------------------------------------------------------------------------------------------- # <---- Pre-Commit -------------------------------------------------------------------------------------------------

View file

@ -276,7 +276,7 @@ def _get_pip_requirements_file(session, transport, crypto=None, requirements_typ
session.error("Could not find a linux requirements file for {}".format(pydir)) session.error("Could not find a linux requirements file for {}".format(pydir))
def _upgrade_pip_setuptools_and_wheel(session): def _upgrade_pip_setuptools_and_wheel(session, upgrade=True):
if SKIP_REQUIREMENTS_INSTALL: if SKIP_REQUIREMENTS_INSTALL:
session.log( session.log(
"Skipping Python Requirements because SKIP_REQUIREMENTS_INSTALL was found in the environ" "Skipping Python Requirements because SKIP_REQUIREMENTS_INSTALL was found in the environ"
@ -289,11 +289,16 @@ def _upgrade_pip_setuptools_and_wheel(session):
"pip", "pip",
"install", "install",
"--progress-bar=off", "--progress-bar=off",
"-U",
"pip>=20.2.4,<21.2",
"setuptools!=50.*,!=51.*,!=52.*",
"wheel",
] ]
if upgrade:
install_command.append("-U")
install_command.extend(
[
"pip>=20.2.4,<21.2",
"setuptools!=50.*,!=51.*,!=52.*",
"wheel",
]
)
session.run(*install_command, silent=PIP_INSTALL_SILENT) session.run(*install_command, silent=PIP_INSTALL_SILENT)
return True return True
@ -849,8 +854,10 @@ class Tee:
return self._first.fileno() return self._first.fileno()
def _lint(session, rcfile, flags, paths, tee_output=True): def _lint(
if _upgrade_pip_setuptools_and_wheel(session): session, rcfile, flags, paths, tee_output=True, upgrade_setuptools_and_pip=True
):
if _upgrade_pip_setuptools_and_wheel(session, upgrade=upgrade_setuptools_and_pip):
requirements_file = os.path.join( requirements_file = os.path.join(
"requirements", "static", "ci", _get_pydir(session), "lint.txt" "requirements", "static", "ci", _get_pydir(session), "lint.txt"
) )
@ -924,7 +931,14 @@ def _lint_pre_commit(session, rcfile, flags, paths):
interpreter=session._runner.func.python, interpreter=session._runner.func.python,
reuse_existing=True, reuse_existing=True,
) )
_lint(session, rcfile, flags, paths, tee_output=False) _lint(
session,
rcfile,
flags,
paths,
tee_output=False,
upgrade_setuptools_and_pip=False,
)
@nox.session(python="3") @nox.session(python="3")