From b4e4b9d498bb50330f9683bd35930d557a4e93cc Mon Sep 17 00:00:00 2001 From: Khushboo Vashi Date: Mon, 5 Aug 2024 12:31:28 +0530 Subject: [PATCH] Fix an issue where the wheel package is not getting installed on the arm64-based macOS version < 14. #7754 --- pkg/pip/setup_pip.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/pip/setup_pip.py b/pkg/pip/setup_pip.py index bc5bacb1a..144a2f2ce 100644 --- a/pkg/pip/setup_pip.py +++ b/pkg/pip/setup_pip.py @@ -43,11 +43,15 @@ for index, req in enumerate(all_requires): if 'psycopg[c]' in req: # Starting from Psycopg 3.1.20, ARM64 macOS binary packages are no # longer available for macOS versions before 14.0. - if platform.system() == 'Darwin' and 'arm' in platform.processor()\ - and platform.mac_ver()[0] < '14.0': - req = 'psycopg[binary]==3.1.19' - else: - req = req.replace('psycopg[c]', 'psycopg[binary]') + _req = req.replace('psycopg[c]', 'psycopg[binary]') + req = "psycopg[binary] == 3.1.19; sys_platform == 'darwin' and" \ + " platform_machine == 'arm64' and platform_release < '23.0' \n"\ + + _req + "; (sys_platform == 'darwin' and" \ + " platform_machine == 'arm64' and" \ + " platform_release >= '23.0') or" \ + " (sys_platform == 'darwin' and" \ + " platform_machine != 'arm64'" \ + ") or sys_platform != 'darwin'" if 'gssapi' in req: kerberos_extras.append(req)