Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Sep 2012 13:32:30 GMT
From:      "John W. O'Brien" <john@saltant.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/171381: [patch] finance/gnucash fails to generate and install .pyc/.pyo files
Message-ID:  <201209061332.q86DWUGi031163@red.freebsd.org>
Resent-Message-ID: <201209061340.q86DeDMa015973@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         171381
>Category:       ports
>Synopsis:       [patch] finance/gnucash fails to generate and install .pyc/.pyo files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 06 13:40:13 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     John W. O'Brien
>Release:        9.1-PRERELEASE
>Organization:
Saltant Solutions
>Environment:
FreeBSD XXXX.saltant.net 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #3 r239833: Wed Aug 29 10:08:24 EDT 2012     root@XXXX.saltant.net:/usr/obj/usr/src/sys/NIPPL  amd64
>Description:
When Python binding/support is enabled (PORT_OPTIONS+=PYTHON), the compiled Python bytecode (.pyc) and optimized bytecode (.pyo) files are not generated by the build target, nor installed by the install target. However, the packing list specifies them and therefore the package target expects them and fails as a result.

[/usr/ports]# svn info | egrep "URL|Revision"
URL: svn://svn0.us-east.freebsd.org/ports/head
Revision: 303631

[/usr/ports/finance/gnucash]# make showconfig
===> The following configuration options are available for gnucash-2.4.11_2:
     AQBANKING=on: AqBanking support (HBCI/OpenHBCI)
     DATABASE=on: Enable SQL database backends
     LOCALE_TAX=off: Enable localized tax categories
     OFX=on: OFX support
     PYTHON=on: Python binding/support
     WEBKIT=off: Use webkit instead of gtkhtml for the HTML engine
===> Use 'make config' to modify these settings

[/usr/ports/finance/gnucash]# make -V CC -V CXX -V CPP -V PYTHON_REL
clang
clang++
clang-cpp
273

[/usr/ports/finance/gnucash]# grep ".py" pkg-plist 
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/__init__.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/__init__.pyc
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/__init__.pyo
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/function_class.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/function_class.pyc
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/function_class.pyo
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_business.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_business.pyc
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_business.pyo
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_core.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_core.pyc
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_core.pyo
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_core_c.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_core_c.pyc
%%PYTHON%%%%PYTHON_SITELIBDIR%%/gnucash/gnucash_core_c.pyo
>How-To-Repeat:
(Output omitted)

Package creation fails:

[/usr/ports/finance/gnucash]# make package

Package deinstallation generates warnings due to missing files:

[/usr/ports/finance/gnucash]# make install
[/usr/ports/finance/gnucash]# make deinstall
>Fix:
The attached patch provides a quick and dirty solution by generating the compiled bytecode files in situ using a gnucash-provided in the post-install target. If this script were to fail, the installation would not complete cleanly (e.g. pkg_delete would be useless).

I expect that a better fix would be to patch, in an upstream-able fashion, ${WRKDIR}/gnucash-2.4.11/src/optional/python-bindings/Makefile.am to generate and install the bytecode files. This exceeds my abilities with autotools however and must be deferred to a more knowledgeable developer. I'd be happy to help if given suitable direction.

Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 303631)
+++ Makefile	(working copy)
@@ -3,7 +3,7 @@
 
 PORTNAME=	gnucash
 PORTVERSION=	2.4.11
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	finance gnome
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}%20%28stable%29/${PORTVERSION}
 
@@ -115,6 +115,10 @@
 .endif
 
 post-install:
+.   if${PORT_OPTIONS:MPYTHON}
+	${WRKDIR}/${PORTNAME}-${PORTVERSION}/py-compile \
+		${PYTHON_SITELIBDIR}/${PORTNAME}/*.py
+.   endif
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.mk>


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209061332.q86DWUGi031163>