From owner-freebsd-ports@FreeBSD.ORG Mon Aug 4 23:36:40 2008 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB2AD1065677 for ; Mon, 4 Aug 2008 23:36:40 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from mail-out4.apple.com (mail-out4.apple.com [17.254.13.23]) by mx1.freebsd.org (Postfix) with ESMTP id 929E48FC08 for ; Mon, 4 Aug 2008 23:36:40 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from relay11.apple.com (relay11.apple.com [17.128.113.48]) by mail-out4.apple.com (Postfix) with ESMTP id 3D50336E1B45; Mon, 4 Aug 2008 16:21:14 -0700 (PDT) Received: from relay11.apple.com (unknown [127.0.0.1]) by relay11.apple.com (Symantec Mail Security) with ESMTP id 236B22809E; Mon, 4 Aug 2008 16:21:14 -0700 (PDT) X-AuditID: 11807130-ac395bb000000ead-37-48978eea50f9 Received: from cswiger1.apple.com (cswiger1.apple.com [17.227.140.124]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by relay11.apple.com (Apple SCV relay) with ESMTP id 0257228096; Mon, 4 Aug 2008 16:21:14 -0700 (PDT) Message-Id: <368A24A9-2336-4600-817A-35B355AE2397@mac.com> From: Chuck Swiger To: ros In-Reply-To: <48978422.4090205@bebik.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v928.1) Date: Mon, 4 Aug 2008 16:21:13 -0700 References: <48978422.4090205@bebik.net> X-Mailer: Apple Mail (2.928.1) X-Brightmail-Tracker: AAAAAA== Cc: ports@freebsd.org Subject: Re: Deleting python compiled files X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Aug 2008 23:36:40 -0000 On Aug 4, 2008, at 3:35 PM, ros wrote: > Working in a port using python i'm facing this problem. If I run the > application after the install the py source files are compiled in > pyc (or pyo) files. This is good cause precompiled files provide > better performances. Mildly. :-) The "compiled" or "optimized" .pyc/.pyo files mainly improve upon the time required to load them by the interpreter. > The problem is deleting the port. The pyc files aren't registered in > the pkg-plist so the deletion isn't complete and I can't delete the > main directory containing the application files. > If I add the pyc files, when I remove the port I receive an error > saying the checksum dosn't exist, and that's right. So what's the > best way handle this problem ? Anyway, to address your issue, most Python software uses a setup.py file which uses distutils, and that is supported by the BSD ports infrastructure via the USE_PYDISTUTILS option, which will call the setup.py with the right arguments to build the .pyc/.pyo files. You can then list all of them in the pkg-plist and the right thing should happen from there. If you'd like to see an example, check out one of the python ports which use this, such as /usr/ports/security/denyhosts; you'll see it listing: %%PYTHON_SITELIBDIR%%/DenyHosts/loginattempt.py %%PYTHON_SITELIBDIR%%/DenyHosts/loginattempt.pyc %%PYTHON_SITELIBDIR%%/DenyHosts/loginattempt.pyo [ ... ] Regards, -- -Chuck