class Scipy < Formula desc "Software for mathematics, science, and engineering" homepage "https://www.scipy.org" url "https://files.pythonhosted.org/packages/ee/5b/5afcd1c46f97b3c2ac3489dbc95d6ca28eacf8e3634e51f495da68d97f0f/scipy-1.3.1.tar.gz" sha256 "2643cfb46d97b7797d1dbdb6f3c23fe3402904e3c90e6facfe6a9b98d808c1b5" head "https://github.com/scipy/scipy.git" bottle do cellar :any sha256 "3bd4b4c7df8f1f144fe95ce8e820a4704c64162749b868faac38a107f50e4956" => :catalina sha256 "53f0341b14c5c9039660da78cb27a9c50b22a255a84b509b3841d97e793f0966" => :mojave sha256 "51d3d9f1aaecfbc15967389e514dd1f439d42d828e619016ed5c707cb9554a14" => :high_sierra end depends_on "swig" => :build depends_on "gcc" # for gfortran depends_on "numpy" depends_on "openblas" depends_on "python" cxxstdlib_check :skip def install openblas = Formula["openblas"].opt_prefix ENV["ATLAS"] = "None" # avoid linking against Accelerate.framework ENV["BLAS"] = ENV["LAPACK"] = "#{openblas}/lib/libopenblas.dylib" 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 version = Language::Python.major_minor_version "python3" ENV["PYTHONPATH"] = Formula["numpy"].opt_lib/"python#{version}/site-packages" ENV.prepend_create_path "PYTHONPATH", lib/"python#{version}/site-packages" system "python3", "setup.py", "build", "--fcompiler=gnu95" system "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 "python3", "-c", "import scipy" end end