applying command line options within a task

12 views
Skip to first unread message

mgemmill

unread,
Oct 12, 2009, 5:55:34 PM10/12/09
to paver
How would one go about applying command line options to a standard
setuptools task that is called from, or is a requirement of another
task?

For example, I have task:

@task
@needs('setuptools.command.bdist_egg',
'aedilis.paving.tools.ftp_egg')
def dist_my_egg():
print('Completed \'dist_my_egg\' build')

I can run this from the command line with the --exclude-source-file
option:

paver dist_my_egg --exclude-source-file

But is there a way I can insert this option as a default within my
task so I don't have to bother typing it at the command line? (i.e.
just run "paver dist_my_egg") I'm sure this is likely to be something
obvious, but I'm relatively new to the world of Python packaging and I
can't seem to find a reference in the documentation or figure it out
from the source code. Any help would be greatly appreciated.

Thanks,
Mark

Kevin Dangoor

unread,
Oct 12, 2009, 9:44:55 PM10/12/09
to pa...@googlegroups.com
On Mon, Oct 12, 2009 at 5:55 PM, mgemmill <mark.g...@gmail.com> wrote:
For example, I have task:

   @task
   @needs('setuptools.command.bdist_egg',
                'aedilis.paving.tools.ftp_egg')
   def dist_my_egg():
       print('Completed \'dist_my_egg\' build')

I can run this from the command line with the --exclude-source-file
option:

   paver dist_my_egg --exclude-source-file

But is there a way I can insert this option as a default within my
task so I don't have to bother typing it at the command line? (i.e.
just run "paver dist_my_egg")  I'm sure this is likely to be something
obvious, but I'm relatively new to the world of Python packaging and I
can't seem to find a reference in the documentation or figure it out
from the source code.  Any help would be greatly appreciated.

Hmm, that's not obvious at all, but seems like a nice idea.

I hate to say it, but I can't offhand think of any pleasant way to do this... You could do something like:

call_pavement("pavement.py", ["bdist_egg", "--exclude-source-file"])

Not at all elegant, but likely to work...

Kevin

--
Kevin Dangoor

work: http://labs.mozilla.com/
email: k...@blazingthings.com
blog: http://www.BlueSkyOnMars.com

mgemmill

unread,
Oct 14, 2009, 2:03:17 AM10/14/09
to paver
Hi Kevin,

Un-elegant is better than nothing at all! :-) Thanks for looking at
this.

Actually, I did stumble across the distutils config options while I
was looking into this further, and for myself, simply adding:

[bdist_egg]
exclude-source-files = 1

to a ~/.pydistutils.cfg file does the trick a little better for my
purposes.

Thanks again,
Mark


On Oct 12, 6:44 pm, Kevin Dangoor <dang...@gmail.com> wrote:
> On Mon, Oct 12, 2009 at 5:55 PM, mgemmill <mark.gemm...@gmail.com> wrote:
> > For example, I have task:
>
> >    @task
> >    @needs('setuptools.command.bdist_egg',
> >                 'aedilis.paving.tools.ftp_egg')
> >    def dist_my_egg():
> >        print('Completed \'dist_my_egg\' build')
>
> > I can run this from the command line with the --exclude-source-file
> > option:
>
> >    paver dist_my_egg --exclude-source-file
>
> > But is there a way I can insert this option as a default within my
> > task so I don't have to bother typing it at the command line? (i.e.
> > just run "paver dist_my_egg")  I'm sure this is likely to be something
> > obvious, but I'm relatively new to the world of Python packaging and I
> > can't seem to find a reference in the documentation or figure it out
> > from the source code.  Any help would be greatly appreciated.
>
> Hmm, that's not obvious at all, but seems like a nice idea.
>
> I hate to say it, but I can't offhand think of any pleasant way to do
> this... You *could* do something like:
Reply all
Reply to author
Forward
0 new messages