summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/matplotlib-setupext-tk.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/matplotlib-setupext-tk.patch')
-rw-r--r--gnu/packages/patches/matplotlib-setupext-tk.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/gnu/packages/patches/matplotlib-setupext-tk.patch b/gnu/packages/patches/matplotlib-setupext-tk.patch
new file mode 100644
index 0000000000..37c3d686e0
--- /dev/null
+++ b/gnu/packages/patches/matplotlib-setupext-tk.patch
@@ -0,0 +1,34 @@
+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()