about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/dbus-python/default.nix
blob: be7504e5dc372f7c6dafb24ce6bbd40e7a04b1a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ lib, stdenv, fetchPypi, buildPythonPackage, python, pkg-config, dbus, dbus-glib, isPyPy
, ncurses, pygobject3, isPy3k, pythonAtLeast }:

buildPythonPackage rec {
  pname = "dbus-python";
  version = "1.2.18";

  # ModuleNotFoundError: No module named 'distutils'
  disabled = isPyPy || pythonAtLeast "3.12";
  format = "other";
  outputs = [ "out" "dev" ];

  src = fetchPypi {
    inherit pname version;
    sha256 = "0q3jrw515z98mqdk9x822nd95rky455zz9876f1nqna5igkd3gcj";
  };

  patches = [
    ./fix-includedir.patch
  ];

  preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11" && stdenv.isDarwin) ''
    MACOSX_DEPLOYMENT_TARGET=10.16
  '';

  configureFlags = [
    "PYTHON=${python.pythonOnBuildForHost.interpreter}"
  ];

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ dbus dbus-glib ]
    # My guess why it's sometimes trying to -lncurses.
    # It seems not to retain the dependency anyway.
    ++ lib.optional (! python ? modules) ncurses;

  doCheck = isPy3k;
  nativeCheckInputs = [ dbus.out pygobject3 ];

  postInstall = ''
    cp -r dbus_python.egg-info $out/${python.sitePackages}/
  '';

  meta = with lib; {
    description = "Python DBus bindings";
    license = licenses.mit;
    platforms = dbus.meta.platforms;
    maintainers = with maintainers; [ ];
  };
}