''' Created on Oct 27, 2015 @author: wujz ''' from CreateExtensionIndex.createExtensionIndex import createExtensionIndex if __name__ == '__main__': # Currently this script is only used for stats # if options.productName.lower() != "modeler" and options.productName.lower() != "stats": # parser.error("Please input valid product name modeler or stats (casesensitive) for your index file") try: createExtensionIndex('C:\\Users\\wujz\\Desktop\\modelertest', 'modeler') except IOError as e: print(str(e)) except Exception as e: print(str(e))
shutil.rmtree(savePath, ignore_errors=True) except: raise Exception("Cannot get administrator permission to delete " + savePath) # savePath = os.path.join(r'C:\Users\wujz\Desktop',PACAKAGE) logPath = os.path.join(savePath, LOG_DIR_NAME) os.mkdir(savePath) os.mkdir(logPath) mainLogger = Logger(os.path.join(logPath, LOG_NAME), "mainLogger") try: mainLogger.info("Main Script start ... ") # create index for extension mainLogger.info("'CreateExtensionIndex' start...") ext_path = createExtensionIndex(savePath, ABBR_PRODUCT) mainLogger.info("'CreateExtensionIndex' complete...") """ Description: create two threads -- one aimed at creating license index; the other aimed at creating lang index """ # create thread to get index for license mainLogger.info("'CreateLicenseIndex' thread start...") runCreateLicenseIndex = runScriptThread(createLicenseIndex, savePath, ext_path) runCreateLicenseIndex.setDaemon(True) runCreateLicenseIndex.start() # create thread to get index for language mainLogger.info("CreateLangIndex' thread start ...") runCreateLangIndex = runScriptThread(createLangIndex, savePath, ext_path) runCreateLangIndex.setDaemon(True)
except: raise Exception("Cannot get administrator permission to delete "+savePath) # logPath = ../Package/log logPath = os.path.join(savePath,LOG_DIR_NAME) os.mkdir(savePath) os.mkdir(logPath) mainLogger = Logger(os.path.join(logPath,LOG_NAME),'mainLogger') try: mainLogger.info("Main Script start ... ") # create index for extension mainLogger.info("'CreateExtensionIndex' start...") ext_path = createExtensionIndex(savePath, productName) mainLogger.info("'CreateExtensionIndex' complete...") ''' Description: create two threads -- one aimed at creating license index; the other aimed at creating lang index ''' # create thread to get index for license mainLogger.info("'CreateLicenseIndex' thread start...") runCreateLicenseIndex = runScriptThread(createLicenseIndex, savePath, ext_path) runCreateLicenseIndex.setDaemon(True) runCreateLicenseIndex.start() # create thread to get index for language mainLogger.info("CreateLangIndex' thread start ...") runCreateLangIndex = runScriptThread(createLangIndex, savePath, ext_path) runCreateLangIndex.setDaemon(True)
''' Created on Oct 27, 2015 @author: wujz ''' from CreateExtensionIndex.createExtensionIndex import createExtensionIndex from optparse import OptionParser import os if __name__ == '__main__': #usage = "usage: %prog [options] arg1 arg2" usage = "usage: %prog [options] arg1" parser = OptionParser(usage) parser.add_option("-o", "--output", dest="outdir", action='store', help="Choose a dir to save index file.") #parser.add_option("-p", "--product", dest="productName", action='store', help="Choose index for which product: 1. SPSS Modeler 2. SPSS Statistics.") (options, args) = parser.parse_args() if not os.path.isdir(): parser.error("Please input a valid directory to create index file.") # Currently this script is only used for stats # if options.productName.lower() != "modeler" and options.productName.lower() != "stats": # parser.error("Please input valid product name modeler or stats (casesensitive) for your index file") try: createExtensionIndex(options.outdir, 'stats') except IOError as e: print(str(e)) except Exception as e: print(str(e))