Skip to content

Commit

Permalink
python3.pkgs.xdot: 1.2 -> 1.3
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
doronbehar committed Sep 23, 2023
1 parent 46688f8 commit 9737ed6
Showing 1 changed file with 41 additions and 17 deletions.
58 changes: 41 additions & 17 deletions pkgs/development/python-modules/xdot/default.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,55 @@
{ lib, buildPythonPackage, fetchPypi, isPy3k, python, xvfb-run
, wrapGAppsHook, gobject-introspection, pygobject3, graphviz, gtk3, numpy }:
{ lib
, buildPythonPackage
, fetchFromGitHub
, isPy3k
, 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;
sha256 = "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 ]}"
'';
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";
Expand Down

0 comments on commit 9737ed6

Please sign in to comment.