generating .zip including __main__.py file in top root using distutils

Discussion in 'Python' started by aspineux, Feb 12, 2011.

  1. aspineux

    aspineux Guest

    Python 2.6 can run a zip file, searching for __main__.py in the root
    of the zip archive and running it.
    How can I create such an archive using distutils (and not
    setuptools) ?

    If I use
    # python setup.py bdist --format=zip
    I get a "dumb" zip file with a deep tree structure from "/" and I
    cannot put the __main__.py in the root archive

    If I use
    # python setup.py sdist --format=zip
    I get a more compact tree. But the tree start bellow directory named
    "mypackage-version",

    my-package-1.0/
    setup.py
    __main__.py
    ........

    If I use setuptool, generating .EGG I get exacly what I want !
    But I read it is bad to use setuptool and EGGs since pip is
    available :)

    I was hopping distutils have been updated when adding the zip trick,
    but I didn't find the trick.

    Help
     
    aspineux, Feb 12, 2011
    #1
    1. Advertising

  2. Re: generating .zip including __main__.py file in top root using distutils

    I answer myself to put my question on top of the list again.


    On Feb 12, 7:47 pm, aspineux <> wrote:
    > Python 2.6 can run a zip file, searching for __main__.py in the root
    > of the zip archive and running it.
    > How can I create such an archive using distutils (and not
    > setuptools) ?
    >
    > If I use
    > # python setup.py bdist --format=zip
    > I get a "dumb" zip file with a deep tree structure from "/" and I
    > cannot put the __main__.py in the root archive
    >
    > If I use
    > # python setup.py sdist --format=zip
    > I get a more compact tree. But the tree start bellow directory named
    > "mypackage-version",
    >
    > my-package-1.0/
    >   setup.py
    >   __main__.py
    >   ........
    >
    > If I use setuptool, generating .EGG I get exacly what I want !
    > But I read it is bad to use setuptool and EGGs since pip is
    > available :)
    >
    > I was hopping distutils have been updated when adding the zip trick,
    > but I didn't find the trick.
    >
    > Help
     
    alain.spineux, Feb 15, 2011
    #2
    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. abcd
    Replies:
    7
    Views:
    537
    Edward Elliott
    May 1, 2006
  2. majj81
    Replies:
    0
    Views:
    347
    majj81
    May 31, 2006
  3. Chris Lambacher

    Re: Add file to zip, or replace file in zip

    Chris Lambacher, Jun 1, 2006, in forum: Python
    Replies:
    0
    Views:
    637
    Chris Lambacher
    Jun 1, 2006
  4. Tycho Andersen

    Generating a .pc file using distutils

    Tycho Andersen, Jan 23, 2012, in forum: Python
    Replies:
    0
    Views:
    138
    Tycho Andersen
    Jan 23, 2012
  5. Tycho Andersen

    Generating a pkg config file with distutils

    Tycho Andersen, Mar 28, 2012, in forum: Python
    Replies:
    0
    Views:
    235
    Tycho Andersen
    Mar 28, 2012
Loading...

Share This Page