How to install with -O?

Bernd Zimmermann zimmermann.edv at t-online.de
Mon Dec 2 04:41:22 EST 2002


Michael Gilfix wrote:
>   Hi all. I've been using __debug__ in my python programs with the
> hope to byte-compile my programs with -O on install and remove the
> __debug__ code. However, I haven't figured out quite how to do this
> with distutils, and some searching through the documentation didn't
> reveal anything. Has anyone solved this problem?

We have not used setup or distutils but my colleague
figured out the found the following to let python
work like a compiler within a Gnu-Make Makefile:

%.pyo: %.py
         python -OO -c 'import py_compile; py_compile.compile("$<","$@")'


Bernd




More information about the Python-list mailing list