def check_or_copy_files()

in python/setup.py [0:0]


def check_or_copy_files(filename_pattern: str, src: str, dst: str) -> None:
    """
    Checks if file(s) exist(s) in dst, updating if src has a newer version
    """

    # create list in src, check if files exist in dst
    # copy if src has a newer version
    src_list = glob.glob(os.path.join(src, filename_pattern))
    if (len(src_list) > 0):
        for src_file in src_list:
            dst_file = os.path.join(dst, os.path.basename(src_file))
            if os.path.exists(dst_file):
                if os.path.getmtime(src_file) > os.path.getmtime(dst_file):
                    copyfile(src_file, dst_file)
            else:
                copyfile(src_file, dst_file)

    # copying done, if necessary, so check if file exists in dst
    dst_file = glob.glob(os.path.join(dst, filename_pattern))
    if (len(dst_file) == 0):
        print(missing_jars_message, file=sys.stderr)
        sys.exit(-1)