Unverified Commit 20be50bf authored by dotlambda's avatar dotlambda Committed by GitHub
Browse files

linien-gui: fix build (#400799)

parents b07044de 17746630
Loading
Loading
Loading
Loading
+26 −14
Original line number Diff line number Diff line
@@ -4,20 +4,26 @@
  qt5,
}:

python3.pkgs.buildPythonApplication rec {
let
  python = python3.override {
    self = python;
    packageOverrides = self: super: {
      numpy = super.numpy_1;
    };
  };
in
python.pkgs.buildPythonApplication rec {
  pname = "linien-gui";
  pyproject = true;

  inherit (python3.pkgs.linien-common) src version;
  inherit (python.pkgs.linien-common) src version;

  sourceRoot = "${src.name}/linien-gui";

  nativeBuildInputs =
    with python3.pkgs;
    [
  build-system = with python.pkgs; [
    setuptools
    ]
    ++ [
  ];
  nativeBuildInputs = [
    qt5.wrapQtAppsHook
  ];

@@ -27,7 +33,7 @@ python3.pkgs.buildPythonApplication rec {
    qt5.qtwayland
  ];

  propagatedBuildInputs = with python3.pkgs; [
  dependencies = with python.pkgs; [
    appdirs
    click
    pyqtgraph
@@ -43,13 +49,19 @@ python3.pkgs.buildPythonApplication rec {
    makeWrapperArgs+=("''${qtWrapperArgs[@]}")
  '';

  meta = with lib; {
  passthru = {
    # Useful for creating .withPackages environments, see NOTE near
    # `python3Packages.linien-common.meta.broken`.
    inherit python;
  };

  meta = {
    description = "Graphical user interface of the Linien spectroscopy lock application";
    mainProgram = "linien";
    homepage = "https://github.com/linien-org/linien/tree/develop/linien-gui";
    changelog = "https://github.com/linien-org/linien/blob/v${version}/CHANGELOG.md";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [
      fsagbuya
      doronbehar
    ];
+7 −5
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@ buildPythonPackage rec {
    export HOME=$(mktemp -d)
  '';

  nativeBuildInputs = [ setuptools ];
  build-system = [ setuptools ];

  propagatedBuildInputs = [
  dependencies = [
    fabric
    typing-extensions
    numpy
@@ -33,14 +33,16 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "linien_client" ];

  meta = with lib; {
  meta = {
    description = "Client components of the Linien spectroscopy lock application";
    homepage = "https://github.com/linien-org/linien/tree/develop/linien-client";
    changelog = "https://github.com/linien-org/linien/blob/v${version}/CHANGELOG.md";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [
      fsagbuya
      doronbehar
    ];
    # See comment near linien-common.meta.broken
    broken = lib.versionAtLeast numpy.version "2";
  };
}
+33 −3
Original line number Diff line number Diff line
@@ -47,14 +47,44 @@ buildPythonPackage rec {
    pytest = callPackage ./tests.nix { };
  };

  meta = with lib; {
  meta = {
    description = "Shared components of the Linien spectroscopy lock application";
    homepage = "https://github.com/linien-org/linien/tree/develop/linien-common";
    changelog = "https://github.com/linien-org/linien/blob/v${version}/CHANGELOG.md";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [
      fsagbuya
      doronbehar
    ];
    # Numpy 2 is not supported yet, because the server linien, (installed on the
    # RedPitaya) must use the same Numpy version as the client (installed with
    # Nix). The server linien is bound to use Numpy 1 because Numpy maintainers
    # don't distribute pre-built wheels for the armv7l architecture of
    # RedPitaya, and it is unfeasible to build it natively there - something
    # that `pip install numpy` naively tries to do. Hence, we are bound to use
    # on the server the preinstalled Numpy 1 sourced in the .deb package that
    # comes with the RedPitaya OS. See also:
    #
    # - https://github.com/linien-org/linien/commit/ebbb2276b500a18826d11893bb43699b65692c5e
    # - https://github.com/linien-org/linien/issues/377
    #
    # To evaluate this package with python3.withPackages, use:
    #
    # pythonEnv = pkgs.linien-gui.passthru.python.withPackages(ps: {
    #   ps.linien-common
    #   # Other packages...
    # });
    #
    # NOTE that the above Python environment will use Numpy 1 throughout all
    # packages wrapped there (see expression in linien-gui), and this may
    # trigger rebuilds for dependencies that depend on Numpy too. Be ready to
    # also add more `packageOverrides` to make sure these other dependencies do
    # build with numpy_1.
    #
    # Last NOTE: If you need more packageOverrides besides those provided in
    # the `linien-gui` expression, beware of:
    #
    # - https://github.com/NixOS/nixpkgs/issues/44426
    broken = lib.versionAtLeast numpy.version "2";
  };
}
+13 −1
Original line number Diff line number Diff line
@@ -84,10 +84,22 @@ let
      })
    ];

    # A NOTE regarding the Numpy version relaxing: Both Numpy versions 1.x &
    # 2.x are supported. However upstream wants to always build with Numpy 2,
    # and with it to still be able to run with a Numpy 1 or 2. We insist to
    # perform this substitution even though python3.pkgs.numpy is of version 2
    # nowadays, because our ecosystem unfortunately doesn't allow easily
    # separating runtime and build-system dependencies. See also:
    #
    # https://discourse.nixos.org/t/several-comments-about-priorities-and-new-policies-in-the-python-ecosystem/51790
    #
    # Being able to build (& run) with Numpy 1 helps for python environments
    # that override globally the `numpy` attribute to point to `numpy_1`.
    postPatch = ''
      substituteInPlace pyproject.toml \
        --replace-fail "numpy>2.0.0,<2.5" numpy \
        --replace-fail "meson-python==0.13.1" "meson-python>=0.13.1" \
        --replace-fail "meson==1.2.1" "meson>=1.2.1" \
        --replace-fail "meson==1.2.1" "meson>=1.2.1"
    '';

    nativeBuildInputs = [
+15 −0
Original line number Diff line number Diff line
@@ -91,6 +91,21 @@ buildPythonPackage {
      excludes = [ "doc/source/dev/contributor/meson_advanced.rst" ];
    })
  ];
  # A NOTE regarding the Numpy version relaxing: Both Numpy versions 1.x &
  # 2.x are supported. However upstream wants to always build with Numpy 2,
  # and with it to still be able to run with a Numpy 1 or 2. We insist to
  # perform this substitution even though python3.pkgs.numpy is of version 2
  # nowadays, because our ecosystem unfortunately doesn't allow easily
  # separating runtime and build-system dependencies. See also:
  #
  # https://discourse.nixos.org/t/several-comments-about-priorities-and-new-policies-in-the-python-ecosystem/51790
  #
  # Being able to build (& run) with Numpy 1 helps for python environments
  # that override globally the `numpy` attribute to point to `numpy_1`.
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "numpy>2.0.0,<2.5" numpy
  '';

  build-system =
    [