convention for compiling .py on MacPorts?

Jack Howarth howarth at bromo.med.uc.edu
Thu Oct 15 16:03:09 PDT 2009


On Thu, Oct 15, 2009 at 06:41:33PM -0400, Jack Howarth wrote:
>  One change that might be useful to the pymol package would be to
> compile the python scripts upon installation. In fink, we can do
> this with...
> 
> PostInstScript: <<
> update-alternatives --install %p/bin/pymol pymol %p/lib/pymol-py%type_pkg[python]/bin/pymol %type_pkg[python]
> %p/bin/python%type_raw[python] -O %p/lib/python%type_raw[python]/compileall.py -q %p/lib/%n/modules
> <<
> PreRmScript: <<
> if [ $1 != "upgrade" ]; then
>   update-alternatives --remove pymol %p/lib/pymol-py%type_pkg[python]/bin/pymol
> fi
> PACKAGE=%N
> dpkg --listfiles $PACKAGE |
>         /usr/bin/awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
>         xargs rm -f >&2
> <<
> 
> Do any MacPorts packages that use python compile their scripts and is
> there an accepted convention for doing this in MacPorts?
>           Jack
> _______________________________________________
> macports-dev mailing list
> macports-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev

I notice some MacPorts Portfile's are compiling the python scripts
in post-destroot but I suspect this will result in the destroot
path being in the compiled python code rather than the actual
the actual installation directory. I suspect the --destdir option
to compileall.py may solve this issue. If so, the MacPorts that
are compiling python scripts in post-destroot should be using that
option.
        Jack


More information about the macports-dev mailing list