From 04fbfd3328081c31985d73ba092a036d9031db21 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 28 Jul 2022 09:08:21 +0100 Subject: [PATCH] Salt should not do any logic to include/exclude requirements. That's pip's job. Refs #62386 Fixes #62392 Signed-off-by: Pedro Algarvio --- changelog/62392.fixed | 1 + setup.py | 85 ------------------------------------------- 2 files changed, 1 insertion(+), 85 deletions(-) create mode 100644 changelog/62392.fixed diff --git a/changelog/62392.fixed b/changelog/62392.fixed new file mode 100644 index 000000000000..7d2cfc321528 --- /dev/null +++ b/changelog/62392.fixed @@ -0,0 +1 @@ +All of the requirements provided in the requirements files are now included. The job of evaluating platform markers is not Salt's it's pip's. diff --git a/setup.py b/setup.py index a87b7f6e1344..bd11ff95f7a0 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,6 @@ import contextlib import distutils.dist import glob -import operator import os import platform import sys @@ -175,77 +174,6 @@ # ----- Helper Functions --------------------------------------------------------------------------------------------> -def _parse_op(op): - """ - >>> _parse_op('>') - 'gt' - >>> _parse_op('>=') - 'ge' - >>> _parse_op('=>') - 'ge' - >>> _parse_op('=> ') - 'ge' - >>> _parse_op('<') - 'lt' - >>> _parse_op('<=') - 'le' - >>> _parse_op('==') - 'eq' - >>> _parse_op(' <= ') - 'le' - """ - op = op.strip() - if ">" in op: - if "=" in op: - return "ge" - else: - return "gt" - elif "<" in op: - if "=" in op: - return "le" - else: - return "lt" - elif "!" in op: - return "ne" - else: - return "eq" - - -def _parse_ver(ver): - """ - >>> _parse_ver("'3.4' # pyzmq 17.1.0 stopped building wheels for python3.4") - '3.4' - >>> _parse_ver('"3.4"') - '3.4' - >>> _parse_ver('"2.6.17"') - '2.6.17' - """ - if "#" in ver: - ver, _ = ver.split("#", 1) - ver = ver.strip() - return ver.strip("'").strip('"') - - -def _check_ver(pyver, op, wanted): - """ - >>> _check_ver('2.7.15', 'gt', '2.7') - True - >>> _check_ver('2.7.15', 'gt', '2.7.15') - False - >>> _check_ver('2.7.15', 'ge', '2.7.15') - True - >>> _check_ver('2.7.15', 'eq', '2.7.15') - True - """ - pyver = distutils.version.LooseVersion(pyver) - wanted = distutils.version.LooseVersion(wanted) - if not isinstance(pyver, str): - pyver = str(pyver) - if not isinstance(wanted, str): - wanted = str(wanted) - return getattr(operator, "__{}__".format(op))(pyver, wanted) - - def _parse_requirements_file(requirements_file): parsed_requirements = [] with open(requirements_file) as rfh: @@ -256,19 +184,6 @@ def _parse_requirements_file(requirements_file): if IS_WINDOWS_PLATFORM: if "libcloud" in line: continue - try: - pkg, pyverspec = line.rsplit(";", 1) - except ValueError: - pkg, pyverspec = line, "" - pyverspec = pyverspec.strip() - if pyverspec and ( - not pkg.startswith("pycrypto") or pkg.startswith("pycryptodome") - ): - _, op, ver = pyverspec.split(" ", 2) - if not _check_ver( - platform.python_version(), _parse_op(op), _parse_ver(ver) - ): - continue parsed_requirements.append(line) return parsed_requirements