84 lines
3.3 KiB
Ruby
84 lines
3.3 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.88/astrometry.net-0.88.tar.gz"
|
|
sha256 "f57d129547ad176a4ff04dc86fc7523d2e7437a9a7f9b567989b81db813b92d2"
|
|
license "BSD-3-Clause"
|
|
|
|
livecheck do
|
|
url :stable
|
|
strategy :github_latest
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "bfb737ac295d2e675d7eaa0de2f6a242beaa6d34990e3cc7efe7500eed5ab6d2"
|
|
sha256 cellar: :any, arm64_big_sur: "8ab43a5e9cca41cc2ffd9ca4e07e951333ffabf88eae8193701559aad0e4d819"
|
|
sha256 cellar: :any, monterey: "06cb45ac90ba7f1dc94e9c26820c64b4943cbd495472246b4c87185ea38f4c50"
|
|
sha256 cellar: :any, big_sur: "ec7e2992ffe35315cffcb3251d1935edc070fb2c9db09f486a1a2377b89c3518"
|
|
sha256 cellar: :any, catalina: "54fd16f544c42e7d5892d26491823a4be1357a02585f2edce630c0391653f526"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "a5d8a45900e16084aaf03812d3497c77a7b82b1d0ccee3fa049dfb4c70bd3f4f"
|
|
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@3.9"
|
|
depends_on "wcslib"
|
|
|
|
resource "fitsio" do
|
|
url "https://files.pythonhosted.org/packages/23/ec/280f91842d5aeaa1a95dc1d86d64d3fe57a5a37a98bb39b73a963f5dc91d/fitsio-1.1.6.tar.gz"
|
|
sha256 "3e7e5d4fc025d8b6328ae330e72628b92784d4c2bb2f1f0caeb75e730b2f91a5"
|
|
end
|
|
|
|
def install
|
|
# astrometry-net doesn't support parallel build
|
|
# See https://github.com/dstndstn/astrometry.net/issues/178#issuecomment-592741428
|
|
ENV.deparallelize
|
|
|
|
ENV["NETPBM_INC"] = "-I#{Formula["netpbm"].opt_include}/netpbm"
|
|
ENV["NETPBM_LIB"] = "-L#{Formula["netpbm"].opt_lib} -lnetpbm"
|
|
ENV["SYSTEM_GSL"] = "yes"
|
|
ENV["PYTHON"] = Formula["python@3.9"].opt_bin/"python3"
|
|
|
|
venv = virtualenv_create(libexec, Formula["python@3.9"].opt_bin/"python3")
|
|
venv.pip_install resources
|
|
|
|
ENV["INSTALL_DIR"] = prefix
|
|
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"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"
|
|
ENV["PYTHON_SCRIPT"] = libexec/"bin/python3"
|
|
|
|
system "make"
|
|
system "make", "py"
|
|
system "make", "install"
|
|
|
|
rm prefix/"doc/report.txt"
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/image2pnm", "-h"
|
|
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
|