From e2b403e685c4979c96ee2a736c47b715cdd797e0 Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Thu, 9 Feb 2023 09:46:24 +0100 Subject: [PATCH] fix bug in setup.py on macOS where the machine was incorrectly identified. --- setup.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 20d28f2..ef99bcc 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,20 @@ #!/usr/bin/env python import os -from platform import architecture +from platform import architecture, machine from setuptools import setup from setuptools.command.test import test as TestCommand import sys # environment variables for cross-platform package creation platform = os.environ.get('PYSOUNDFILE_PLATFORM', sys.platform) -architecture0 = os.environ.get('PYSOUNDFILE_ARCHITECTURE', architecture()[0]) +architecture0 = os.environ.get('PYSOUNDFILE_ARCHITECTURE') +if architecture0 is None: + # follow the same decision tree as in soundfile.py after + # _find_library('sndfile') fails: + if sys.platform == 'win32': + architecture0 = architecture()[0] # 64bit or 32bit + else: + architecture0 = machine() # x86_64 or arm64 if platform == 'darwin': libname = 'libsndfile_' + architecture0 + '.dylib'