Mercurial > repos > cathywise > truststore_import
comparison TrustStoreGalaxyImport.py @ 31:6e2dba73eebd
Undo multi file ugh.
| author | Catherine Wise <catherine.wise@csiro.au> | 
|---|---|
| date | Thu, 23 Jan 2014 10:48:07 +1100 | 
| parents | c659bd6342ae | 
| children | 2ced2ca1c758 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 30:c659bd6342ae | 31:6e2dba73eebd | 
|---|---|
| 61 filename = "" | 61 filename = "" | 
| 62 outputFile = "" | 62 outputFile = "" | 
| 63 if len(sys.argv) > 10: | 63 if len(sys.argv) > 10: | 
| 64 filename = sys.argv[9] | 64 filename = sys.argv[9] | 
| 65 outputFile = sys.argv[10] | 65 outputFile = sys.argv[10] | 
| 66 outputFileId = sys.argv[11] | 66 # outputFileId = sys.argv[11] | 
| 67 outputFileType = sys.argv[12] | 67 # outputFileType = sys.argv[12] | 
| 68 otherFilesDir = sys.argv[13] | 68 # otherFilesDir = sys.argv[13] | 
| 69 else: | 69 else: | 
| 70 outputFile = sys.argv[9] | 70 outputFile = sys.argv[9] | 
| 71 | 71 | 
| 72 config = TrustStoreClient.Config(ims_url, kms_url, client_key, client_secret) | 72 config = TrustStoreClient.Config(ims_url, kms_url, client_key, client_secret) | 
| 73 ts = TrustStoreClient.TrustStoreClient(headless=True, config=config) | 73 ts = TrustStoreClient.TrustStoreClient(headless=True, config=config) | 
| 92 else: | 92 else: | 
| 93 location = root | 93 location = root | 
| 94 if filename and filename != "": | 94 if filename and filename != "": | 
| 95 outputFileList = [outputFile] | 95 outputFileList = [outputFile] | 
| 96 inputFileList = None | 96 inputFileList = None | 
| 97 if "," in filename: # we have multiple files guys. | 97 # if "," in filename: # we have multiple files guys. | 
| 98 inputFileList = filename.split(",") | 98 # inputFileList = filename.split(",") | 
| 99 for inputFile in inputFileList: | 99 # for inputFile in inputFileList: | 
| 100 outName = "%s_%s_%s_%s_%s" % ('primary', outputFileId, inputFile.replace(".","-"), 'visible', outputFileType) | 100 # outName = "%s_%s_%s_%s_%s" % ('primary', outputFileId, inputFile.replace(".","-"), 'visible', outputFileType) | 
| 101 outputFileList.append(os.path.join(otherFilesDir, outName)) | 101 # outputFileList.append(os.path.join(otherFilesDir, outName)) | 
| 102 else: | 102 # else: | 
| 103 inputFileList = [filename] | 103 inputFileList = [filename] | 
| 104 for inFile, outFile in zip(inputFileList, outputFileList): | 104 for inFile, outFile in zip(inputFileList, outputFileList): | 
| 105 downloadMe = ts_utils.ts_utils.recurseToChildNamed(location, inFile) | 105 downloadMe = ts_utils.ts_utils.recurseToChildNamed(location, inFile) | 
| 106 if downloadMe: | 106 if downloadMe: | 
| 107 download = ts.getFile(store, downloadMe) | 107 download = ts.getFile(store, downloadMe) | 
| 108 ungzip(download, outFile) | 108 ungzip(download, outFile) | 
