homebrew-core/Formula/astrometry-net.rb
2019-09-02 18:54:11 +02:00

69 lines
2.5 KiB
Ruby

class AstrometryNet < Formula
include Language::Python::Virtualenv
desc "Automatic identification of astronomical images"
homepage "https://github.com/dstndstn/astrometry.net"
url "https://github.com/dstndstn/astrometry.net/releases/download/0.78/astrometry.net-0.78.tar.gz"
sha256 "9eda1b6cab5269b0a0e5d610aec86866cb8b08fb8f56254dc12f1690d69bc649"
revision 3
bottle do
cellar :any
sha256 "5e7cc2e98d972fbf4a205a4261eeb598f95ed3e0c95c1461e74ddb48512519c0" => :mojave
sha256 "99d3e9336ec83c3eb7221cede7e8aa7a9c1035b517349df0939d8323a62ae8fe" => :high_sierra
sha256 "0fdb24fe5a58b0a141c9968508433118101fe92935a01b8a6266e2fc7d0a9b97" => :sierra
end
depends_on "pkg-config" => :build
depends_on "swig" => :build
depends_on "cairo"
depends_on "cfitsio"
depends_on "gsl"
depends_on "jpeg"
depends_on "libpng"
depends_on "netpbm"
depends_on "numpy"
depends_on "python"
depends_on "wcslib"
resource "fitsio" do
url "https://files.pythonhosted.org/packages/87/c1/be76515a52004b261febf2c2074f0c2fd730b71b331e2cc69480952e1ed3/fitsio-1.0.5.tar.gz"
sha256 "db5ac8d8216733f492007f1511dc0f77a8b6c0047aca35eb2148adc4a63a4d5a"
end
def install
ENV["NETPBM_INC"] = "-I#{Formula["netpbm"].opt_include}/netpbm"
ENV["NETPBM_LIB"] = "-L#{Formula["netpbm"].opt_lib} -lnetpbm"
ENV["SYSTEM_GSL"] = "yes"
ENV["PYTHON_SCRIPT"] = "#{libexec}/bin/python3"
ENV["PYTHON"] = "python3"
venv = virtualenv_create(libexec, "python3")
venv.pip_install resources
ENV["INSTALL_DIR"] = prefix
xy = Language::Python.major_minor_version "python3"
ENV["PY_BASE_INSTALL_DIR"] = libexec/"lib/python#{xy}/site-packages/astrometry"
ENV["PY_BASE_LINK_DIR"] = libexec/"lib/python#{xy}/site-packages/astrometry"
system "make"
system "make", "py"
system "make", "install"
end
test do
system "#{bin}/build-astrometry-index", "-d", "3", "-o", "index-9918.fits",
"-P", "18", "-S", "mag", "-B", "0.1",
"-s", "0", "-r", "1", "-I", "9918", "-M",
"-i", "#{prefix}/examples/tycho2-mag6.fits"
(testpath/"99.cfg").write <<~EOS
add_path .
inparallel
index index-9918.fits
EOS
system "#{bin}/solve-field", "--config", "99.cfg", "#{prefix}/examples/apod4.jpg",
"--continue", "--dir", "."
assert_predicate testpath/"apod4.solved", :exist?
assert_predicate testpath/"apod4.wcs", :exist?
end
end