ThirdParty packages: Add comment in README file. Contributed by Darrin Stephens
[OpenFOAM-1.6-ext.git] / bin / foamBuildTarball.py
blob92bf3f7cf668f3db820aecdfb1d27ab5b8e371fc
1 #! /usr/bin/python
3 import sys,re
4 from os import path
5 from subprocess import Popen,PIPE,call
6 import tarfile
8 if len(sys.argv)!=2:
9 print "Error: SVN-Url is needed"
10 sys.exit(-1)
12 url=sys.argv[1]
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)
20 revision=-1
22 for l in child_stdout.readlines():
23 m=re.compile("Last Changed Rev: (.+)").match(l)
24 if m!=None:
25 revision=int(m.group(1))
27 if revision<0:
28 print "Invalid URL or stuff"
29 sys.exit(-1)
31 fullname="%s.r%d" % (name,revision)
33 print "Generating",fullname
35 retcode=call(["svn","export",url,fullname])
36 if retcode!=0:
37 print "Problem. Returncode",retcode
38 sys.exit(-1)
40 print "Tarring ...."
41 tar=tarfile.open(fullname+".tgz","w:gz")
42 tar.add(fullname,arcname=name)
43 tar.close()
44 print "Removing directory"
45 retcode=call(["rm","-rf",fullname])
46 print "Finished"