python3.pkgs.xdot: 1.2 -> 1.3

Numerous other fixes / improvements:
- Format expression with 1 line per argument and input
- Use fetchFromGitHub to fetch the `test.py` file not distributed with
  the pypi source.
- Enable tests.
- Prevent double wrapping by setting makeWrapperArgs instead of using
  wrapProgram.
- Run check hooks.
This commit is contained in:
Doron Behar 2023-09-15 12:00:08 +03:00
parent 46688f8eb5
commit 2f244e3647

View File

@ -1,31 +1,57 @@
{ lib, buildPythonPackage, fetchPypi, isPy3k, python, xvfb-run
, wrapGAppsHook, gobject-introspection, pygobject3, graphviz, gtk3, numpy }:
{ lib
, buildPythonPackage
, fetchFromGitHub
, python
, xvfb-run
, wrapGAppsHook
, gobject-introspection
, pygobject3
, graphviz
, gtk3
, numpy
}:
buildPythonPackage rec {
pname = "xdot";
version = "1.2";
version = "1.3";
src = fetchPypi {
inherit pname version;
sha256 = "3df91e6c671869bd2a6b2a8883fa3476dbe2ba763bd2a7646cf848a9eba71b70";
src = fetchFromGitHub {
owner = "jrfonseca";
repo = "xdot.py";
rev = version;
hash = "sha256-0UfvN7z7ThlFu825h03Z5Wur9zbiUpvD5cb5gcIhQQI=";
};
disabled = !isPy3k;
nativeBuildInputs = [ gobject-introspection wrapGAppsHook ];
propagatedBuildInputs = [ pygobject3 graphviz gtk3 numpy ];
nativeCheckInputs = [ xvfb-run ];
nativeBuildInputs = [
gobject-introspection
wrapGAppsHook
];
propagatedBuildInputs = [
pygobject3
graphviz
gtk3
numpy
];
nativeCheckInputs = [
xvfb-run
];
postInstall = ''
wrapProgram "$out/bin/xdot" --prefix PATH : "${lib.makeBinPath [ graphviz ]}"
dontWrapGApps = true;
# Arguments to be passed to `makeWrapper`, only used by buildPython*
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ graphviz ]})
'';
checkPhase = ''
xvfb-run -s '-screen 0 800x600x24' ${python.interpreter} nix_run_setup test
runHook preCheck
xvfb-run -s '-screen 0 800x600x24' ${python.interpreter} test.py
runHook postCheck
'';
# https://github.com/NixOS/nixpkgs/pull/107872#issuecomment-752175866
# cannot import name '_gi' from partially initialized module 'gi' (most likely due to a circular import)
doCheck = false;
doCheck = true;
meta = with lib; {
description = "An interactive viewer for graphs written in Graphviz's dot";