def copy_libs(project, project_path, export_path, include_symbols): """ Searches the bin folder for files that fit the name of the shared libs, and copies them to the export directory. """ libs = cryproject.libs_list(project) if not libs: return bin_dir = os.path.join(project_path, "bin") if not os.path.isdir(bin_dir): return export_bin = os.path.join(export_path, "bin") exclude = ["*.mdb", "*.xml", "*.ilk"] if not include_symbols: exclude.append("*.pdb") for lib in libs: if not lib: continue shared = lib.get("shared", None) if not shared: continue any_config = shared.get("any", None) win86 = shared.get("win_x86", None) win64 = shared.get("win_x64", None) if any_config: include = ["{}*".format(any_config)] copy_directory_contents(bin_dir, export_bin, include, exclude) if win86: include = ["{}*".format(win86)] copy_directory_contents(os.path.join(bin_dir, "win_x86"), os.path.join(export_bin, "win_x86"), include, exclude) if win64: include = ["{}*".format(win64)] copy_directory_contents(os.path.join(bin_dir, "win_x64"), os.path.join(export_bin, "win_x64"), include, exclude)
def copy_libs(project, project_path, export_path): """ Searches the bin folder for files that fit the name of the shared libs, and copies them to the backup directory. """ libs = cryproject.libs_list(project) if not libs: return # The bin folders are optional since they can be generated from the source code. # So if they don't exist just skip them. bin_dir = os.path.join(project_path, "bin") if not os.path.isdir(bin_dir): return export_bin = os.path.join(export_path, "bin") exclude = ["*.ilk"] for lib in libs: if not lib: continue shared = lib.get("shared", None) if not shared: continue any_config = shared.get("any", None) win86 = shared.get("win_x86", None) win64 = shared.get("win_x64", None) if any_config: include = ["{}*".format(any_config)] copy_directory_contents(bin_dir, export_bin, include, exclude, overwrite=True) if win86: include = ["{}*".format(win86)] src_path = os.path.join(bin_dir, "win_x86") dst_path = os.path.join(export_bin, "win_x86") if os.path.isdir(src_path): copy_directory_contents(src_path, dst_path, include, exclude, overwrite=True) if win64: include = ["{}*".format(win64)] src_path = os.path.join(bin_dir, "win_x64") dst_path = os.path.join(export_bin, "win_x64") if os.path.isdir(src_path): copy_directory_contents(src_path, dst_path, include, exclude, overwrite=True)