Here are the examples of the python api sys._platform.lower taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
def ConvertToPython(xml=False,request=None,guiLog=False,path=None,literalPath=None,dumpXml=False,dumpToFile=False,dumpFilePath=None):
print "### Please review the generated cmdlets before deployment.\n"
global displayXml, outFileFlag, outFilePath, outFile
displayXml=dumpXml
outFileFlag=dumpToFile
outFilePath=dumpFilePath
if outFileFlag in _AffirmativeList:
if outFilePath:
print "### Script Output is in file < " + outFilePath + " >"
outFile = open(outFilePath, 'w')
outFile.close()
#outFile = open(r"c:\work.txt", 'w+')
else:
print "Please profide dumpFilePath"
return
if xml in _AffirmativeList:
if guiLog in _AffirmativeList:
print "parameter <xml> takes precedence over <guiLog>"
if request:
GenerateCmdlets(request)
elif path or literalPath:
IfPathOrLiteralPath(path,literalPath,False)
else:
print "Please provide request"
return
elif guiLog in _AffirmativeList:
if path or literalPath:
IfPathOrLiteralPath(path,literalPath,True)
else:
print "Please provide path or literalPath"
else:
from sys import platform as _platform
if _platform.lower() == "linux" or _platform.lower() == "linux2":
# linux
logFilePath = GetUCSDefaultLogpathLinux()
elif _platform.lower() == "darwin":
# OS X
logFilePath = GetUCSDefaultLogpathOSX()
elif _platform.lower() == "win32" or _platform.lower() == "win64":
# Windows...
logFilePath = GetUCSDefaultLogpathWindows()
elif "cygwin" in _platform.lower():
# Cygwin
logFilePath = GetUCSDefaultLogpathCygwin()
else:
print "[Error]: Unsupported OS:",_platform
logFilePath = None
return
## Get the latest logfile
#logFilePath = r"C:\Users\ragupta4\AppData\LocalLow\Sun\Java\Deployment\log\.ucsm"
#files = [ file for file in glob.glob(logFilePath + "\\" + "*") if os.path.isfile(file)]
os.chdir(logFilePath)
files = [ file for file in glob.glob("centrale_*.log") if os.path.isfile(file)]
files.sort(key=lambda x: os.path.getmtime(x), reverse=True)
lastUpdatedFile = files[0]
fileStream = open(lastUpdatedFile, 'r')
## read the file till the end
cnt = 0
for line in fileStream:
cnt += 1
## Wait indefinitely until receive new line of set and then again wait
while True:
line = fileStream.readline()
if line:
FindXmlRequestsInFile_test(fileStream, True)
time.sleep(2)
fileStream.close()
#if outFilePath:
#outFile.close()
print "### End of Convert-To-Python ###"