Nested stream line iteration
Heiko Wundram
heikowu at ceosg.de
Tue Jul 30 12:40:43 EDT 2002
Hi Lars!
On Tue, 2002-07-30 at 14:11, Lars Lundgren wrote:
> #!/usr/bin/env python
>
> import sys, os, time, fileinput, string
>
> def build( module, tag ):
> os.system( "cvs co " + tag + " " + module)
>
> filename = module + "/cvsDependencies"
>
> for line in fileinput.input(filename):
> [m,t] = string.split( line )
> build( m,t )
>
> os.chdir(module)
> os.system( 'make -DVERSION="' + tag + '"')
>
> build( "my_module", "-r v1_0" )
Why not write the following?
import os
def build(module,tag):
os.system("cvs co %s %s" % (tag,module))
cvs_dep = open("%s/cvsDependencies" % (module,),"r")
for line in cvs_dep.xreadlines():
(m,t) = line.split("<some separator you don't mention!>")
build(m,t)
os.chdir(module)
os.system("make -DVERSION=\"%s\"" % (tag,))
build("my_module","-r v1.0")
That should do what you want, I guess...
Yours,
Heiko W.
More information about the Python-list
mailing list