[Distutils] My first egg

Chris Galvan cgalvan at mail.utexas.edu
Tue Aug 12 16:20:50 CEST 2008


Oops, somehow the formatting I did on the egg structure got messed up.  
Here is what it's REALLY supposed to look like :)

mypkg-1.0.0-py2.5.egg/
    mypkg/
        examples/
            example1.py
            data1.dat
        __init__.py
        mypkg.py
    README.txt

-- Chris Galvan

Chris Galvan wrote:
> Hi Uwe,
>
> Do you mean console scripts or just example files?  If you set the 
> 'include_package_data' argument to True, all of the data files that 
> are under version control will be included in your egg.  If you want 
> to have more control over what goes in your egg and where they get 
> put, you can use the 'data_files' argument, which is a list of 
> tuples.  The first item in the tuple is the relative path inside the 
> egg where you want your data to be placed.  The second item is a 
> string, or a list of strings, which are paths relative to the root of 
> your source tree for the files that you want to be placed in the 
> destination you specified in the first item of the tuple.  Here is a 
> simple example:
>
> If your source tree looks like this:
>
> setup.py
> README.txt
> examples/
>    example1.py
>    data1.dat
> mypkg/
>    __init__.py
>    mypkg.py
>
> And your 'data_files' argument was this:
>
> data_files = [('', 'README.txt'),
>              ('mypkg/examples', 'examples/*.*')]
>
> Your egg structure should look like this:
>
> mypkg-1.0.0-py2.5.egg/
>    mypkg/
>        examples/
>            example1.py
>            data1.dat        __init__.py
>        mypkg.py
>    README.txt
>   
> You can also use a glob for the second item in the tuple.
>
> -- Chris Galvan
>
> Uwe Schmitt wrote:
>> Hi,
>>
>> I just finished my first egg, but have a question:
>> How can I distribute example scripts for my
>> package ???
>>
>> Greetings, Uwe
>>
>
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig
>



More information about the Distutils-SIG mailing list