Unverified Commit cbbbee5c authored by Martin Weinelt's avatar Martin Weinelt
Browse files

home-assistant: migrate to pythonRelaxDepsHook

Mutating the resulting wheel, which has a more stable format, is the
better solution, than the homegrown sed expression we used up until now.
parent d4010ce9
Loading
Loading
Loading
Loading
+23 −27
Original line number Diff line number Diff line
@@ -352,30 +352,12 @@ in python.pkgs.buildPythonApplication rec {
  };

  nativeBuildInputs = with python.pkgs; [
    pythonRelaxDepsHook
    setuptools
    wheel
  ];

  # copy tests early, so patches apply as they would to the git repo
  prePatch = ''
    cp --no-preserve=mode --recursive ${gitSrc}/tests ./
    chmod u+x tests/auth/providers/test_command_line_cmd.sh
  '';

  # leave this in, so users don't have to constantly update their downstream patch handling
  patches = [
    # Follow symlinks in /var/lib/hass/www
    ./patches/static-symlinks.patch

    # Patch path to ffmpeg binary
    (substituteAll {
      src = ./patches/ffmpeg-path.patch;
      ffmpeg = "${lib.getBin ffmpeg-headless}/bin/ffmpeg";
    })
  ];

  postPatch = let
    relaxedConstraints = [
  pythonRelaxDeps = [
    "aiohttp"
    "attrs"
    "awesomeversion"
@@ -395,12 +377,26 @@ in python.pkgs.buildPythonApplication rec {
    "voluptuous-serialize"
    "yarl"
  ];
  in ''
    sed -r -i \
      ${lib.concatStringsSep "\n" (map (package:
        ''-e 's/${package}[<>=]+.*/${package}",/g' \''
      ) relaxedConstraints)}
      pyproject.toml

  # copy tests early, so patches apply as they would to the git repo
  prePatch = ''
    cp --no-preserve=mode --recursive ${gitSrc}/tests ./
    chmod u+x tests/auth/providers/test_command_line_cmd.sh
  '';

  # leave this in, so users don't have to constantly update their downstream patch handling
  patches = [
    # Follow symlinks in /var/lib/hass/www
    ./patches/static-symlinks.patch

    # Patch path to ffmpeg binary
    (substituteAll {
      src = ./patches/ffmpeg-path.patch;
      ffmpeg = "${lib.getBin ffmpeg-headless}/bin/ffmpeg";
    })
  ];

  postPatch = ''
    substituteInPlace tests/test_config.py --replace '"/usr"' '"/build/media"'

    sed -i 's/setuptools[~=]/setuptools>/' pyproject.toml