<commit_before>{ lib, buildPythonPackage, fetchPypi, liberasurecode, six }:

buildPythonPackage rec {
  pname = "pyeclib";
  version = "1.6.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-gBHjHuia5/uZymkWZgyH4BCEZqmWK9SXowAQIJdOO7E=";
  };

  postPatch = ''
    # patch dlopen call
    substituteInPlace src/c/pyeclib_c/pyeclib_c.c \
      --replace "liberasurecode.so" "${liberasurecode}/lib/liberasurecode.so"
  '';

  preBuild = ''
    # required for the custom find_library function in setup.py
    export LD_LIBRARY_PATH="${lib.makeLibraryPath [ liberasurecode ]}"
  '';

  buildInputs = [ liberasurecode ];

  checkInputs = [ six ];

  pythonImportsCheck = [ "pyeclib" ];

  meta = with lib; {
    description = "This library provides a simple Python interface for implementing erasure codes.";
    homepage = "https://github.com/openstack/pyeclib";
    license = licenses.bsd2;<commit_msg>python3Packages.pyeclib: fix for darwin<commit_after>{ lib, stdenv, buildPythonPackage, fetchPypi, liberasurecode, six }:

buildPythonPackage rec {
  pname = "pyeclib";
  version = "1.6.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-gBHjHuia5/uZymkWZgyH4BCEZqmWK9SXowAQIJdOO7E=";
  };

  postPatch = ''
    # patch dlopen call
    substituteInPlace src/c/pyeclib_c/pyeclib_c.c \
      --replace "liberasurecode.so" "${liberasurecode}/lib/liberasurecode.so"
    # python's platform.platform() doesn't return "Darwin" (anymore?)
    substituteInPlace setup.py \
      --replace '"Darwin"' '"macOS"'
  '';

  preBuild = let
    ldLibraryPathEnvName = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
  in ''
    # required for the custom _find_library function in setup.py
    export ${ldLibraryPathEnvName}="${lib.makeLibraryPath [ liberasurecode ]}"
  '';

  buildInputs = [ liberasurecode ];

  checkInputs = [ six ];

  pythonImportsCheck = [ "pyeclib" ];

  meta = with lib; {
    description = "This library provides a simple Python interface for implementing erasure codes.";
    homepage = "https://github.com/openstack/pyeclib";
    license = licenses.bsd2;
{'fraction_non_alphanumeric': 0.12024424612494129, 'fraction_numerical': 0.013621418506341005, 'mean_word_length': 3.7865168539325844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6075097', 'n_tokens_mistral': 788, 'n_tokens_neox': 731, 'n_words': 153}