(py-)codecov: not on pypi anymore, replace by static binary (#36809)

* py-codecov: deprecate since not on pypi anymore

* codecov: new package

* [@spackbot] updating style on behalf of wdconinc

* codecov: use github URL instead, multi-platform

* fix: install to prefix.bin.codecov

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* codecov: use versions lookup dict

* codecov: versions -> _versions, fix style

---------

Co-authored-by: wdconinc <wdconinc@users.noreply.github.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Wouter Deconinck 2023-04-22 11:01:15 -05:00 committed by GitHub
parent 9d2aab415d
commit 806f630c8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,46 @@
# 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 *
class Codecov(Package):
"""Codecov uploads coverage reports to Codecov for processing."""
homepage = "https://codecov.io"
_versions = {
"0.4.1": {
"linux": {
"x86_64": "32cb14b5f3aaacd67f4c1ff55d82f037d3cd10c8e7b69c051f27391d2e66e15c"
},
"darwin": {
"x86_64": "4ab0f06f06e9c4d25464f155b0aff36bfc1e8dbcdb19bfffd586beed1269f3af"
},
"windows": {
"x86_64": "e0cda212aeaebe695509ce8fa2d608760ff70bc932003f544f1ad368ac5450a8"
},
}
}
system = platform.system().lower()
machine = platform.machine().lower()
for ver in _versions:
if system in _versions[ver] and machine in _versions[ver][system]:
version(ver, sha256=_versions[ver][system][machine], expand=False)
def url_for_version(self, version):
_url_base = f"https://github.com/codecov/uploader/releases/download/v{version}/codecov"
return _url_base + ".exe" if self.system == "windows" else _url_base + f"-{self.system}"
def install(self, spec, prefix):
codecov = self.stage.archive_file
chmod = which("chmod")
chmod("+x", codecov)
mkdirp(prefix.bin)
install(codecov, prefix.bin.codecov)

View file

@ -12,7 +12,13 @@ class PyCodecov(PythonPackage):
homepage = "https://github.com/codecov/codecov-python"
pypi = "codecov/codecov-2.0.15.tar.gz"
version("2.0.15", sha256="8ed8b7c6791010d359baed66f84f061bba5bd41174bf324c31311e8737602788")
# Since codecov has been removed from PyPI, py-codecov is deprecated.
# The new codecov uploader can be installed with the package codecov.
version(
"2.0.15",
sha256="8ed8b7c6791010d359baed66f84f061bba5bd41174bf324c31311e8737602788",
deprecated=True,
)
depends_on("py-setuptools", type=("build", "run"))
depends_on("py-requests@2.7.9:", type=("build", "run"))