def get_maven_cache_dir(): path = Builder.get_maven_home_dir() if os.path.isdir(path): settings_path = os.path.join(path, 'conf', 'settings.xml') if os.path.exists(settings_path): tree = ET.ElementTree(ET.fromstring(remove_namespace(settings_path))) local_repo_node = tree.find('localRepository') if local_repo_node is not None: return local_repo_node.text return None
def generate_id_file_by_public(public_path, ids_path): if not os.path.exists(public_path): raise FreelineException("public file not found", "public file path: {}".format(public_path)) tree = ET.ElementTree(ET.fromstring(remove_namespace(public_path))) ids_root = ET.Element('resources') for elem in tree.iterfind('public[@type="id"]'): node = ET.SubElement(ids_root, "item") node.attrib['name'] = elem.attrib['name'] node.attrib['type'] = "id" ids_tree = ET.ElementTree(ids_root) ids_tree.write(ids_path, encoding="utf-8")