72 lines
2.9 KiB
Ruby
72 lines
2.9 KiB
Ruby
class Scipy < Formula
|
|
desc "Software for mathematics, science, and engineering"
|
|
homepage "https://www.scipy.org"
|
|
url "https://files.pythonhosted.org/packages/47/33/a24aec22b7be7fdb10ec117a95e1e4099890d8bbc6646902f443fc7719d1/scipy-1.7.1.tar.gz"
|
|
sha256 "6b47d5fa7ea651054362561a28b1ccc8da9368a39514c1bbf6c0977a1c376764"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/scipy/scipy.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_big_sur: "65e79aed434b4c9dc97445916046490023e91a578583089d06cd97b96251f1df"
|
|
sha256 cellar: :any, big_sur: "7273e64702e01f65615143059f6af35f5226fc938d1ef7d048a644f329dfb93e"
|
|
sha256 cellar: :any, catalina: "27ade676309a263bab19e497b66941c18969285318846033213b9af9ea4c2150"
|
|
sha256 cellar: :any, mojave: "8e2729704d6789206056dc8887dc110d94cda11f2c6b1e8e0a3485d47e4f678b"
|
|
sha256 x86_64_linux: "da77380c3ac02a0a27c6b9c4560af76cf2815adf3129c87a1ef26777d9d2259e"
|
|
end
|
|
|
|
depends_on "cython" => :build
|
|
depends_on "pythran" => :build
|
|
depends_on "swig" => :build
|
|
depends_on "gcc" # for gfortran
|
|
depends_on "numpy"
|
|
depends_on "openblas"
|
|
depends_on "pybind11"
|
|
depends_on "python@3.9"
|
|
|
|
cxxstdlib_check :skip
|
|
|
|
fails_with gcc: "5"
|
|
|
|
def install
|
|
# Fix for current GCC on Big Sur, which does not like 11 as version value
|
|
# (reported at https://github.com/iains/gcc-darwin-arm64/issues/31#issuecomment-750343944)
|
|
ENV["MACOSX_DEPLOYMENT_TARGET"] = "11.0" if MacOS.version == :big_sur
|
|
|
|
openblas = Formula["openblas"].opt_prefix
|
|
ENV["ATLAS"] = "None" # avoid linking against Accelerate.framework
|
|
ENV["BLAS"] = ENV["LAPACK"] = "#{openblas}/lib/#{shared_library("libopenblas")}"
|
|
|
|
config = <<~EOS
|
|
[DEFAULT]
|
|
library_dirs = #{HOMEBREW_PREFIX}/lib
|
|
include_dirs = #{HOMEBREW_PREFIX}/include
|
|
[openblas]
|
|
libraries = openblas
|
|
library_dirs = #{openblas}/lib
|
|
include_dirs = #{openblas}/include
|
|
EOS
|
|
|
|
Pathname("site.cfg").write config
|
|
|
|
site_packages = Language::Python.site_packages("python3")
|
|
ENV.prepend_create_path "PYTHONPATH", Formula["cython"].opt_libexec/site_packages
|
|
ENV.prepend_create_path "PYTHONPATH", Formula["pythran"].opt_libexec/site_packages
|
|
ENV.prepend_create_path "PYTHONPATH", Formula["numpy"].opt_prefix/site_packages
|
|
ENV.prepend_create_path "PYTHONPATH", site_packages
|
|
|
|
system Formula["python@3.9"].opt_bin/"python3", "setup.py", "build",
|
|
"--fcompiler=gfortran", "--parallel=#{ENV.make_jobs}"
|
|
system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(prefix)
|
|
end
|
|
|
|
# cleanup leftover .pyc files from previous installs which can cause problems
|
|
# see https://github.com/Homebrew/homebrew-python/issues/185#issuecomment-67534979
|
|
def post_install
|
|
rm_f Dir["#{HOMEBREW_PREFIX}/lib/python*.*/site-packages/scipy/**/*.pyc"]
|
|
end
|
|
|
|
test do
|
|
system Formula["python@3.9"].opt_bin/"python3", "-c", "import scipy"
|
|
end
|
|
end
|