Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the bufr_query library from NOAA-EMC #461

Merged
merged 11 commits into from
Aug 21, 2024
49 changes: 49 additions & 0 deletions var/spack/repos/builtin/packages/bufr-query/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class BufrQuery(CMakePackage):
"""The NOAA bufr-query Library can be used to read NCEP and WMO formated BUFR
files using a simple interface that does not require the user to know the
details of the BUFR format. Detailed documentation for the BUFR Library can
be found at https://bufr-query.readthedocs.io/en/latest/index.html"""

homepage = "https://github.com/NOAA-EMC/bufr-query"
url = "https://github.com/NOAA-EMC/bufr-query/archive/refs/tags/v0.0.1.tar.gz"
maintainers("srherbener", "rmclaren")

license("Apache-2.0", checked_by="srherbener")

version("0.0.2", sha256="b87a128246e79e3c76e3158d89823e2ae38e9ee1a5a81b6f7b423837bdb93a1f")
version("0.0.1", sha256="001990d864533c101b93d1c351edf50cf8b5ccc575e442d174735f6c332d3d03")

# Required dependencies
depends_on("ecbuild", type=("build"))
depends_on("llvm-openmp", when="%apple-clang", type=("build", "run"))
depends_on("mpi", type=("build", "run"))
depends_on("[email protected]:", type=("build", "run"))
depends_on("eigen@3:", type=("build", "run"))
depends_on("gsl-lite", type=("build", "run"))
depends_on("netcdf-c", type=("build", "run"))
depends_on("netcdf-cxx4", type=("build", "run"))
depends_on("bufr", type=("build", "run"))

# Optional dependencies
variant("python", default=True, description="Enable Python interface")
depends_on("python@3:", type=("build", "run"), when="+python")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the correct syntax for Python is something like extends(python) and then use the PythonBuilder to build and install the Python interface. See https://github.com/spack/spack/pull/45504/files for how this is done. I haven't implemented a package this way myself yet, but I understand that this is how it is supposed to be.

At the minimum, please remove @3: because the minimum version that spack supports is 3.7.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I grabbed this from another package script too. The example you give looks a lot nicer. I can take a look at that. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched the code over to use the extend("python") mechanism (as is done in the example PR you noted).

depends_on("py-pybind11", type=("build"), when="+python")

# CMake configuration
def cmake_args(self):
args = [self.define_from_variant("BUILD_PYTHON_BINDINGS", "python")]

# provide path to netcdf-c include files
nc_include_dir = Executable("nc-config")("--includedir", output=str).strip()
args.append("-DCMAKE_C_FLAGS=-I" + nc_include_dir)
args.append("-DCMAKE_CXX_FLAGS=-I" + nc_include_dir)
climbfuji marked this conversation as resolved.
Show resolved Hide resolved

return args
Loading