py-py-spy: add 0.4.0, and make rust & CargoPackage respect -j (#47883)

* py-py-spy: add 0.4.0

* py-py-spy: port from Package to CargoPackage

* CargoPackage: respect make_jobs

* rust: respect make_jobs during build and install

* spack style

* CargoBuilder: fix make_jobs syntax

* CargoBuilder: don't write to $HOME, use stage dir
This commit is contained in:
Lehman Garrison 2025-01-06 14:14:19 -05:00 committed by GitHub
parent 85c125a0f5
commit aa0ab3b38b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 12 deletions

View File

@ -71,13 +71,16 @@ def build_directory(self):
@property
def build_args(self):
"""Arguments for ``cargo build``."""
return []
return ["-j", str(self.pkg.module.make_jobs)]
@property
def check_args(self):
"""Argument for ``cargo test`` during check phase"""
return []
def setup_build_environment(self, env):
env.set("CARGO_HOME", self.stage.path)
def build(self, pkg, spec, prefix):
"""Runs ``cargo install`` in the source directory"""
with fs.working_dir(self.build_directory):

View File

@ -5,26 +5,20 @@
from spack.package import *
class PyPySpy(Package):
class PyPySpy(CargoPackage):
"""A Sampling Profiler for Python."""
homepage = "https://github.com/benfred/py-spy"
url = "https://github.com/benfred/py-spy/archive/v0.3.8.tar.gz"
license("MIT")
license("MIT", checked_by="lgarrison")
version("0.4.0", sha256="13a5c4b949947425670eedac05b6dd27edbc736b75f1587899efca1a7ef79ac3")
version("0.3.8", sha256="9dbfd0ea79ef31a2966891e86cf6238ed3831938cf562e71848e07b7009cf57d")
version("0.3.3", sha256="41454d3d9132da45c72f7574faaff65f40c757720293a277ffa5ec5a4b44f902")
depends_on("c", type="build") # generated
# TODO: uses cargo to download and build dozens of dependencies.
# Need to figure out how to manage these with Spack once we have a
# CargoPackage base class.
depends_on("rust", type="build")
depends_on("unwind")
depends_on("libunwind components=ptrace", when="^[virtuals=unwind] libunwind")
def install(self, spec, prefix):
cargo = which("cargo")
cargo("install", "--root", prefix, "--path", ".")

View File

@ -206,10 +206,10 @@ def configure(self, spec, prefix):
configure(*flags)
def build(self, spec, prefix):
python("./x.py", "build")
python("./x.py", "build", "-j", str(make_jobs))
def install(self, spec, prefix):
python("./x.py", "install")
python("./x.py", "install", "-j", str(make_jobs))
# known issue: https://github.com/rust-lang/rust/issues/132604
unresolved_libraries = ["libz.so.*"]