creating .pyo with make

Discussion in 'Python' started by Yann Leboulanger, Jan 23, 2008.

  1. 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
    --
    Yann
     
    Yann Leboulanger, Jan 23, 2008
    #1
    1. Advertising

  2. 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?

    --
    Yann
     
    Yann Leboulanger, Jan 23, 2008
    #2
    1. Advertising

  3. 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
     
    Diez B. Roggisch, Jan 23, 2008
    #3
  4. Diez B. Roggisch wrote:
    > 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


    Source are available i ntarballs, but when I do make install I don't
    care to install .py files. .pyo are enough to run the application.

    --
    Yann
     
    Yann Leboulanger, Jan 24, 2008
    #4
  5. Yann Leboulanger schrieb:
    > Diez B. Roggisch wrote:
    >> 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

    >
    > Source are available i ntarballs, but when I do make install I don't
    > care to install .py files. .pyo are enough to run the application.


    As I said - not installing them will make debugging for someone who
    knows how to deal with it just more inconvenient. And if you plan to
    release the code anyway - don't bother separating pyc/pyo from the py.

    Diez
     
    Diez B. Roggisch, Jan 24, 2008
    #5
  6. Diez B. Roggisch wrote:
    > Yann Leboulanger schrieb:
    >> Diez B. Roggisch wrote:
    >>> 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

    >>
    >> Source are available i ntarballs, but when I do make install I don't
    >> care to install .py files. .pyo are enough to run the application.

    >
    > As I said - not installing them will make debugging for someone who
    > knows how to deal with it just more inconvenient. And if you plan to
    > release the code anyway - don't bother separating pyc/pyo from the py.
    >


    That's a point of view I understand, but some prefer smaller
    installation size. Now it installs .py, .pyc, and .pyo, so 3 times bigger.

    --
    Yann
     
    Yann Leboulanger, Jan 25, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Terry Hancock

    pyc / pyo architecture independent?

    Terry Hancock, Nov 18, 2003, in forum: Python
    Replies:
    4
    Views:
    414
    Terry Hancock
    Nov 18, 2003
  2. Jason Smith

    Prevent pyc or pyo compiled output

    Jason Smith, Jun 25, 2004, in forum: Python
    Replies:
    2
    Views:
    389
    Peter Otten
    Jun 25, 2004
  3. Tim Daneliuk

    Generating .pyc/.pyo from a make file

    Tim Daneliuk, Feb 2, 2005, in forum: Python
    Replies:
    9
    Views:
    3,736
  4. skn

    Generating .pyo from .py

    skn, Jun 16, 2005, in forum: Python
    Replies:
    3
    Views:
    13,473
  5. David Siroky

    pyo contains absolute paths

    David Siroky, Jul 9, 2005, in forum: Python
    Replies:
    6
    Views:
    680
    Daniel Dittmar
    Jul 11, 2005
Loading...

Share This Page