[Tutor] launching and monitor from make

2005-10-12 Thread Ertl, John
All,

I have a very simple python program that reads one file and overwrites
anouther text file.  This workes great from the command line and it has
error checking but just outputs messages and the like to the screen.

The CM team here would like to have the script run each week as part of the
automated rebuilds.  The suggestion was to make the execution of the scritp
part of the bigger programs make file.  How would I handel errors when the
program is run from a makefile?  I hate make so I have not done a lot of
playing with what make can do in this respect but can python get an error
message to make?

Thanks,

John Ertl

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] launching and monitor from make

2005-10-12 Thread Ertl, John
Ewald,

That easy...If you know.  Thanks for the example and the help.  Now lets see
if I can modify the make file without upsetting the make god.

Thanks again.

John Ertl 

 -Original Message-
From:   Ewald Ertl [mailto:[EMAIL PROTECTED] 
Sent:   Wednesday, October 12, 2005 7:40 AM
To: Ertl, John
Subject:Re: [Tutor] launching and monitor from make

Hi John

Ertl, John wrote:
 All,
 
 I have a very simple python program that reads one file and overwrites
 anouther text file.  This workes great from the command line and it has
 error checking but just outputs messages and the like to the screen.
 
 The CM team here would like to have the script run each week as part of
the
 automated rebuilds.  The suggestion was to make the execution of the
scritp
 part of the bigger programs make file.  How would I handel errors when the
 program is run from a makefile?  I hate make so I have not done a lot of
 playing with what make can do in this respect but can python get an error
 message to make?


I think your Python-Script is an executeable Shell-Script with
#!/usr/bin/env python ... 
So you can just insert your script in the makefile

When the exit-Code of the script is 0, than make assumes that everything is
ok,
otherwise an error occured.


Here's a short example with ls

Here the mkfile want's to list the file hugo which does not exist

mkfile:
all:
ls -l hugo
--
#gmake -f mkfile
ls -l hugo
hugo: Datei oder Verzeichnis nicht gefunden
gmake: *** [all] Error 2



Here the mkfile itself is listed with ls
mkfile:
all:
ls -l mkfile
--
#gmake -f mkfile
ls -l mkfile
-rw-rw-r--   1 ewer entw  19 Okt 12 16:35 mkfile


HTH
Ewald Ertl
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] launching and monitor from make

2005-10-12 Thread Alan Gauld
 The CM team here would like to have the script run each week as part of 
 the
 automated rebuilds.  The suggestion was to make the execution of the 
 scritp
 part of the bigger programs make file.  How would I handel errors when the
 program is run from a makefile?  I hate make so I have not done a lot of
 playing with what make can do in this respect but can python get an error
 message to make?

You can write the errors to stderr instead of stdout.
You can also exit with an error code using sys.exit().
make should detect the non standard error code because it uses standard
shell processing..

Alan G 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] launching and monitor from make

2005-10-12 Thread Ertl, John
Alan,

Thanks,  just as you and Ewald said it works great.  Almost too
easy...I have this feeling something will turn around a bite me once it goes
to ops.

Thanks again

John Ertl 

 -Original Message-
From:   Alan Gauld [mailto:[EMAIL PROTECTED] 
Sent:   Wednesday, October 12, 2005 10:01 AM
To: Ertl, John; tutor@python.org
Subject:Re: [Tutor] launching and monitor from make

 The CM team here would like to have the script run each week as part of 
 the
 automated rebuilds.  The suggestion was to make the execution of the 
 scritp
 part of the bigger programs make file.  How would I handel errors when the
 program is run from a makefile?  I hate make so I have not done a lot of
 playing with what make can do in this respect but can python get an error
 message to make?

You can write the errors to stderr instead of stdout.
You can also exit with an error code using sys.exit().
make should detect the non standard error code because it uses standard
shell processing..

Alan G 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor