From 5e5c8a8afc9d7b3d1fce7e9a5312f57e054c9250 Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Fri, 21 Nov 2014 15:26:07 +0100 Subject: [PATCH] Remove unused mainainance scripts. These were necessary when 1.6-ext was still on the SVN-server but are completely useless on git/hg --- bin/foamAddAndRemoveFromRelease.py | 101 ----------------------------- bin/foamBuildTarball.py | 46 ------------- bin/foamEditProperties.py | 94 --------------------------- 3 files changed, 241 deletions(-) delete mode 100755 bin/foamAddAndRemoveFromRelease.py delete mode 100755 bin/foamBuildTarball.py delete mode 100755 bin/foamEditProperties.py diff --git a/bin/foamAddAndRemoveFromRelease.py b/bin/foamAddAndRemoveFromRelease.py deleted file mode 100755 index 3ec014a12..000000000 --- a/bin/foamAddAndRemoveFromRelease.py +++ /dev/null @@ -1,101 +0,0 @@ -#! /usr/bin/python - -# debugmode=True -debugmode=False - -from os import listdir,path,system -from popen2 import popen4 -import sys - -def svnCommand(cmd): - if debugmode: - print "SVN:",cmd - else: - system("svn "+cmd) - -def rmEmpty(d): - if not path.isdir(d): - return False - else: - isEmpty=True - for f in listdir(d): - if f==".svn": - isEmpty=False - elif not rmEmpty(path.join(d,f)): - isEmpty=False - if isEmpty: - print "Removing ",d,"because it is empty" - if not debugmode: - system("rmdir "+d) - return isEmpty - -start=sys.argv[1] - -rmEmpty(start) - -rein,raus=popen4("svn status "+start) -lines=rein.readlines() -rein.close() -raus.close() - -modified=0 -added=0 -removed=0 -conflicting=0 -replaced=0 - -for l in lines: - status=l[0] - pstatus=l[1] - name=l[7:-1] - if status=="?": - print "Adding",name - svnCommand("add "+name) - elif status=="!": - print "Removing",name - svnCommand("delete "+name) - elif status=="M": - modified+=1 - elif status=="A": - added+=1 - elif status=="D": - removed+=1 - elif status=="C": - conflicting+=1 - elif status=="R": - replaced+=1 - elif status=="~": - print "Problem with",name - -print -print "Modified files:",modified -print "Added files:",added -print "Removed files:",removed -print "Conflicting files:",conflicting -print "Replaced files:",replaced -print - -def checkEmptyDirs(current): - nrOfContents=0 - - for f in listdir(current): - if f==".svn": - continue - - pfad=path.join(current,f) - - if path.isdir(pfad): - if checkEmptyDirs(pfad): - nrOfContents+=1 - else: - nrOfContents+=1 - - if nrOfContents==0: - print "Removing",current - svnCommand("remove "+current) - return False - else: - return True - -checkEmptyDirs(start) - diff --git a/bin/foamBuildTarball.py b/bin/foamBuildTarball.py deleted file mode 100755 index cddc9e800..000000000 --- a/bin/foamBuildTarball.py +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/python - -import sys,re -from os import path -from subprocess import Popen,PIPE,call -import tarfile - -if len(sys.argv)!=2: - print "Error: SVN-Url is needed" - sys.exit(-1) - -url=sys.argv[1] - -name=path.basename(url[:-1]) - -p=Popen(["svn","info",url],stdin=PIPE, stdout=PIPE, close_fds=True) - -(child_stdout, child_stdin) = (p.stdout, p.stdin) - -revision=-1 - -for l in child_stdout.readlines(): - m=re.compile("Last Changed Rev: (.+)").match(l) - if m!=None: - revision=int(m.group(1)) - -if revision<0: - print "Invalid URL or stuff" - sys.exit(-1) - -fullname="%s.r%d" % (name,revision) -l -print "Generating",fullname - -retcode=call(["svn","export",url,fullname]) -if retcode!=0: - print "Problem. Returncode",retcode - sys.exit(-1) - -print "Tarring ...." -tar=tarfile.open(fullname+".tgz","w:gz") -tar.add(fullname,arcname=name) -tar.close() -print "Removing directory" -retcode=call(["rm","-rf",fullname]) -print "Finished" diff --git a/bin/foamEditProperties.py b/bin/foamEditProperties.py deleted file mode 100755 index 0b5f20e0e..000000000 --- a/bin/foamEditProperties.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/python - -# this script adds a set of SVN-properties to files and directories under -# a directory that is specified on the command line - -from popen2 import popen2 -import sys -import string -import glob -from os import path,listdir - -svnCommand="svn" -isSVK=False - -def runSvn(cmd): - raus,rein=popen2(svnCommand+" "+cmd) - result=raus.readlines() - rein.close() - raus.close() - return result - -def getProperty(fName,property): - raw=runSvn("propget %s %s" % (property,fName)) - return string.join(raw) - -def setProperty(fName,property,value): - runSvn("propset %s \"%s\" %s" % (property,value,fName)) - -def addToListProperty(fName,property,value): - tmp=getProperty(fName,property) - lst=map(string.strip,string.split(tmp)) - if not value in lst: - lst.append(value) - else: - return False - val=string.join(lst,"\n") - setProperty(fName,property,val) - return True - -def addKeyword(fName,keyword): - return addToListProperty(fName,"svn:keywords",keyword) - -def addIgnore(fName,keyword): - return addToListProperty(fName,"svn:ignore",keyword) - -def recursivlyDoToFiles(directory,fileFilter,function,isDir=False,testSvn=True): - if testSvn and not isSVK: - if not path.exists(path.join(directory,".svn")): - return - - for f in glob.glob(path.join(directory,fileFilter)): - if not path.isfile(f) and not path.isdir(f): - continue - - if (isDir and path.isfile(f)) or (not isDir and path.isdir(f)): - continue - - if isDir and testSvn and not isSVK: - if not path.exists(path.join(f,".svn")): - continue - - if function(f): - print "....",f - - for f in listdir(directory): - if f not in [".svn","lnInclude"]: - tmp=path.join(directory,f) - if path.isdir(tmp): - recursivlyDoToFiles(tmp,fileFilter,function,isDir=isDir,testSvn=testSvn) - -if not path.exists(path.join(sys.argv[1],".svn")): - svnCommand="svk" - isSVK=True - -print "\nAdding Id-keyword to Python-files" -recursivlyDoToFiles(sys.argv[1],"*.py",lambda x:addKeyword(x,"Id")) - -print "\nAdding Id-keyword to C++-files" -recursivlyDoToFiles(sys.argv[1],"*.C",lambda x:addKeyword(x,"Id")) - -print "\nAdding Id-keyword to C++-headers" -recursivlyDoToFiles(sys.argv[1],"*.H",lambda x:addKeyword(x,"Id")) - -print "\nAdding *Opt to ignore-list for Make-directories" -recursivlyDoToFiles(sys.argv[1],"Make",lambda x:addIgnore(x,"*Opt"),isDir=True) - -print "\nAdding *Debug to ignore-list for Make-directories" -recursivlyDoToFiles(sys.argv[1],"Make",lambda x:addIgnore(x,"*Debug"),isDir=True) - -print "\nAdding lnInclude to ignore-list for all directories" -recursivlyDoToFiles(sys.argv[1],"*",lambda x:addIgnore(x,"lnInclude"),isDir=True) - -print "\nAdding *.dep to ignore-list for all directories" -recursivlyDoToFiles(sys.argv[1],"*",lambda x:addIgnore(x,"*.dep"),isDir=True)