Skip to content

Commit

Permalink
add casacore data again
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v-null committed Jan 29, 2025
1 parent 4c0dd20 commit 7d58219
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/bottle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ jobs:

- run: brew test-bot --only-tap-syntax

- run: brew test-bot --only-formulae Formula/aoflagger.rb Formula/birli.rb
# todo:
# - run: brew test-bot --only-formulae Formula/cfitsio_reentrant.rb Formula/casacore-data.rb
# Error: Unexpected bottle tarball: /Users/runner/work/homebrew-tap/homebrew-tap/cfitsio_reentrant--4.5.0_1.arm64_sonoma.bottle.1.tar.gz
# Error: Unexpected bottle JSON: /Users/runner/work/homebrew-tap/homebrew-tap/cfitsio_reentrant--4.5.0_1.arm64_sonoma.bottle.json
- run: brew test-bot --only-formulae Formula/casacore.rb Formula/aoflagger.rb Formula/birli.rb

- name: Get version number from current date
run: echo "DATE=$(date +'v%Y.%m.%d.%H.%M')" | tee -a "$GITHUB_ENV"

- name: get archive names
id: archive_names
run: |
# build casacore source first
brew install --build-from-source Formula/casacore.rb
brew install --build-from-source Formula/cfitsio_reentrant.rb
brew install --build-from-source Formula/casacore-data.rb
brew install --build-from-source Formula/casacore.rb
for package in aoflagger birli; do
brew install --build-bottle Formula/$package.rb
brew bottle --json Formula/$package.rb
Expand Down
52 changes: 52 additions & 0 deletions Formula/casacore-data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
class ZtarDownloadStrategy < CurlDownloadStrategy
def stage(&block)
UnpackStrategy::Tar.new(cached_location).extract(basename:, verbose: verbose?)
chdir(&block)
end
end

class CasacoreData < Formula
desc "Ephemerides and geodetic data for casacore measures (via Astron)"
homepage "https://github.com/casacore/casacore"
# curl ftp://[email protected]/outgoing/Measures/
url "ftp://[email protected]/outgoing/Measures/WSRT_Measures_20250128-160001.ztar", using: ZtarDownloadStrategy
# curl -s 'ftp://[email protected]/outgoing/Measures/WSRT_Measures_20250128-160001.ztar' | sha256 -
sha256 "5835e3f5458d8f88fd057044a891d26a5cbfdec9a865967b1189d4fd52140c80"
head "ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar", using: ZtarDownloadStrategy

option "with-casapy", "Use Mac CASA.App (aka casapy) data directory if found"

deprecated_option "use-casapy" => "with-casapy"

APP_DIR = (Pathname.new "/Applications").freeze
CASAPY_APP_NAME = "CASA.app".freeze
CASAPY_APP_DIR = (APP_DIR / CASAPY_APP_NAME).freeze
CASAPY_DATA = (CASAPY_APP_DIR / "Contents/data").freeze

def install
if build.with? "casapy"
if !Dir.exist? CASAPY_APP_DIR
odie "--with-casapy was specified, but #{CASAPY_APP_NAME} was not found in #{APP_DIR}"
elsif !Dir.exist? CASAPY_DATA
odie "--with-casapy was specified, but data directory not found at #{CASAPY_DATA}"
end
prefix.install_symlink CASAPY_DATA
else
(prefix / CASAPY_DATA.basename).install Dir["*"]
end
end

def caveats
data_dir = prefix / CASAPY_DATA.basename
if File.symlink? data_dir
"Linked to CASA data directory (#{CASAPY_DATA}) from #{data_dir}"
else
"Installed latest Astron WSRT_Measures tarball to #{data_dir}"
end
end

test do
Dir.exist? (prefix / CASAPY_DATA.basename / "ephemerides")
Dir.exist? (prefix / CASAPY_DATA.basename / "geodetic")
end
end
2 changes: 1 addition & 1 deletion Formula/casacore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class Casacore < Formula
option "without-python", "Build without Python bindings"

depends_on "cmake" => :build
depends_on "casacore/tap/casacore-data"
depends_on "cfitsio_reentrant"
depends_on "fftw"
depends_on "gcc" # for gfortran
depends_on "gsl"
depends_on "hdf5"
depends_on "mwatelescope/tap/casacore-data"
depends_on "ncurses"
depends_on "openblas"
depends_on "readline"
Expand Down

0 comments on commit 7d58219

Please sign in to comment.