Import OS, sys, datetime
File_in = SYS. argv [1]
Mode = {}
Mode [1] = "get"
Mode [2] = "check out"
Mode [3] = "check in"
Mode = raw_input (Mode)
Mode = int (Mode)
If mode <1 or mode> 3:
Print "invalid mode:", Mode
Exit (0)
Versionlabel = raw_input ("\ n \ ninput version label: [latest version for get, and null for put]")
If Len (versionlabel) = 0:
If mode = 1 or mode = 2:
Versionlabel = "latest version"
Description = "[enhancement] % s [compatiblilty] Link" % (raw_input ("\ n \ NPLs input Description :"))
Print
Print
Print "Mode:", mode [mode]
Print "versionlabel:", versionlabel
Print "Description:", description
OS. System ("pause ")
Dst_folder = "_ pvcsget _" + file_in + "_" + datetime. datetime. now (). strftime ('% Y _ % m _ % d _ % H _ % m _ % s ')
Fp = open (file_in, 'R ')
Lines = FP. readlines ()
FP. Close ()
Filenum = 1
For line in lines:
Src = line. Replace ('\ R', ''). Replace (' \ n',''). Strip () # Delete \ r \ n
If Len (SRC) = 0: Continue # Skip empty line
If SRC [0] in ['#', ';']: Continue # Skip comment
DST = SRC
P = SRC. Find (':') # Delete X :\
If P> = 0:
DST = DST [p + 2:]
Else:
DST = SRC
While DST [0] = '\': DST = DST [1:]
Src = DST. Replace ('\\','/')
DST = dst_folder + '\' + DST
# Make folder
If false:
Dstfdr = DST [: DST. rfind ('\'):]
If not OS. Path. isdir (dstfdr ):
Cmd = 'mkdir "% s" '% dstfdr
OS. System (CMD)
# Get Source
EXE = r "\ aaants240.aaaex.asmpt.com \ serenaclnt \ VM \ Win32 \ bin \ pcli"
Userpwd = R'-Pr "\ vis \ eagleapp"-ID "USR: Pwd "'
If mode = 1: # Get
Cmd = EXE + R 'get' + userpwd + R'-V "% s"-a "% s"-z/diebond/% s' % (versionlabel, DST, SRC)
Elif mode = 2: # Check out
Cmd = EXE + R 'get' + userpwd + R'-V "% s"-l-A "% s"-z/diebond/% s' % (versionlabel, DST, Src)
Elif mode = 3: # Put, use default Source Path
If Len (versionlabel)> 0:
Cmd = EXE + R 'put' + userpwd + R'-V "% s"-M "% s"-z/diebond/% s' % (versionlabel, description, SRC)
Else:
Cmd = EXE + R 'put' + userpwd + R'-M "% s"-z/diebond/% s' % (description, Src)
Status = OS. System (CMD)
Print '****', filenum, status #, SRC, DST
If status! = 0:
OS. System ("pause ")
Filenum + = 1