Commit 77cdfc9f authored by Paul Meyer's avatar Paul Meyer
Browse files

libdnf: enable python bindings

parent a222ff94
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -16,12 +16,18 @@
, rpm
, zchunk
, cppunit
, python
, swig
, glib
, sphinx
}:

stdenv.mkDerivation rec {
  pname = "libdnf";
  version = "0.72.0";

  outputs = [ "out" "dev" "py" ];

  src = fetchFromGitHub {
    owner = "rpm-software-management";
    repo = pname;
@@ -44,6 +50,9 @@ stdenv.mkDerivation rec {
    libyaml
    libmodulemd
    zchunk
    python
    swig
    sphinx
  ];

  propagatedBuildInputs = [
@@ -58,18 +67,32 @@ stdenv.mkDerivation rec {
    cp ${libsolv}/share/cmake/Modules/FindLibSolv.cmake cmake/modules/
  '';

  patches = [
    ./fix-python-install-dir.patch
  ];

  postPatch = ''
    # https://github.com/rpm-software-management/libdnf/issues/1518
    substituteInPlace libdnf/libdnf.pc.in \
      --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
    substituteInPlace cmake/modules/FindPythonInstDir.cmake \
      --replace "@PYTHON_INSTALL_DIR@" "$out/${python.sitePackages}"
  '';

  cmakeFlags = [
    "-DWITH_GTKDOC=OFF"
    "-DWITH_HTML=OFF"
    "-DWITH_BINDINGS=OFF"
    "-DPYTHON_DESIRED=${lib.head (lib.splitString ["."] python.version)}"
  ];

  postInstall = ''
    rm -r $out/${python.sitePackages}/hawkey/test
  '';

  postFixup = ''
    moveToOutput "lib/${python.libPrefix}" "$py"
  '';

  meta = with lib; {
    description = "Package management library";
    homepage = "https://github.com/rpm-software-management/libdnf";
+12 −0
Original line number Diff line number Diff line
diff --git a/cmake/modules/FindPythonInstDir.cmake b/cmake/modules/FindPythonInstDir.cmake
index ed098ded..2a2e1543 100644
--- a/cmake/modules/FindPythonInstDir.cmake
+++ b/cmake/modules/FindPythonInstDir.cmake
@@ -1,6 +1 @@
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "
-from sys import stdout
-from sysconfig import get_path
-path=get_path(name='platlib', vars={'platbase':'${CMAKE_INSTALL_PREFIX}'})
-stdout.write(path)"
-OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+SET(PYTHON_INSTALL_DIR "@PYTHON_INSTALL_DIR@")
+1 −1
Original line number Diff line number Diff line
@@ -22658,7 +22658,7 @@ with pkgs;
  libdnet = callPackage ../development/libraries/libdnet { };
  libdnf = callPackage ../tools/package-management/libdnf { };
  libdnf = callPackage ../tools/package-management/libdnf { python = python3; };
  libdovi = callPackage ../development/libraries/libdovi { };
+7 −0
Original line number Diff line number Diff line
@@ -6139,6 +6139,13 @@ self: super: with self; {
  libcst = callPackage ../development/python-modules/libcst { };
  libdnf = lib.pipe pkgs.libdnf [
    toPythonModule
    (p: p.overrideAttrs (super: { meta = super.meta // { outputsToInstall = [ "py" ]; }; }))
    (p: p.override { inherit python; })
    (p: p.py)
  ];
  libevdev = callPackage ../development/python-modules/libevdev { };
  libfdt = toPythonModule (pkgs.dtc.override {