From b40cf5522bcc15166ca07dfbae50167203d29e2d Mon Sep 17 00:00:00 2001 From: Federico Beffa Date: Tue, 1 Dec 2015 17:20:59 +0100 Subject: [PATCH 1/2] gnu: python-matplotlib: Add 'TkAgg' backend and update to version '1.4.3'. * gnu/packages/python.scm (python-matplotlib): Do it. * gnu/packages/patches/matplotlib-setupext-tk.patch: New file. --- gnu/packages/patches/matplotlib-setupext-tk.patch | 30 +++++++++++++++++++++++ gnu/packages/python.scm | 17 +++++++++---- 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 gnu/packages/patches/matplotlib-setupext-tk.patch diff --git a/gnu/packages/patches/matplotlib-setupext-tk.patch b/gnu/packages/patches/matplotlib-setupext-tk.patch new file mode 100644 index 0000000..cd0332e --- /dev/null +++ b/gnu/packages/patches/matplotlib-setupext-tk.patch @@ -0,0 +1,30 @@ +Use 'pkg-config' instead of heuristics to find 'tk' flags. + +--- matplotlib-1.4.3/setupext.py.orig 2015-12-01 14:21:19.554417453 +0100 ++++ matplotlib-1.4.3/setupext.py 2015-12-01 14:35:51.999928797 +0100 +@@ -1457,7 +1457,7 @@ + p = subprocess.Popen( + '. %s ; eval echo ${%s}' % (file, varname), + shell=True, +- executable="/bin/sh", ++ executable="sh", + stdout=subprocess.PIPE) + result = p.communicate()[0] + return result.decode('ascii') +@@ -1601,8 +1601,15 @@ + # of distros. + + # Query Tcl/Tk system for library paths and version string ++ def getoutput(s): ++ ret = os.popen(s).read().strip() ++ return ret + try: +- tcl_lib_dir, tk_lib_dir, tk_ver = self.query_tcltk() ++ #tcl_lib_dir, tk_lib_dir, tk_ver = self.query_tcltk() ++ pkg_config_res = getoutput('pkg-config --libs tk').split() ++ tk_ver = pkg_config_res[-1][-3:] ++ tcl_lib_dir = pkg_config_res[0][2:] + '/tcl' + tk_ver ++ tk_lib_dir = pkg_config_res[1][2:] + '/tk' + tk_ver + except: + tk_ver = '' + result = self.hardcoded_tcl_config() diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 39d0751..5e23bab 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -3175,7 +3175,7 @@ transcendental functions).") (define-public python-matplotlib (package (name "python-matplotlib") - (version "1.4.2") + (version "1.4.3") (source (origin (method url-fetch) @@ -3183,13 +3183,15 @@ transcendental functions).") "/matplotlib-" version ".tar.gz")) (sha256 (base32 - "0m6v9nwdldlwk22gcd339zg6mny5m301fxgks7z8sb8m9wawg8qp")))) + "1dn05cvd0g984lzhh72wa0z93psgwshbbg93fkab6slx5m3l95av")) + (patches (list (search-patch "matplotlib-setupext-tk.patch"))))) (build-system python-build-system) (outputs '("out" "doc")) (propagated-inputs ; the following packages are all needed at run time `(("python-pyparsing" ,python-pyparsing) ("python-pygobject" ,python-pygobject) ("gobject-introspection" ,gobject-introspection) + ("python" ,python "tk") ;; The 'gtk+' package (and 'gdk-pixbuf', 'atk' and 'pango' propagated ;; from 'gtk+') provides the required 'typelib' files used by ;; 'gobject-introspection'. The location of these files is set with the @@ -3224,7 +3226,8 @@ transcendental functions).") ;; FIXME: Add backends when available. ;("python-wxpython" ,python-wxpython) ;("python-pyqt" ,python-pyqt) - )) + ("tcl" ,tcl) + ("tk" ,tk))) (native-inputs `(("pkg-config" ,pkg-config) ("texlive" ,texlive) @@ -3243,8 +3246,12 @@ transcendental functions).") (setenv "HOME" (getcwd)) (call-with-output-file "setup.cfg" (lambda (port) - (format port "[rc_options]~% -backend = GTK3Agg~%"))))) + (format port "[directories]~% +basedirlist = ~a,~a~% +[rc_options]~% +backend = TkAgg~%" + (assoc-ref inputs "tcl") + (assoc-ref inputs "tk")))))) (alist-cons-after 'install 'install-doc (lambda* (#:key outputs #:allow-other-keys) -- 2.4.3