How to fetch / specify command line options for commands?

4 views
Skip to first unread message

programmer.py

unread,
May 13, 2008, 10:26:37 PM5/13/08
to paver
First of all, I've been playing with paver off/on for the past few
days. I gotta say this thing is pretty cool.

(What follows is paver-praise. Feel free to scroll to the bottom to
see my question :D)

I'm a *NOVICE* setuptools user. I can create a basic setup.py script
that will add the necessary packages and data files. With a few days
of hacking on my pavement.py module, I've created a handful of
commands that:

1. Compile my GWT application
2. Upload via sftp my GWT application
3. Extract my GWT via ssh

What I've really loved about paver so far is that it's simple.
Setting up dependencies for steps 2 and 3 were simple. My decorators
look like this:

@task
@needs(['cmpgwt'])
def uploadgwt():
..

@task
@needs(['uploadgwt'])
..

And presto, instant dependencies, that allow me to do this:

---> cmpgwt
Compiling GWT application
Output will be written into /home/jaime/code/eclipse/workspace-
seasources/sstesting-gwt-gwm/www/net.seasources.testing.TestTakerApp
Compilation succeeded
---> uploadgwt
---> extractgwt
Executing rm -vfr /var/www/betabox.seasources.net/gwt/* -- rc 0
Executing tar -C /var/www/betabox.seasources.net/gwt -xjvf /var/www/
betabox.seasources.net/gwt.tar.bz2 -- rc 0

No more tedious bash scripts to monkey with. (I'm awful at bash ;)).
And those aren't the only tasks I've created either (it's almost too
easy). Enough paver-praise though, I have a question...

If I wanted to have my cmpgwt command take a parameter, how would I
specify this?

Thanks!
jw

Kevin Dangoor

unread,
May 13, 2008, 10:57:54 PM5/13/08
to pa...@googlegroups.com
Hi,

Thanks for the praise! It's always nice to hear about people using the
tools successfully.

I'm happy to say that there's some actual documentation to answer your
question :)

Check out cmdopts and consume_args in the paver.runtime doc:

http://www.blueskyonmars.com/projects/paver/runtime.html

Most likely, you want cmdopts

The very end of the Getting Started Guide has an example:

http://www.blueskyonmars.com/projects/paver/getting_started.html#gettingstarted

Another example is Paver's own pavement.py's deploy task:

http://bazaar.launchpad.net/~dangoor/paver/main/annotate/kid%40blazingthings.com-20080512114712-qbz8ks7qbof3x4vk?file_id=pavement.py-20080410193702-ny0eywyne88q1q7k-1

Kevin

--
Kevin Dangoor
Product Manager
SitePen, Inc.
Web development experts:
development, support, training

ke...@sitepen.com

Kevin Dangoor

unread,
May 13, 2008, 10:59:44 PM5/13/08
to pa...@googlegroups.com
By the way, that's a Java app you're using with Paver?

Neat. I've been pushing Paver as a *Python-centric* tool, though it
can obviously be used universally.

Kevin

On May 13, 2008, at 10:26 PM, programmer.py wrote:

--

programmer.py

unread,
May 14, 2008, 12:45:25 AM5/14/08
to paver
Yah, I am working on a GWT front end / Pylons based backend. So I
find myself needing to push eggs and "gwt apps" around.

Part of pushing the GWT app around is compiling the GWT app with the
GWTCompiler. GWTCompiler magically transforms Java code into
javascript. I then tar the gwt javascript files up and upload them
using sftp (with paramiko libraries - nice package there!)

With paver, I have commands to do both ->

extractgwt and install_egg

Yeah, looking at those names, they seem a bit "wrong", but they work
for me. Thanks for the documentation links. I read the docs once
before, but just got lazy this Tuesday evening.

jw

Kevin Dangoor

unread,
May 14, 2008, 9:23:03 AM5/14/08
to pa...@googlegroups.com
On May 14, 2008, at 12:45 AM, programmer.py wrote:

>
> Yah, I am working on a GWT front end / Pylons based backend. So I
> find myself needing to push eggs and "gwt apps" around.

Wow. That's unexpected, but does seem like a perfect case for Paver.

Paver was born out of a somewhat similar need... when deploying to
production, I needed to create a custom Dojo build.

> Part of pushing the GWT app around is compiling the GWT app with the
> GWTCompiler. GWTCompiler magically transforms Java code into
> javascript. I then tar the gwt javascript files up and upload them
> using sftp (with paramiko libraries - nice package there!)

Hey, if you find yourself with some tim, can you sprinkle some
paramiko goodness in the paver.ssh module? I can worry about docs and
all, but it would be convenient to have that fleshed out a bit from
someone who's already used Paramiko.

(First up on my list is zc.buildout integration...)

The end goal is that Paver can do the same kinds of things as
Capistrano. We've got some great tools in Python, though... so I'm
ultimately envisioning a process that involves...

building an egg
copying the egg over to the server(s)
possibly generating the list of version numbers for buildout
running buildout on the server

But the idea is to get there step by step...

> Yeah, looking at those names, they seem a bit "wrong", but they work
> for me. Thanks for the documentation links. I read the docs once
> before, but just got lazy this Tuesday evening.

No problem. I didn't mind the question at all. I was just pleased to
find that there were some answers on the site :)

Kevin

jhermann

unread,
May 20, 2008, 9:28:35 AM5/20/08
to paver
On May 14, 3:23 pm, Kevin Dangoor <dang...@gmail.com> wrote:
> The end goal is that Paver can do the same kinds of things as
> Capistrano. We've got some great tools in Python, though... so I'm
> ultimately envisioning a process that involves...

Take a look at func (https://fedorahosted.org/func), which is about
the same as Capistrano for Python -- no need to reinvent the wheel.

Kevin Dangoor

unread,
May 21, 2008, 7:34:35 AM5/21/08
to pa...@googlegroups.com
On May 20, 2008, at 9:28 AM, jhermann wrote:

> Take a look at func (https://fedorahosted.org/func), which is about
> the same as Capistrano for Python -- no need to reinvent the wheel.

Yeah, I don't want to reinvent the wheel, and Func looks
interesting... but, Func does not appear to eliminate the need for a
Paramiko-based solution. A great many people, myself included, don't
have the ability to set up arbitrary servers everywhere... almost
everyone has ssh access now though.

Func definitely has the right idea, though.

Kevin

jhermann

unread,
May 21, 2008, 9:13:34 AM5/21/08
to paver
On May 21, 1:34 pm, Kevin Dangoor <dang...@gmail.com> wrote:
> Paramiko-based solution. A great many people, myself included, don't
> have the ability to set up arbitrary servers everywhere... almost
> everyone has ssh access now though.

Bootstrap-install the funcd via ssh. If you can't even open a >1024
port, then there's ssh-tunneling. Still better than reimplementing all
the things func already has, including documentation.

Kevin Dangoor

unread,
May 21, 2008, 10:27:15 AM5/21/08
to pa...@googlegroups.com

Interesting idea. I'll definitely keep it in mind. (Patches accepted ;)

Next on my list is zc.buildout, though.

Kevin

Reply all
Reply to author
Forward
0 new messages