<commit_before>import subprocess
import sys
import tarfile


def main():

    if len(sys.argv) != 3:
        print("Invalid parameters! Found {} expected 2".format(len(sys.argv)))
        sys.exit(1)

    print("Creating update package from {} to {} for PCS\n".format(sys.argv[1], sys.argv[2]))

    try:

        data = subprocess.check_output(["git", "diff", "--name-only", sys.argv[1], sys.argv[2]])

    except subprocess.CalledProcessError as e:
        print("Git failed to diff the tags! Remember, you need git for this!", str(e))
        return

    changedFiles = str(data).strip("'b\\n").split("\\n")

    if len(changedFiles) is 0:
        print("No files were changed!")
        return

    for file in changedFiles:
        print("Updating: ", file)

    path = "update/{}_{}.tar.xz".format(sys.argv[1].replace("v", "").replace(".", ""),
                                        sys.argv[2].replace("v", "").replace(".", ""))

    print("\nCreating update package {}\n".format(path))

    try:
        tar = tarfile.open(path, mode="x:xz")
    except FileExistsError as e:
        print("Update package already exists!")
        return

    for file in changedFiles:
        print("Adding to archive " + file)
        try:
            tar.add(file)
        except FileNotFoundError:
            print("WARNING: {} not found!".format(file))
            continue

    print("\nFinishing update package creation...")

    tar.close()

    print("\nUpdate package {} created.".format(path))

if __name__ == "__main__":
    main()<commit_msg>Add location override to mkupdate<commit_after>import os
import subprocess
import sys
import tarfile


def main():

    if len(sys.argv) < 3:
        print("Invalid parameters! Found {} expected 3".format(len(sys.argv)))
        sys.exit(1)

    print("Creating update package from {} to {} for PCS\n".format(sys.argv[1], sys.argv[2]))

    try:

        data = subprocess.check_output(["git", "diff", "--name-only", sys.argv[1], sys.argv[2]])

    except subprocess.CalledProcessError as e:
        print("Git failed to diff the tags! Remember, you need git for this!", str(e))
        return

    changedFiles = str(data).strip("'b\\n").split("\\n")

    if len(changedFiles) is 0:
        print("No files were changed!")
        return

    for file in changedFiles:
        print("Updating: ", file)

    old_ver = sys.argv[1].replace("v", "").replace(".", "")
    new_ver = sys.argv[2].replace("v", "").replace(".", "")

    if len(sys.argv) == 4:
        path = "{}/{}_{}.tar.xz".format(sys.argv[3], old_ver, new_ver)
    else:
        path = "update/{}_{}.tar.xz".format(old_ver, new_ver)


    print("\nCreating update package {}\n".format(path))

    try:
        tar = tarfile.open(path, mode="x:xz")
    except FileExistsError as e:
        print("Update package already exists! Deleting...\n")
        os.remove(path)
        tar = tarfile.open(path, mode="x:xz")

    for file in changedFiles:
        print("Adding to archive " + file)
        try:
            tar.add(file)
        except FileNotFoundError:
            print("WARNING: {} not found!".format(file))
            continue

    print("\nFinishing update package creation...")

    tar.close()

    print("\nUpdate package {} created.".format(path))

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.16415208207604104, 'fraction_numerical': 0.006638503319251659, 'mean_word_length': 2.5416666666666665, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4456951', 'n_tokens_mistral': 1048, 'n_tokens_neox': 997, 'n_words': 255}