creating .pyo with make

Diez B. Roggisch deets at nospam.web.de
Thu Jan 24 00:14:49 CET 2008


Yann Leboulanger schrieb:
> Yann Leboulanger wrote:
>> Hi,
>>
>> I use autoconf / automake to manage my python project, and I'l like 
>> make / make install to create / install .pyo files instead of .py files.
>>
>> Is there something I should add to my Makefile.am files to do that? Or 
>> should I do all that myself with py_compile module?
>>
>> Are there some examples somewhere with autotools?
>>
>> Thanks for your help
> 
> Hehe replying to myself. It seems I just have to replace
> project_DATA = $(srcdir)/*.py
> by
> project_PYTHON = $(srcdir)/*.py
> 
> Then when I do make install, it installs .py, .pyc and .pyo.
> Would it be possible to install only .pyo? Is it a good idea?

There might be the occasional code that relies on doc-strings to work - 
seldomly, but possible. Which are obmitted by .pyo, but not of pyc.

Apart from that, having only pyc-files (or pyo for that matter) sucks. 
Just today I had to delve into a ZOPE-application, setting breakpoints 
and getting things done. It would have been impossible or at least much 
more inconvenient to debug if I hadn't had the sources available (and 
put at a place where they actually get invoked from the interpreter, not 
lying around unrelated)

Diez



More information about the Python-list mailing list