Unverified Commit aa5da33c authored by Someone's avatar Someone Committed by GitHub
Browse files

Merge pull request #289150 from SomeoneSerge/new-package/rerun

rerun: init at 0.13.0
parents fd4c968e 6ffd74b5
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
From f6c5dde13a39bd149d892162e2ef72267f4c4a57 Mon Sep 17 00:00:00 2001
From: Someone Serge <sergei.kozlukov@aalto.fi>
Date: Thu, 15 Feb 2024 18:05:16 +0000
Subject: [PATCH] re_space_view_time_series: utils: patch out doctests w
 unstable features

---
 crates/re_space_view_time_series/src/util.rs | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/crates/re_space_view_time_series/src/util.rs b/crates/re_space_view_time_series/src/util.rs
index 83ce5362f..59d3b9734 100644
--- a/crates/re_space_view_time_series/src/util.rs
+++ b/crates/re_space_view_time_series/src/util.rs
@@ -288,12 +288,7 @@ fn add_series_runs(
 /// is finite `x == x.next_up().next_down()` also holds.
 ///
 /// ```rust
-/// #![feature(float_next_up_down)]
-/// // f64::EPSILON is the difference between 1.0 and the next number up.
-/// assert_eq!(1.0f64.next_up(), 1.0 + f64::EPSILON);
-/// // But not for most numbers.
-/// assert!(0.1f64.next_up() < 0.1 + f64::EPSILON);
-/// assert_eq!(9007199254740992f64.next_up(), 9007199254740994.0);
+/// // PATCHED OUT THE UNSTABLE float_next_up_down
 /// ```
 ///
 /// [`NEG_INFINITY`]: f64::NEG_INFINITY
-- 
2.43.0
+128 −0
Original line number Diff line number Diff line
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  pkg-config,
  stdenv,
  binaryen,
  rustfmt,
  lld,
  darwin,
  freetype,
  glib,
  gtk3,
  libxkbcommon,
  openssl,
  protobuf,
  vulkan-loader,
  wayland,
  python3Packages,
}:

rustPlatform.buildRustPackage rec {
  pname = "rerun";
  version = "0.13.0";

  src = fetchFromGitHub {
    owner = "rerun-io";
    repo = "rerun";
    rev = version;
    hash = "sha256-HgzzuvCpzKgWC8it0PSq62hBjjqpdgYtQQ50SNbr3do=";
  };
  patches = [
    # Disables a doctest that depends on a nightly feature
    ./0001-re_space_view_time_series-utils-patch-out-doctests-w.patch
  ];

  cargoHash = "sha256-qvnkOlcjADV4b+JfFAy9yNaZGaf0ZO7hh9HBg5XmPi0=";

  nativeBuildInputs = [
    (lib.getBin binaryen) # wasm-opt

    # @SomeoneSerge: Upstream suggests `mold`, but I didn't get it to work
    lld

    pkg-config
    protobuf
    rustfmt
  ];

  buildInputs =
    [
      freetype
      glib
      gtk3
      (lib.getDev openssl)
      libxkbcommon
      vulkan-loader
    ]
    ++ lib.optionals stdenv.isDarwin [
      darwin.apple_sdk.frameworks.AppKit
      darwin.apple_sdk.frameworks.CoreFoundation
      darwin.apple_sdk.frameworks.CoreGraphics
      darwin.apple_sdk.frameworks.CoreServices
      darwin.apple_sdk.frameworks.Foundation
      darwin.apple_sdk.frameworks.IOKit
      darwin.apple_sdk.frameworks.Metal
      darwin.apple_sdk.frameworks.QuartzCore
      darwin.apple_sdk.frameworks.Security
    ]
    ++ lib.optionals stdenv.isLinux [ (lib.getLib wayland) ];

  env.CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld";

  addBuildInputRunpathsPhase = ''
    declare _extraRunpaths
    _sep=
    for p in "''${pkgsHostTarget[@]}" ; do
      if [[ -d "$p/lib" ]] ; then
        _extraRunpaths+="$_sep$p/lib"
        if [[ -z "$_sep" ]] ; then
          _sep=:
        fi
      fi
    done

    elfHasDynamicSection() {
        patchelf --print-rpath "$1" >& /dev/null
    }

    while IFS= read -r -d $'\0' path ; do
      if elfHasDynamicSection "$path" ; then
        patchelf "$path" --add-rpath "''${_extraRunpaths}"
      fi
    done < <(
      for o in $(getAllOutputNames) ; do
        find "''${!o}" -type f -and "(" -executable -or -iname '*.so' ")" -print0
      done
    )

    unset _extraRunpaths
    unset _sep
  '';

  postPhases = lib.optionals stdenv.isLinux [ "addBuildInputRunpathsPhase" ];

  cargoTestFlags = [
    "-p"
    "rerun"
    "--workspace"
    "--exclude=crates/rerun/src/lib.rs"
  ];

  passthru.tests = {
    inherit (python3Packages) rerun-sdk;
  };

  meta = with lib; {
    description = "Visualize streams of multimodal data. Fast, easy to use, and simple to integrate.  Built in Rust using egui";
    homepage = "https://github.com/rerun-io/rerun";
    changelog = "https://github.com/rerun-io/rerun/blob/${src.rev}/CHANGELOG.md";
    license = with licenses; [
      asl20
      mit
    ];
    maintainers = with maintainers; [ SomeoneSerge ];
    mainProgram = "rerun";
  };
}
+70 −0
Original line number Diff line number Diff line
{
  buildPythonPackage,
  lib,
  rustPlatform,
  stdenv,
  attrs,
  numpy,
  pillow,
  pyarrow,
  rerun,
  torch,
  typing-extensions,
  pytestCheckHook,
  python,
}:

buildPythonPackage {
  pname = "rerun-sdk";
  inherit (rerun) version;
  pyproject = true;

  inherit (rerun) src;
  inherit (rerun) cargoDeps;

  nativeBuildInputs = [
    rustPlatform.cargoSetupHook
    rustPlatform.maturinBuildHook
  ];

  propagatedBuildInputs = [
    attrs
    numpy
    pillow
    pyarrow
    typing-extensions
  ];

  buildAndTestSubdir = "rerun_py";

  # https://github.com/NixOS/nixpkgs/issues/289340
  #
  # Alternatively, one could
  # dontUsePythonImportsCheck = true;
  # dontUsePytestCheck = true;
  postInstall = ''
    rm $out/${python.sitePackages}/rerun_sdk.pth
    ln -s rerun_sdk/rerun $out/${python.sitePackages}/rerun
  '';

  pythonImportsCheck = [ "rerun" ];

  nativeCheckInputs = [
    pytestCheckHook
    torch
  ];

  inherit (rerun) addBuildInputRunpathsPhase;
  postPhases = lib.optionals stdenv.isLinux [ "addBuildInputRunpathsPhase" ];

  disabledTestPaths = [
    # "fixture 'benchmark' not found"
    "tests/python/log_benchmark/test_log_benchmark.py"
  ];

  meta = {
    description = "Python bindings for `rerun` (an interactive visualization tool for stream data)";
    inherit (rerun.meta) changelog homepage license maintainers;
    mainProgram = "rerun";
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -12680,6 +12680,8 @@ self: super: with self; {
  reretry = callPackage ../development/python-modules/reretry { };
  rerun-sdk = callPackage ../development/python-modules/rerun-sdk { };
  resampy = callPackage ../development/python-modules/resampy { };
  resize-right = callPackage ../development/python-modules/resize-right { };