nixpkgs/pkgs/development/python-modules/xdot/default.nix
Robert K. Bell 6d355e44f8
xdot: fix tests
`nix-shell -p xdot` was failing, with an error like:

    builder for '/nix/store/n3yjqssn531c52sbkmpqvczmy5c0lm8n-python3.8-xdot-1.2.drv' failed with exit code 1; last 10 log lines:
          import numpy
      ModuleNotFoundError: No module named 'numpy'

Adding numpy uncovered another error, about not being able to initialize
gtk:

    error: Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>
    error: --- Error -------------------------------------------------------------------------------------------------------------------------------------------- nix-shell
    builder for '/nix/store/brz6q1ri12z51z3l2p5d6ny2jsf3qkjg-python3.8-xdot-1.2.drv' failed with exit code 1; last 10 log lines:
          raise RuntimeError(
      RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.
2021-01-01 17:54:56 +11:00

31 lines
929 B
Nix

{ lib, buildPythonPackage, fetchPypi, isPy3k, python3, xvfb_run, stdenv
, wrapGAppsHook, gobject-introspection, pygobject3, graphviz, gtk3, numpy }:
buildPythonPackage rec {
pname = "xdot";
version = "1.2";
src = fetchPypi {
inherit pname version;
sha256 = "3df91e6c671869bd2a6b2a8883fa3476dbe2ba763bd2a7646cf848a9eba71b70";
};
disabled = !isPy3k;
nativeBuildInputs = [ wrapGAppsHook ];
propagatedBuildInputs = [ gobject-introspection pygobject3 graphviz gtk3 numpy ];
checkInputs = [ xvfb_run ];
checkPhase = ''
xvfb-run -s '-screen 0 800x600x24' ${python3.interpreter} nix_run_setup test
'';
# https://github.com/NixOS/nixpkgs/pull/107872#issuecomment-752175866
doCheck = stdenv.isLinux;
meta = with lib; {
description = "An interactive viewer for graphs written in Graphviz's dot";
homepage = "https://github.com/jrfonseca/xdot.py";
license = licenses.lgpl3Plus;
};
}