Unverified Commit 998308f5 authored by annalee's avatar annalee
Browse files
parent 4faea1c2
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
{ stdenv, lib, buildPythonPackage, fetchFromGitHub, augeas, cffi }:
{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, unittestCheckHook
, pkg-config
, augeas
, cffi
, pkgs # for libxml2
}:
buildPythonPackage rec {
    pname = "augeas";
    version = "1.1.0";
    version = "1.2.0";

    src = fetchFromGitHub {
      owner = "hercules-team";
      repo = "python-augeas";
      rev = "v${version}";
      sha256 = "12q52ilcx059rn544x3712xq6myn99niz131l0fs3xx67456pajh";
      hash = "sha256-Lq8ckra3sqN38zo1d5JsEq6U5TtLKRmqysoWNwR9J9A=";
    };

    # TODO: not very nice!
    postPatch =
      let libname = "libaugeas${stdenv.hostPlatform.extensions.sharedLibrary}";
      in
      ''
        substituteInPlace augeas/ffi.py \
          --replace 'ffi.dlopen("augeas")' \
                    'ffi.dlopen("${lib.makeLibraryPath [augeas]}/${libname}")'
      '';
    nativeBuildInputs = [ pkg-config ];

    propagatedBuildInputs = [ cffi augeas ];
    buildInputs = [ augeas pkgs.libxml2 ];

    doCheck = false;
    propagatedBuildInputs = [ cffi ];

    nativeCheckInputs = [ unittestCheckHook ];

    pythonImportsCheck = [ "augeas" ];

    meta = with lib; {
      changelog = "https://github.com/hercules-team/python-augeas/releases/tag/v${version}";
      description = "Pure python bindings for augeas";
      homepage = "https://github.com/hercules-team/python-augeas";
      license = licenses.lgpl2Plus;