From e484d657aad6c123c525bda472809cbb64c47dec Mon Sep 17 00:00:00 2001 From: rtobar Date: Wed, 8 Nov 2023 14:16:23 +0800 Subject: [PATCH 1/3] Use raw string for RE pattern Otherwise the `\d` escape sequence doesn't make sense. This actually emits a warning in python 3.11. --- casacore/measures/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/casacore/measures/__init__.py b/casacore/measures/__init__.py index 7bb4b3e..762700e 100755 --- a/casacore/measures/__init__.py +++ b/casacore/measures/__init__.py @@ -624,7 +624,7 @@ def getvalue(self, v): if not is_measure(v): raise TypeError('Incorrect input type for getvalue()') import re - rx = re.compile("m\d+") + rx = re.compile(r"m\d+") out = [] keys = list(v.keys()) keys.sort() From a5e70a49b624d110fa9dafd4a968e9e358ae63e4 Mon Sep 17 00:00:00 2001 From: Ludwig Schwardt Date: Mon, 4 Dec 2023 14:34:11 +0200 Subject: [PATCH 2/3] Explicitly add Homebrew libs to support Apple M1 In the grand old days, Homebrew installed to `/usr/local` and all was well. Now, however, while Intel Homebrew still does this, Apple Silicon / M1 / M2 Homebrew has gone and picked a new prefix: `/opt/homebrew`. A good explanation of the rationale is at https://earthly.dev/blog/homebrew-on-m1/. Basically, Homebrew had to admit that Fink and MacPorts were right. :-P The solution is to call `brew --prefix` and add those libraries explicitly to the search list. Keep going if brew is not installed. This addresses #252. --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7bb3650..7bded63 100755 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ Setup script for the CASACORE python wrapper. """ import os +import subprocess import sys import warnings from setuptools import setup, Extension, find_packages @@ -52,7 +53,17 @@ def find_library_file(libname): if 'LD_LIBRARY_PATH' in os.environ: lib_dirs += os.environ['LD_LIBRARY_PATH'].split(':') - + # Look for Homebrewed libraries + try: + homebrew_prefix = subprocess.run( + ['brew', '--prefix'], + capture_output=True, + check=True, + text=True + ).stdout.strip() + lib_dirs.append(join(homebrew_prefix, 'lib')) + except subprocess.CalledProcessError: + pass # Append default search path (not a complete list) lib_dirs += [join(sys.prefix, 'lib'), '/usr/local/lib', From 53e35d0f81eec91ed9b0bdf85172b5d66278ed6a Mon Sep 17 00:00:00 2001 From: Tammo Jan Dijkema Date: Tue, 19 Dec 2023 12:13:10 +0100 Subject: [PATCH 3/3] Fix brew not found error --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7bded63..fac96fa 100755 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ def find_library_file(libname): text=True ).stdout.strip() lib_dirs.append(join(homebrew_prefix, 'lib')) - except subprocess.CalledProcessError: + except (subprocess.CalledProcessError, FileNotFoundError): pass # Append default search path (not a complete list) lib_dirs += [join(sys.prefix, 'lib'),