Skip to content

Commit

Permalink
Merge pull request #28556 from pavelzw/py-crude-resource-monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
xhochy authored Jan 16, 2025
2 parents feb3c0e + 985e0b5 commit 359a3b5
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
13 changes: 13 additions & 0 deletions recipes/py-crude-resource-monitor/0001-pnpm-bat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/build.rs b/build.rs
index ef934f7..2b8bb5b 100644
--- a/build.rs
+++ b/build.rs
@@ -1,7 +1,7 @@
use std::process::Command;

fn main() {
- let pnpm_executable = if cfg!(windows) { "pnpm.cmd" } else { "pnpm" };
+ let pnpm_executable = if cfg!(windows) { "pnpm.bat" } else { "pnpm" };

Command::new(pnpm_executable)
.args(["install"])
24 changes: 24 additions & 0 deletions recipes/py-crude-resource-monitor/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo on

set CARGO_PROFILE_RELEASE_STRIP=symbols
set CARGO_PROFILE_RELEASE_LTO=fat

:: dump licenses
cargo-bundle-licenses ^
--format yaml ^
--output "%SRC_DIR%\THIRDPARTY.yml" ^
|| exit 1

@REM https://github.com/prefix-dev/rattler-build/issues/1165
cd frontend && ^
pnpm install && ^
pnpm-licenses generate-disclaimer ^
--prod ^
--output-file=..\THIRDPARTY-frontend.yml ^
&& ^
cd .. && ^
cargo install --locked ^
--root "%PREFIX%" ^
--path . ^
--no-track ^
|| exit 1
23 changes: 23 additions & 0 deletions recipes/py-crude-resource-monitor/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -o xtrace -o nounset -o pipefail -o errexit

export CARGO_PROFILE_RELEASE_STRIP=symbols
export CARGO_PROFILE_RELEASE_LTO=fat

cargo-bundle-licenses \
--format yaml \
--output THIRDPARTY.yml

pushd frontend
pnpm install
pnpm-licenses generate-disclaimer --prod --output-file=../THIRDPARTY-frontend.yml
popd

if [[ "$target_platform" == linux* ]]
then
export RUSTFLAGS="-C link-arg=-Wl,-rpath-link,${PREFIX}/lib -L${PREFIX}/lib"
cargo install --no-track --locked --features unwind --root "$PREFIX" --path .
else
cargo install --no-track --locked --root "$PREFIX" --path .
fi
49 changes: 49 additions & 0 deletions recipes/py-crude-resource-monitor/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
context:
name: py-crude-resource-monitor
version: 0.1.0

package:
name: ${{ name|lower }}
version: ${{ version }}

source:
# url: https://github.com/I-Al-Istannen/${{ name }}/archive/refs/tags/v${{ version }}.tar.gz
# sha256: 2e8a752fcb9342030794524a24a7425291d12a2d7fd8980740c6c95964fba126
url: https://github.com/I-Al-Istannen/py-crude-resource-monitor/archive/063377e8250061fe14a69b0da23ccdda7d9abeff.tar.gz
sha256: 2d363ae1763a6e5d4ccbf8224cb64f446be5d3920240fbcbbff44182a3c16160
patches:
- if: win
then: 0001-pnpm-bat.patch

build:
number: 0

requirements:
build:
- pnpm
- pnpm-licenses
- ${{ compiler('rust') }}
- ${{ compiler('c') }}
- ${{ stdlib('c') }}
- cargo-bundle-licenses
host:
- if: linux
then:
- libunwind

tests:
- script:
- py-crude-resource-monitor --help

about:
homepage: https://github.com/I-Al-Istannen/${{ name }}
summary: A memory and cpu utilization monitor that correlates the data with Python stacktraces. Supports multiprocessing.
license: MIT
license_file:
- LICENSE
- THIRDPARTY.yml
- THIRDPARTY-frontend.yml

extra:
recipe-maintainers:
- pavelzw

0 comments on commit 359a3b5

Please sign in to comment.