Re: Byte-compiled files in matplotlib-py-1.5.1-2

Derek Homeier <[email protected]>
Newsgroups gmane.os.apple.fink.devel
Message-ID <BE12208B-45BD-418D-B7A2-FBE3C01F0FD0@astro.physik.uni-goettingen.de>
On 12 Feb 2016, at 8:42 pm, Derek Homeier <[email protected]> wrote:
> 
> On 11 Feb 2016, at 2:12 pm, Kurt Schwehr <[email protected]> wrote:
>> 
>> Sorry, I'm totally not following how this should be fixed.  I'm feeling rather brain dead at the moment.
>> 
> Seems we have two options -
> change the TestScript as suggested to let python cleanup the byte-compiled files from the test run:
> 
> InfoTest: <<
> TestDepends: ffmpeg, inkscape, nose-py%type_pkg[python], ( %type_pkg[python] <= 27 ) mock-py%type_pkg[python]
> TestScript: <<
>  #!/bin/bash -ev
>  export PYTHONPATH=$(ls -d %b/build/lib.macosx-*-%type_raw[python])
>  %p/bin/python%type_raw[python] -B -c 'import matplotlib as m, os, sys; r=m.test(verbosity=1); os.system("find %b/build/lib.macosx-*-%type_raw[python] -name \*.py[
> oc] -exec rm {} \;"); sys.exit(1-r)'
> <<
> TestSuiteSize: large
> <<
> 
> or let the InstallScript do the cleanup afterwards:
> 
> InstallScript: <<
> #!/bin/sh -ev
> export PKG_CONFIG_PATH="%p/lib/pango-ft219/lib/pkgconfig:%p/lib/fontconfig2/lib/pkgconfig:%p/lib/freetype219/lib/pkgconfig:$PKG_CONFIG_PATH"
> find %b/build/lib.macosx-*-%type_raw[python] -name \*.py[oc] -exec rm {} \;
> %p/bin/python%type_raw[python] setup.py install --root %d
> mkdir -p %i/share/doc/%n
> cp -R examples %i/share/doc/%n
> <<
> 
> Both versions worked for me, so it’s mainly a decision on aesthetic/philosophical grounds.
> Commented on one of the errors in the other thread, but I found a different one on another
> machine...

I just noticed another issue with the current setup: since the macosx backend is auto-detected,
although it is later disabled due to the non-Framework build, it is still written as default into the
system matplotlibrc. As a consequence, for users with a clean setup, like fink-bld when testing
other packages, ‘import matplotlib.pyplot’ will fail.
Explicitly disabling the backend in setup.cfg will let setup.py pick a default that’s actually working
with the package. It then chose qt5agg however, which seems to work alright with a plain python,
and I did not see any immediate problems with 'ipython —pylab’; nonetheless the more prudent
solution might be to set this explicitly instead, e.g. add this to the patch

--- a/setup.py
+++ b/setup.py
@@ -149,7 +149,7 @@ if __name__ == '__main__':
     package_dir = {'': 'lib'}
     install_requires = []
     setup_requires = []
-    default_backend = None
+    default_backend = 'qt4agg'
 
     # Go through all of the packages and figure out which ones we are
     # going to build/install.



Cheers,
					Derek

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

_______________________________________________
Fink-devel mailing list
[email protected]
List archive:
http://news.gmane.org/gmane.os.apple.fink.devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel
matplotlib-py.patch (application/octet-stream, 4.4 KB)
diff -ruNd matplotlib-1.5.1.orig/lib/matplotlib/font_manager.py matplotlib-1.5.1/lib/matplotlib/font_manager.py
--- matplotlib-1.5.1.orig/lib/matplotlib/font_manager.py	2016-01-10 19:06:08.000000000 -0800
+++ matplotlib-1.5.1/lib/matplotlib/font_manager.py	2016-02-07 12:11:39.000000000 -0800
@@ -138,6 +138,11 @@
     "/Library/Fonts/",
     "/Network/Library/Fonts/",
     "/System/Library/Fonts/",
+    # new XQuartz font location
+    "/opt/X11/share/fonts",
+    "/opt/X11/share/fonts/TTF",
+    # fonts installed via Fink
+    "@PREFIX@/lib/X11/fonts",
     # fonts installed via MacPorts
     "/opt/local/share/fonts"
     ""
diff -ruNd matplotlib-1.5.1.orig/setup.cfg.template matplotlib-1.5.1/setup.cfg.template
--- matplotlib-1.5.1.orig/setup.cfg.template	2016-01-10 18:43:13.000000000 -0800
+++ matplotlib-1.5.1/setup.cfg.template	2016-02-07 12:04:29.000000000 -0800
@@ -57,18 +57,18 @@
 #           otherwise skip silently. This is the default
 #           behavior
 #
-#agg = auto
-#cairo = auto
-#gtk = auto
+agg = True
+cairo = True
+gtk = True
 #gtk3agg = auto
 #gtk3cairo = auto
-#gtkagg = auto
+gtkagg = True
-#macosx = auto
+macosx = False
 #pyside = auto
-#qt4agg = auto
-#tkagg = auto
+qt5agg = True
+tkagg = True
 #windowing = auto
-#wxagg = auto
+wxagg = True
 
 [rc_options]
 # User-configurable options
diff -ruNd matplotlib-1.5.1.orig/setup.py matplotlib-1.5.1/setup.py
--- matplotlib-1.5.1.orig/setup.py	2016-01-10 19:06:08.000000000 -0800
+++ matplotlib-1.5.1/setup.py	2016-02-07 12:05:31.000000000 -0800
@@ -220,6 +220,10 @@
     with open('lib/matplotlib/mpl-data/matplotlibrc', 'w') as fd:
         fd.write(template % {'backend': default_backend})
 
+    for mod in ext_modules:
+        mod.include_dirs.append('@PREFIX@/include')
+        mod.library_dirs.append('@PREFIX@/lib')
+
     # Build in verbose mode if requested
     if setupext.options['verbose']:
         for mod in ext_modules:
diff -ruNd matplotlib-1.5.1.orig/setupext.py matplotlib-1.5.1/setupext.py
--- matplotlib-1.5.1.orig/setupext.py	2016-01-10 19:06:08.000000000 -0800
+++ matplotlib-1.5.1/setupext.py	2016-02-07 12:10:49.000000000 -0800
@@ -150,8 +150,8 @@
 
     basedir_map = {
         'win32': ['win32_static', ],
-        'darwin': ['/usr/local/', '/usr', '/usr/X11',
-                   '/opt/X11', '/opt/local'],
+        'darwin': ['@PREFIX@/lib/freetype219', '@PREFIX@',
+                   '/usr', '/usr/X11', '/opt/X11'],
         'sunos5': [os.getenv('MPLIB_BASE') or '/usr/local', ],
         'gnu0': ['/usr'],
         'aix5': ['/usr/local'],
@@ -1003,14 +1003,14 @@
         self.__class__.found_external = True
         try:
             return self._check_for_pkg_config(
-                'qhull', 'qhull/qhull_a.h', min_version='2003.1')
+                'qhull', 'libqhull/qhull_a.h', min_version='2003.1')
         except CheckFailed as e:
             self.__class__.found_pkgconfig = False
             # Qhull may not be in the pkg-config system but may still be
             # present on this system, so check if the header files can be
             # found.
             include_dirs = [
-                os.path.join(x, 'qhull') for x in get_include_dirs()]
+                os.path.join(x, 'libqhull') for x in get_include_dirs()]
             if has_include_file(include_dirs, 'qhull_a.h'):
                 return 'Using system Qhull (version unknown, no pkg-config info)'
             else:
@@ -1501,6 +1501,17 @@
             # this config section lifted directly from Imaging - thanks to
             # the effbot!
 
+            tcl_inc = "@PREFIX@/include"
+            tk_inc = "@PREFIX@/include"
+            tcl_lib = "@PREFIX@/lib"
+            tk_lib = "@PREFIX@/lib"
+            tk_ver = ""
+            # Add final versions of directories and libraries to module lists
+            ext.include_dirs.extend([tcl_inc, tk_inc])
+            ext.library_dirs.extend([tcl_lib, tk_lib])
+            ext.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver])
+
+        elif False:
             # First test for a MacOSX/darwin framework install
             from os.path import join, exists
             framework_dirs = [
diff -ruNd matplotlib-1.5.1.orig/src/qhull_wrap.c matplotlib-1.5.1/src/qhull_wrap.c
--- matplotlib-1.5.1.orig/src/qhull_wrap.c	2016-01-03 19:45:23.000000000 -0800
+++ matplotlib-1.5.1/src/qhull_wrap.c	2016-02-07 12:14:11.000000000 -0800
@@ -7,7 +7,7 @@
  */
 #include "Python.h"
 #include "numpy/noprefix.h"
-#include "qhull/qhull_a.h"
+#include "libqhull/qhull_a.h"
 #include <stdio.h>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.