Re: [FIX] py-matplotlib build failure

2016-04-25 Thread Alexandr Shadchin
On Sat, Apr 23, 2016 at 11:24:47PM -0400, Daniel Dickman wrote:
> naddy@ reported a build failure of the py3 flavor of matplotlib.
> 
> Looking at his logs, it seems like the problem might actually be in 
> py3-cairo. I *think* the fix is easy and is at the bottom of this email.
> 
> While here, fix the license marker and a comment in py3-cairo.
> 
> ok?
> 

make sense, small rework, ok shadchin@

-- 
Alexandr Shadchin

Index: Makefile
===
RCS file: /cvs/ports/graphics/py3-cairo/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile8 Oct 2015 12:02:03 -   1.9
+++ Makefile25 Apr 2016 19:36:29 -
@@ -9,7 +9,7 @@ VERSION=1.10.0
 DISTNAME=  pycairo-${VERSION}
 PKGNAME=   py3-cairo-${VERSION}
 EXTRACT_SUFX=  .tar.bz2
-REVISION=  2
+REVISION=  3
 
 CATEGORIES=graphics
 
@@ -46,13 +46,17 @@ post-extract:
 do-configure:
cd ${WRKSRC} && env PYTHON=${MODPY_BIN} \
LDFLAGS="$$(python${MODPY_VERSION}-config --libs)" \
-   ${MODPY_BIN} ./waf configure
+   ${MODPY_BIN} ./waf configure --nopyc --nopyo
 
 do-build:
cd ${WRKBUILD} && ${MODPY_BIN} ./waf build
 
 do-install:
cd ${WRKBUILD} && ${MODPY_BIN} ./waf install
+
+post-install:
+   ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
+   ${WRKINST}${MODPY_SITEPKG}
 
 do-test: install
sed -i "s/python/python${MODPY_VERSION}/g" 
${WRKSRC}/test/examples_test.py
Index: pkg/PLIST
===
RCS file: /cvs/ports/graphics/py3-cairo/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST
--- pkg/PLIST   30 Mar 2012 07:12:28 -  1.1.1.1
+++ pkg/PLIST   25 Apr 2016 19:36:29 -
@@ -4,8 +4,8 @@ include/pycairo/py3cairo.h
 lib/pkgconfig/py3cairo.pc
 lib/python${MODPY_VERSION}/site-packages/cairo/
 lib/python${MODPY_VERSION}/site-packages/cairo/__init__.py
-lib/python${MODPY_VERSION}/site-packages/cairo/__init__.pyc
-lib/python${MODPY_VERSION}/site-packages/cairo/__init__.pyo
+lib/python${MODPY_VERSION}/site-packages/cairo/${MODPY_PYCACHE}/
+lib/python${MODPY_VERSION}/site-packages/cairo/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}pyc
 @comment lib/python${MODPY_VERSION}/site-packages/cairo/_cairo.a
 @comment lib/python${MODPY_VERSION}/site-packages/cairo/_cairo.la
 lib/python${MODPY_VERSION}/site-packages/cairo/_cairo.so



[FIX] py-matplotlib build failure

2016-04-23 Thread Daniel Dickman
naddy@ reported a build failure of the py3 flavor of matplotlib.

Looking at his logs, it seems like the problem might actually be in 
py3-cairo. I *think* the fix is easy and is at the bottom of this email.

While here, fix the license marker and a comment in py3-cairo.

ok?

-

Full details of the problem.

If you install py3-cairo, then run some code, it could create .pyc files. 
However these aren't in the PLIST, so when you uninstall the package 
they're left behind. Here's how to reproduce:

  cd /usr/ports/graphics/py3-cairo
  make install
  python3.4 -c "import cairo"
  make uninstall

This will show an error:
  Error deleting directory /usr/local/lib/python3.4/site-packages/cairo

Now if you try to build the py3 flavor of matplotlib you'll get an error. 
The error is due to the following test within matplotlib which checks for 
availability of the cairo package.

  import cairo
  cairo.version

(1) The import doesn't fail with an ImportError because of the 
site-packages/cairo that's left behind, causing the import to succeed.
(2) cairo.version fails with an unexpected AttributeError which causes the 
matplotlib build to fail.

-

Index: Makefile
===
RCS file: /home/cvs/ports/graphics/py3-cairo/Makefile,v
retrieving revision 1.9
diff -u -p -u -r1.9 Makefile
--- Makefile8 Oct 2015 12:02:03 -   1.9
+++ Makefile24 Apr 2016 03:18:25 -
@@ -9,13 +9,13 @@ VERSION=  1.10.0
 DISTNAME=  pycairo-${VERSION}
 PKGNAME=   py3-cairo-${VERSION}
 EXTRACT_SUFX=  .tar.bz2
-REVISION=  2
+REVISION=  3
 
 CATEGORIES=graphics
 
 HOMEPAGE=  http://cairographics.org/pycairo/
 
-# LGPLv2.1 / MPL 1.1
+# LGPLv3
 PERMIT_PACKAGE_CDROM=  Yes
 
 WANTLIB += ${MODPY_WANTLIB}
@@ -37,7 +37,7 @@ LIB_DEPENDS=  ${MODPY_LIB_DEPENDS} \
 
 TEST_DEPENDS=devel/py-test${MODPY_FLAVOR}
 
-# du to the fact that waf extract embedded bzip2 tarball unpacked at runtime.
+# due to the fact that waf unpacks an embedded bzip2 tarball at runtime.
 # we need to call waf to create files before patching files.
 post-extract:
cd ${WRKSRC} && ${MODPY_BIN} ./waf --help 1>&2 > /dev/null
@@ -53,6 +53,10 @@ do-build:
 
 do-install:
cd ${WRKBUILD} && ${MODPY_BIN} ./waf install
+
+post-install:
+   ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py \
+   ${WRKINST}${MODPY_SITEPKG}
 
 do-test: install
sed -i "s/python/python${MODPY_VERSION}/g" 
${WRKSRC}/test/examples_test.py
Index: pkg/PLIST
===
RCS file: /home/cvs/ports/graphics/py3-cairo/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 PLIST
--- pkg/PLIST   30 Mar 2012 07:12:28 -  1.1.1.1
+++ pkg/PLIST   24 Apr 2016 02:36:57 -
@@ -8,4 +8,6 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/cairo/__init__.pyo
 @comment lib/python${MODPY_VERSION}/site-packages/cairo/_cairo.a
 @comment lib/python${MODPY_VERSION}/site-packages/cairo/_cairo.la
+lib/python${MODPY_VERSION}/site-packages/cairo/${MODPY_PYCACHE}/
+lib/python${MODPY_VERSION}/site-packages/cairo/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}pyc
 lib/python${MODPY_VERSION}/site-packages/cairo/_cairo.so