Unverified Commit e2e13364 authored by K900's avatar K900 Committed by GitHub
Browse files

Merge pull request #145130 from marius851000/patoolfix

patool: fix the non-use of hard-coded binary
parents 3aa086b0 87f831c3
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
{ lib, buildPythonPackage, fetchFromGitHub, pytestCheckHook, p7zip,
  unzip, cabextract, zip, zopfli, lzip, zpaq, gnutar, gnugrep, diffutils, file,
  cabextract, zip, lzip, zpaq, gnutar, gnugrep, diffutils, file,
  gzip, bzip2, xz}:

# unrar is unfree, as well as 7z with unrar support, not including it (patool doesn't support unar)
# it will still use unrar if present in the path

let
  compression-utilities = [
    p7zip
    unzip
    gnutar
    cabextract
    zip
    zopfli
    lzip
    zpaq
    gzip
@@ -34,9 +33,9 @@ buildPythonPackage rec {
    sha256 = "0v4r77sm3yzh7y1whfwxmp01cchd82jbhvbg9zsyd2yb944imzjy";
  };

  prePatch = ''
  postPatch = ''
    substituteInPlace patoolib/util.py \
      --replace "path = None" 'path = append_to_path(os.environ["PATH"], "${lib.makeBinPath compression-utilities}")'
      --replace "path = None" 'path = os.environ["PATH"] + ":${lib.makeBinPath compression-utilities}"'
  '';

  checkInputs = [ pytestCheckHook ] ++ compression-utilities;