google-cloud-cli: add new package (#36830)
* google-cloud-cli: add new package * black fixes * Less verbose * [@spackbot] updating style on behalf of adamjstewart * More robust if ver doesn't exist for platform * Deprecate ancient GEE * Fix ppc64le bug --------- Co-authored-by: adamjstewart <adamjstewart@users.noreply.github.com>
This commit is contained in:
parent
d5fa062e4a
commit
01913d08e7
78
var/spack/repos/builtin/packages/google-cloud-cli/package.py
Normal file
78
var/spack/repos/builtin/packages/google-cloud-cli/package.py
Normal file
@ -0,0 +1,78 @@
|
||||
# Copyright 2013-2023 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)
|
||||
|
||||
import platform
|
||||
|
||||
from spack.package import *
|
||||
|
||||
versions = {
|
||||
"426.0.0": {
|
||||
"linux": {
|
||||
"arm": "8409b8cc00f0ae8089be97d8a565f4072eada890776345bccb988bcd4d4bb27f",
|
||||
"x86_64": "c653a8ac1e48889005fd00e2de580a27be5a3cb46ceccc570146982c4ddf4245",
|
||||
"x86": "13e8b75a3ba352bda58e9974ed5779c16a6631e2957ea6e43cf3b11d5da49ae7",
|
||||
},
|
||||
"darwin": {
|
||||
"arm": "5228c93f04af2e3eda3cf03c18bcc75a5440c62170fcdcd46e77e4e97452786a",
|
||||
"x86_64": "1ac867378e8e6d59aacadfa0a5282b549146cd8bcd971341d047006c6f702c63",
|
||||
"x86": "dd95eb5f3ef82825f3e930f538c3964c5ae37e3bf35492e21f5fed3916b980c0",
|
||||
},
|
||||
"windows": {
|
||||
"arm": "d45bdb6808ca737b6c14d6ac85f3380ab1037eeb3c641164d5d4fad032d382af",
|
||||
"x86_64": "2a5199f04414df36e483c892d0e89cdc9e962266414ce7990cf2b59058b94e9b",
|
||||
"x86": "c04c39b6a7c82365f3c4a0d79ed60dbc6c5ce672970a87a70478bb7c55926852",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
targets = {"aarch64": "arm", "arm64": "arm", "amd64": "x86_64", "x86_64": "x86_64", "x86": "x86"}
|
||||
|
||||
|
||||
class GoogleCloudCli(Package):
|
||||
"""Create and manage Google Cloud resources and services directly on the command line
|
||||
or via scripts using the Google Cloud CLI."""
|
||||
|
||||
homepage = "https://cloud.google.com/cli"
|
||||
|
||||
# https://cloud.google.com/sdk/docs/downloads-versioned-archives
|
||||
system = platform.system().lower()
|
||||
machine = platform.machine().lower()
|
||||
if machine in targets:
|
||||
machine = targets[machine]
|
||||
ext = "zip" if system == "windows" else "tar.gz"
|
||||
|
||||
for ver in versions:
|
||||
if system in versions[ver] and machine in versions[ver][system]:
|
||||
version(ver, sha256=versions[ver][system][machine])
|
||||
|
||||
depends_on("python", type=("build", "run"))
|
||||
|
||||
def url_for_version(self, version):
|
||||
return f"https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-{version}-{self.system}-{self.machine}.{self.ext}"
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
# https://cloud.google.com/sdk/gcloud/reference/topic/startup
|
||||
env.set("CLOUDSDK_PYTHON", self.spec["python"].command.path)
|
||||
# ~70 dependencies with no hints as to what versions are supported, just use bundled deps
|
||||
env.set("CLOUDSDK_PYTHON_SITEPACKAGES", 0)
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
self.setup_build_environment(env)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# https://cloud.google.com/sdk/docs/install
|
||||
installer = Executable(r".\install.bat" if self.system == "windows" else "./install.sh")
|
||||
installer(
|
||||
"--usage-reporting=false",
|
||||
"--screen-reader=false",
|
||||
"--command-completion=false",
|
||||
"--path-update=false",
|
||||
"--quiet",
|
||||
"--install-python=false",
|
||||
"--no-compile-python",
|
||||
)
|
||||
|
||||
install_tree("bin", prefix.bin)
|
||||
install_tree("lib", prefix.lib)
|
@ -14,7 +14,11 @@ class PyEarthengineApi(PythonPackage):
|
||||
pypi = "earthengine-api/earthengine-api-0.1.186.tar.gz"
|
||||
|
||||
version("0.1.344", sha256="bc5a270b8296aaae8574e68dfd93fe878bc5fbe77d1c41f90bcb5e5b830ca5c8")
|
||||
version("0.1.186", sha256="ced86dc969f5db13eea91944e29c39146bacbb7026a46f4b4ac349b365979627")
|
||||
version(
|
||||
"0.1.186",
|
||||
sha256="ced86dc969f5db13eea91944e29c39146bacbb7026a46f4b4ac349b365979627",
|
||||
deprecated=True,
|
||||
)
|
||||
|
||||
depends_on("py-setuptools", type="build")
|
||||
depends_on("py-google-cloud-storage", when="@0.1.344:", type=("build", "run"))
|
||||
@ -25,3 +29,4 @@ class PyEarthengineApi(PythonPackage):
|
||||
depends_on("py-httplib2@0.9.2:0", type=("build", "run"))
|
||||
depends_on("py-requests", when="@0.1.344:", type=("build", "run"))
|
||||
depends_on("py-six", when="@:0.1.186", type=("build", "run"))
|
||||
depends_on("google-cloud-cli", type="run")
|
||||
|
Loading…
Reference in New Issue
Block a user