Running CVSNT commands from python to Automate the job

sandeep shiningsandy at gmail.com
Wed Feb 4 19:27:26 CET 2009


Hi All,

i want to automate my task for of doing cvs checkout for different
modules. I am on Windows XP and i am using Python 2.6. here is my
attched python code. The thing is when i am running this nothing is
happening. I am not sure at which end the problem is. am i giving
wrong parameters or what? any help or pointers to write directions
will be helpfull.

CVS_PATH='C:\Program Files\CVSNT\cvs.exe'
CVS_PATH=(os.sep).join(CVS_PATH.split('\\'))
BRANCH_NAME='B_PKG14_01'
'''

Filters the directories only from the list of files
and directories excluding the directories starting with name '.'
@param dirList=List of all the files and directories
@param basePath=path where we are doing our filtering

'''
def filterDir(dirList,basePath):
    import os
    temp=[]
    for data in dirList:
        #if(data[0]!='.'):
        mydir=os.path.join(basePath,data)
        flag=os.path.isdir(mydir)
        if(flag==True):
            temp.append(mydir)
    return temp

def main():
    import os

    curr_dir=os.getcwd()#current working directory
    curr_list=os.listdir(curr_dir)#list of all files and directories
in current working directory
    global CVS_PATH,BRANCH_NAME
    temp=filterDir(curr_list,curr_dir)

    for mydir in temp:
        dir_name=os.path.split(mydir)[1]
        #os.rmdir(mydir)
        CVS_COMMAND='checkout -r '+BRANCH_NAME+' -P '+dir_name
        print '"'+CVS_PATH+'"'+' -q '+CVS_COMMAND

main()



thanks,
sandeep



More information about the Python-list mailing list