def debug(s): log.debug(colourize(s, BLACK))
def error(s, code=1): log.error(colourize(s, RED)) if code: exit(code)
### begin of user input print("These are the libraries contained in the EAR file, that need to be deployed:") print(pformat(ear.libraries) + "\n") print("Possible deployment targets are (read from catalina.properties):") for tuple in zip(range(len(library_paths)), library_paths): print("\t%s -> %s" % tuple) index = prompt("Where do you want the libraries to be deployed?", lambda x: x in range(len(library_paths)), int) library_path = library_paths[index] # print summary and let user decide whether to continue print("\nLibraries will be deployed here: %s" % colourize(library_path, YELLOW)) web_path = path['catalina_deploy'] print("Web modules will be deployed here: %s\n" % colourize(web_path, YELLOW)) print("If you want to deploy the WEB(s) to a different directory, please") print("set the CATALINA_DEPLOY environment variable.\n") if prompt("Do you want to continue? (yes|no)", lambda x: x in YES + NO) in NO: error("Exiting, user decided not to continue.") # extract all library JARs info("Extracting libraries to %s..." % library_path) for library in ear.libraries: write_obj(ear.extract_library, library, library_path, overwrite_callback) # extract all WEBs