5 from subprocess
import Popen
,PIPE
,call
9 print "Error: SVN-Url is needed"
14 name
=path
.basename(url
[:-1])
16 p
=Popen(["svn","info",url
],stdin
=PIPE
, stdout
=PIPE
, close_fds
=True)
18 (child_stdout
, child_stdin
) = (p
.stdout
, p
.stdin
)
22 for l
in child_stdout
.readlines():
23 m
=re
.compile("Last Changed Rev: (.+)").match(l
)
25 revision
=int(m
.group(1))
28 print "Invalid URL or stuff"
31 fullname
="%s.r%d" % (name
,revision
)
33 print "Generating",fullname
35 retcode
=call(["svn","export",url
,fullname
])
37 print "Problem. Returncode",retcode
41 tar
=tarfile
.open(fullname
+".tgz","w:gz")
42 tar
.add(fullname
,arcname
=name
)
44 print "Removing directory"
45 retcode
=call(["rm","-rf",fullname
])