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)