if len(sys.argv) != 2: error("Script expects an EAR file as it's single argument.") ear = Ear(sys.argv[1]) debug("EAR libraries: " + pformat(ear.libraries)) path = resolve_paths(os.environ) debug("Paths: " + pformat(path)) # these need to be applied to property files env = {'catalina.home': path['catalina_home'], 'catalina.base': path['catalina_base']} with open(path['catalina.properties']) as f: props = parse_properties(f, env) debug(pformat(props)) commonl = props['common.loader'] sharedl = props['shared.loader'] serverl = props['server.loader'] library_paths = filter(p_not_empty_nor_jar, set(list(commonl) + list(sharedl) + list(serverl))) debug("Library paths: " + pformat(library_paths)) ### 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):")
def parse_properties2(fname, reps={}): with open(fname) as f: props = parse_properties(f, replace=reps) print('Contents of %s:' % fname) pprint(props) return props