Unverified Commit 4956e095 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

pywal16: fix missing dependency; allow build with backends (#470945)

parents a995100f b1c8fe74
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -2,9 +2,17 @@
  lib,
  python3,
  fetchFromGitHub,
  imagemagick,
  installShellFiles,
  nix-update-script,

  imagemagick,
  colorz,

  withColorthief ? false,
  withColorz ? false,
  withFastColorthief ? false,
  withHaishoku ? false,
  withModernColorthief ? false,
}:

python3.pkgs.buildPythonApplication rec {
@@ -23,11 +31,22 @@ python3.pkgs.buildPythonApplication rec {

  nativeBuildInputs = [ installShellFiles ];

  dependencies =
    lib.optionals withColorthief optional-dependencies.colorthief
    ++ lib.optionals withColorz optional-dependencies.colorz
    ++ lib.optionals withFastColorthief optional-dependencies.fast-colorthief
    ++ lib.optionals withHaishoku optional-dependencies.haishoku
    ++ lib.optionals withModernColorthief optional-dependencies.modern_colorthief;

  nativeCheckInputs = [
    python3.pkgs.pytestCheckHook
    imagemagick
  ];

  makeWrapperArgs = [
    "--prefix PATH : ${lib.makeBinPath ([ imagemagick ] ++ lib.optional withColorz colorz)}"
  ];

  postInstall = ''
    installManPage data/man/man1/wal.1
  '';
@@ -43,11 +62,13 @@ python3.pkgs.buildPythonApplication rec {
    colorz = [ colorz ];
    fast-colorthief = [ fast-colorthief ];
    haishoku = [ haishoku ];
    modern_colorthief = [ modern-colorthief ];
    all = [
      colorthief
      colorz
      ast-colorthief
      fast-colorthief
      haishoku
      modern-colorthief
    ];
  };

+56 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  cmake,
  nix-update-script,

  numpy,
  pillow,
}:

buildPythonPackage rec {
  pname = "fast-colorthief";
  version = "0.0.5";
  pyproject = true;

  # No tags on github
  src = fetchPypi {
    inherit pname version;
    hash = "sha256-yUO1vnOt2NPyldPjFMn0jbhVX8zHcKsJ2IFVugYBZa4=";
  };

  postPatch = ''
    substituteInPlace CMakeLists.txt --replace-fail \
      "cmake_minimum_required(VERSION 2.8.12)" \
      "cmake_minimum_required(VERSION 3.10)"
    substituteInPlace pybind11/CMakeLists.txt --replace-fail \
      "cmake_minimum_required(VERSION 3.4)" \
      "cmake_minimum_required(VERSION 3.10)"
  '';

  build-system = [
    setuptools
    cmake
  ];

  dependencies = [
    pillow
    numpy
  ];

  # return to project root to locate pyproject.toml for build
  preBuild = "cd ..";

  pythonImportsCheck = [ "fast_colorthief" ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Selection of most dominant colors in image using Modified Median Cut Quantization";
    homepage = "https://github.com/bedapisl/fast-colorthief";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ moraxyc ];
  };
}
+40 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  nix-update-script,

  pillow,
}:

buildPythonPackage rec {
  pname = "haishoku";
  version = "1.1.8";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "LanceGin";
    repo = "haishoku";
    tag = "v${version}";
    hash = "sha256-LSoZopCaM5vbknGS9gG13OZIgghgqJvPtktUkBCH04Q=";
  };

  build-system = [ setuptools ];

  dependencies = [ pillow ];

  # no test
  doCheck = false;

  pythonImportsCheck = [ "haishoku" ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Development tool for grabbing the dominant color or representative color palette from an image";
    homepage = "https://github.com/LanceGin/haishoku";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ moraxyc ];
  };
}
+4 −0
Original line number Diff line number Diff line
@@ -5208,6 +5208,8 @@ self: super: with self; {
  fast-array-utils = callPackage ../development/python-modules/fast-array-utils { };
  fast-colorthief = callPackage ../development/python-modules/fast-colorthief { };
  fast-histogram = callPackage ../development/python-modules/fast-histogram { };
  fast-query-parsers = callPackage ../development/python-modules/fast-query-parsers { };
@@ -6676,6 +6678,8 @@ self: super: with self; {
  hacking = callPackage ../development/python-modules/hacking { };
  haishoku = callPackage ../development/python-modules/haishoku { };
  hakuin = callPackage ../development/python-modules/hakuin { };
  halide =