Generating .pyc/.pyo from a make file

Tim Daneliuk tundra at tundraware.com
Wed Feb 2 18:16:16 EST 2005


Roland Heiber wrote:

> Tim Daneliuk wrote:
> 
>> I use a makefile to create distribution tarballs of freestanding Python
>> programs and their documentation.  I cannot seem to find the right
>> command line option to just generate a pyc/pyo file from the program
>> and then exit.  If I use 'python -OOOO -c"import myprog"' it creates
>> the pyo file, but myprog starts up and keeps running.
>>
>> IOW, I need a batch method for generating compiled python.  I know it
>> exists, but I can't find it for some reason ...
>>
>> TIA,
> 
> Hi,
> 
> take a look at http://docs.python.org/lib/module-compileall.html
> 
> HtH, Roland

It does - thanks.  One more question:  Are pyc and pyo file portable
across operating systems?  I suspect not since I generated a pyo
on a FreeBSD machine that will not run on a Win32 machine.  I was
under the impression that "compiled" meant optimized byte code that
was portable across implementations, but it looks to not be the case...

-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the Python-list mailing list