guix/gnu/packages/patches/matplotlib-setupext-tk.patch
Federico Beffa 1bbc659fd2 gnu: python-matplotlib: Add 'TkAgg' backend and update to version '1.4.3'.
* gnu/packages/python.scm (python-matplotlib, python2-matplotlib): Do it.
* gnu/packages/patches/matplotlib-setupext-tk.patch: New file.
* gnu-system.am (dist_patch_DATA): Add the new patch.
2015-12-02 18:21:13 +01:00

35 lines
1.6 KiB
Diff

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-02 10:39:47.282363530 +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,19 @@
# 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()
+ pkg_config_libs = getoutput('pkg-config --libs-only-L tk').split()
+ # drop '-L' part of strings
+ pkg_config_libs = [s[2:] for s in pkg_config_libs]
+ pkg_config_ver = getoutput('pkg-config --modversion tk')
+ tk_ver = re.match(r"(\d+.\d+)[\d.]*", pkg_config_ver).group(1)
+ tcl_lib_dir = next(s for s in pkg_config_libs
+ if re.match(r".*-tcl-.*", s)) + '/tcl' + tk_ver
+ tk_lib_dir = next(s for s in pkg_config_libs
+ if re.match(r".*-tk-.*", s)) + '/tk' + tk_ver
except:
tk_ver = ''
result = self.hardcoded_tcl_config()