From 2f244e3647bdf63b8aeca31a2f88091ffb3a9041 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 15 Sep 2023 12:00:08 +0300 Subject: [PATCH] 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. --- .../python-modules/xdot/default.nix | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/pkgs/development/python-modules/xdot/default.nix b/pkgs/development/python-modules/xdot/default.nix index cd7fdd9a218b..3e1ce8b1477a 100644 --- a/pkgs/development/python-modules/xdot/default.nix +++ b/pkgs/development/python-modules/xdot/default.nix @@ -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";