summary refs log tree commit diff
path: root/pkgs/development/libraries/bamf
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2019-11-13 14:23:13 -0500
committerworldofpeace <worldofpeace@protonmail.ch>2019-11-13 14:23:13 -0500
commitb0012a97367d44cd996edc6b4b5a6e0a2d8d4170 (patch)
treee61f87cb4dc4076d08dd88b4b6e08300b07aaa14 /pkgs/development/libraries/bamf
parent3e7fcc4d18aae1b75ea9ffa90bb85381c05da6bd (diff)
bamf: port tests to python3 lxml
Diffstat (limited to 'pkgs/development/libraries/bamf')
-rw-r--r--pkgs/development/libraries/bamf/default.nix13
-rw-r--r--pkgs/development/libraries/bamf/gtester2xunit-python3.patch53
2 files changed, 62 insertions, 4 deletions
diff --git a/pkgs/development/libraries/bamf/default.nix b/pkgs/development/libraries/bamf/default.nix
index ec985fcc02f22..7c22c104c30c3 100644
--- a/pkgs/development/libraries/bamf/default.nix
+++ b/pkgs/development/libraries/bamf/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, autoconf, automake, libtool, gnome3, which, fetchgit, libgtop, libwnck3, glib, vala, pkgconfig
+{ stdenv, fetchpatch, autoconf, automake, libtool, gnome3, which, fetchgit, libgtop, libwnck3, glib, vala, pkgconfig
 , libstartup_notification, gobject-introspection, gtk-doc, docbook_xsl
-, xorgserver, dbus, python2, wrapGAppsHook }:
+, xorgserver, dbus, python3, wrapGAppsHook }:
 
 stdenv.mkDerivation rec {
   pname = "bamf";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchgit {
-    url = https://git.launchpad.net/~unity-team/bamf;
+    url = "https://git.launchpad.net/~unity-team/bamf";
     rev = version;
     sha256 = "1klvij1wyhdj5d8sr3b16pfixc1yk8ihglpjykg7zrr1f50jfgsz";
   };
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     vala
     which
     # Tests
-    (python2.withPackages(ps: with ps; [ libxslt libxml2 ]))
+    (python3.withPackages(ps: with ps; [ lxml ]))
     dbus
     xorgserver
     wrapGAppsHook
@@ -39,6 +39,11 @@ stdenv.mkDerivation rec {
     libwnck3
   ];
 
+  patches = [
+    # Port tests and checks to python3 lxml.
+    ./gtester2xunit-python3.patch
+  ];
+
   # Fix hard-coded path
   # https://bugs.launchpad.net/bamf/+bug/1780557
   postPatch = ''
diff --git a/pkgs/development/libraries/bamf/gtester2xunit-python3.patch b/pkgs/development/libraries/bamf/gtester2xunit-python3.patch
new file mode 100644
index 0000000000000..8dc4785419435
--- /dev/null
+++ b/pkgs/development/libraries/bamf/gtester2xunit-python3.patch
@@ -0,0 +1,53 @@
+diff --git a/configure.ac b/configure.ac
+index 41cb7db..93ef0ec 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -115,9 +115,9 @@ GTK_DOC_CHECK(1.0)
+ 
+ AC_PATH_PROG([PYTHON],[python])
+ AC_MSG_CHECKING(for gtester2xunit dependencies)
+-if !($PYTHON -c "import libxslt, libxml2" 2> /dev/null); then
++if !($PYTHON -c "import lxml" 2> /dev/null); then
+   AC_MSG_RESULT([no])
+-  AC_MSG_ERROR([You need to install python-libxslt1 and python-libxml2]);
++  AC_MSG_ERROR([You need to install python-lxml]);
+ fi
+ AC_MSG_RESULT([yes])
+ 
+@@ -189,6 +189,6 @@ ${PACKAGE}-${VERSION}
+     Introspection:        ${enable_introspection}
+     Headless tests:       ${enable_headless_tests}
+     Coverage Reporting:   ${use_gcov}
+-    Export actions menus: ${enable_export_actions_menu} 
++    Export actions menus: ${enable_export_actions_menu}
+ 
+ EOF
+diff --git a/tests/gtester2xunit.py b/tests/gtester2xunit.py
+index fbe3c66..861d541 100755
+--- a/tests/gtester2xunit.py
++++ b/tests/gtester2xunit.py
+@@ -1,18 +1,17 @@
+ #! /usr/bin/python
+ from argparse import ArgumentParser
+-import libxslt
+-import libxml2
+ import sys
+ import os
++from lxml import etree
+ 
+ XSL_TRANSFORM='/usr/share/gtester2xunit/gtester.xsl'
+ 
+ def transform_file(input_filename, output_filename, xsl_file):
+-    gtester = libxml2.parseFile(xsl_file)
+-    style = libxslt.parseStylesheetDoc(gtester)
+-    doc = libxml2.parseFile(input_filename)
+-    result = style.applyStylesheet(doc, None)
+-    result.saveFormatFile(filename=output_filename, format=True)
++    gtester = etree.parse(xsl_file)
++    style = etree.XSLT(gtester)
++    doc = etree.parse(input_filename)
++    result = style(doc)
++    result.write(filename=output_filename, format=True)
+ 
+ 
+ def get_output_filename(input_filename):