Date: Mon, 4 Aug 2008 16:21:13 -0700 From: Chuck Swiger <cswiger@mac.com> To: ros <ros@bebik.net> Cc: ports@freebsd.org Subject: Re: Deleting python compiled files Message-ID: <368A24A9-2336-4600-817A-35B355AE2397@mac.com> In-Reply-To: <48978422.4090205@bebik.net> References: <48978422.4090205@bebik.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?368A24A9-2336-4600-817A-35B355AE2397>