[Distutils] generating pyc and pyo files

Andrew Dalke dalke@bioreason.com
Tue, 30 Mar 1999 13:10:04 -0800

Grep Ward said:
> Compiling .py files at build time will not affect *source*
> distributions, which is what Andrew is talking about.  But it
> *will* affect the size of *built* distributions, which is what
> Michael is talking about (I assume).  The whole reason I've
> been calling them "built distributions" instead of "binary
> distributions" is because of the presumed inclusion of .pyc/.pyo
> files.

You can tell I'm used to working from source :)

As mentioned before, I'm looking into the autoconf/automake process.
They have a concept of DISTDIR which is prefixed to the install
path as in $(DESTDIR)$(bindir) (the default value of DESTDIR is "").

In theory, I can do a

  make install DESTDIR="blib/"

and it will install my package underneath:
and my executable scripts under

Wouldn't it be possible to have distribution program figure out
what to do based on this tree, including knowing to make .pyo
and .pyc files from .py files, if they exist?

Of course, permissions are problematical here as well.  The
package generation program could have a hook which lets the
distributor add some python code to adjust things accordingly.
Also, I could use a special INSTALL program which doesn't actually
set the permissions but instead logs them to a file for the
packager (hook) to use.