Patchwork [meta-oe] python-matplotlib : Add recipe for matplotlib 1.1.0.

login
register
mail settings
Submitter Dan McDougall
Date June 8, 2012, 8:52 p.m.
Message ID <1339188758-10480-1-git-send-email-daniel.mcdougall@liftoffsoftware.com>
Download mbox | patch
Permalink /patch/29547/
State Accepted
Commit 43010e86aa505afa878a9a8797db59b7cfd81ac6
Headers show

Comments

Dan McDougall - June 8, 2012, 8:52 p.m.
Adding python-matplotlib recipe.  I'm sure many folks will find this useful.

Signed-off-by: Dan McDougall <daniel.mcdougall@liftoffsoftware.com>
---
 .../python/python-matplotlib/fix_setup.patch       |   29 ++++++++++++++++
 .../python/python-matplotlib/fix_setupext.patch    |   29 ++++++++++++++++
 .../python/python-matplotlib_1.1.0.bb              |   36 ++++++++++++++++++++
 3 files changed, 94 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/python/python-matplotlib/fix_setup.patch
 create mode 100644 meta-oe/recipes-devtools/python/python-matplotlib/fix_setupext.patch
 create mode 100644 meta-oe/recipes-devtools/python/python-matplotlib_1.1.0.bb

Patch

diff --git a/meta-oe/recipes-devtools/python/python-matplotlib/fix_setup.patch b/meta-oe/recipes-devtools/python/python-matplotlib/fix_setup.patch
new file mode 100644
index 0000000..9381583
--- /dev/null
+++ b/meta-oe/recipes-devtools/python/python-matplotlib/fix_setup.patch
@@ -0,0 +1,29 @@ 
+This fixes the dependency checks inside of setup.py since things like
+'import numpy' won't work with bitbake.
+
+diff --git a/setup.py b/setup.py
+index 2f13821..e6d6ed0 100644
+--- a/setup.py
++++ b/setup.py
+@@ -113,12 +113,6 @@ if 1:
+     baseline_images = [chop_package(f) for f in baseline_images]
+     package_data['matplotlib'].extend(baseline_images)
+ 
+-if not check_for_numpy():
+-    sys.exit(1)
+-
+-if not check_for_freetype():
+-    sys.exit(1)
+-
+ build_ft2font(ext_modules, packages)
+ build_ttconv(ext_modules, packages)
+ build_contour(ext_modules, packages)
+@@ -129,7 +123,7 @@ build_tri(ext_modules, packages)
+ 
+ print_raw("")
+ print_raw("OPTIONAL BACKEND DEPENDENCIES")
+-has_libpng = check_for_libpng()
++has_libpng = True
+ 
+ if has_libpng and options['build_agg']:
+     build_agg(ext_modules, packages)
diff --git a/meta-oe/recipes-devtools/python/python-matplotlib/fix_setupext.patch b/meta-oe/recipes-devtools/python/python-matplotlib/fix_setupext.patch
new file mode 100644
index 0000000..e071595
--- /dev/null
+++ b/meta-oe/recipes-devtools/python/python-matplotlib/fix_setupext.patch
@@ -0,0 +1,29 @@ 
+This fixes the numpy import problem in setupext.py using a hard-coded path.
+
+diff --git a/setupext.py b/setupext.py
+index 962cedc..82297c4 100644
+--- a/setupext.py
++++ b/setupext.py
+@@ -176,10 +176,7 @@ if os.path.exists(setup_cfg):
+     except: pass
+ 
+ # For get_base_flags:
+-if options['basedirlist']:
+-    basedirlist = options['basedirlist'].split()
+-else:
+-    basedirlist = basedir[sys.platform]
++basedirlist = [os.environ['STAGING_LIBDIR']]
+ print("basedirlist is: %s" % basedirlist)
+ 
+ if options['display_status']:
+@@ -555,8 +552,8 @@ def check_for_numpy():
+ 
+ def add_numpy_flags(module):
+     "Add the modules flags to build extensions which use numpy"
+-    import numpy
+-    module.include_dirs.append(numpy.get_include())
++    # Hard-coded path for OE since I know this is where numpy's include dir will be
++    module.include_dirs.append(os.path.join(os.environ['STAGING_LIBDIR'], 'python2.7/site-packages/numpy/core/include/'))
+ 
+ def add_png_flags(module):
+     try_pkgconfig(module, 'libpng', 'png')
diff --git a/meta-oe/recipes-devtools/python/python-matplotlib_1.1.0.bb b/meta-oe/recipes-devtools/python/python-matplotlib_1.1.0.bb
new file mode 100644
index 0000000..788ba2f
--- /dev/null
+++ b/meta-oe/recipes-devtools/python/python-matplotlib_1.1.0.bb
@@ -0,0 +1,36 @@ 
+DESCRIPTION = "matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats"
+SECTION = "devel/python"
+LICENSE = "PSF"
+LIC_FILES_CHKSUM = "file://README.txt;md5=83c5bf8b16a5f99507f2f47a21ae3b81"
+PR = "r1"
+
+DEPENDS += "python-numpy freetype libpng"
+RDEPENDS_${PN} = "python-core python-distutils python-numpy freetype libpng"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/matplotlib/matplotlib-${PV}.tar.gz \
+           file://fix_setup.patch \
+           file://fix_setupext.patch \
+	  "
+
+S = "${WORKDIR}/matplotlib-${PV}"
+
+EXTRA_OECONF = "--disable-docs --with-python-includes=${STAGING_INCDIR}/../"
+
+inherit distutils
+
+do_compile_prepend() {
+         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
+         ${STAGING_BINDIR_NATIVE}/python setup.py build ${DISTUTILS_BUILD_ARGS} || \
+         true
+}
+
+# need to export these variables for python-config to work
+export PYTHONPATH
+export BUILD_SYS
+export HOST_SYS
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+
+SRC_URI[md5sum] = "57a627f30b3b27821f808659889514c2"
+SRC_URI[sha256sum] = "be37e1d86c65ecacae6683f8805e051e9904e5f2e02bf2b7a34262c46a6d06a7"