@@ -0,0 +1,2980 @@
+# Any copyright is dedicated to the Public Domain.%0A# http://creativecommons.org/publicdomain/zero/1.0/%0A%0A# Creates the precomplete file containing the remove and rmdir application%0A# update instructions which is used to remove files and directories that are no%0A# longer present in a complete update. The current working directory is used for%0A# the location to enumerate and to create the precomplete file.%0A%0Aimport sys%0Aimport os%0A%0Adef get_build_entries(root_path):%0A    %22%22%22 Iterates through the root_path, creating a list for each file and%0A        directory. Excludes any file paths ending with channel-prefs.js.%0A    %22%22%22%0A    rel_file_path_set = set()%0A    rel_dir_path_set = set()%0A    for root, dirs, files in os.walk(root_path):%0A        for file_name in files:%0A            parent_dir_rel_path = root%5Blen(root_path)+1:%5D%0A            rel_path_file = os.path.join(parent_dir_rel_path, file_name)%0A            rel_path_file = rel_path_file.replace(%22%5C%5C%22, %22/%22)%0A            if not (rel_path_file.endswith(%22channel-prefs.js%22) or%0A                    rel_path_file.endswith(%22update-settings.ini%22) or%0A                    rel_path_file.find(%22distribution/%22) != -1):%0A                rel_file_path_set.add(rel_path_file)%0A%0A        for dir_name in dirs:%0A            parent_dir_rel_path = root%5Blen(root_path)+1:%5D%0A            rel_path_dir = os.path.join(parent_dir_rel_path, dir_name)%0A            rel_path_dir = rel_path_dir.replace(%22%5C%5C%22, %22/%22)+%22/%22%0A            if rel_path_dir.find(%22distribution/%22) == -1:%0A                rel_dir_path_set.add(rel_path_dir)%0A%0A    rel_file_path_list = list(rel_file_path_set)%0A    rel_file_path_list.sort(reverse=True)%0A    rel_dir_path_list = list(rel_dir_path_set)%0A    rel_dir_path_list.sort(reverse=True)%0A%0A    return rel_file_path_list, rel_dir_path_list%0A%0Adef generate_precomplete(root_path):%0A    %22%22%22 Creates the precomplete file containing the remove and rmdir%0A        application update instructions. The given directory is used%0A        for the location to enumerate and to create the precomplete file.%0A    %22%22%22%0A    rel_path_precomplete = %22precomplete%22%0A    # If inside a Mac bundle use the root of the bundle for the path.%0A    if os.path.basename(root_path) == %22Resources%22:%0A        root_path = os.path.abspath(os.path.join(root_path, '../../'))%0A        rel_path_precomplete = %22Contents/Resources/precomplete%22%0A%0A    precomplete_file_path = os.path.join(root_path,rel_path_precomplete)%0A    # Open the file so it exists before building the list of files and open it%0A    # in binary mode to prevent OS specific line endings.%0A    precomplete_file = open(precomplete_file_path, %22wb%22)%0A    rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)%0A    for rel_file_path in rel_file_path_list:%0A        precomplete_file.writelines(%22remove %5C%22%22+rel_file_path+%22%5C%22%5Cn%22)%0A%0A    for rel_dir_path in rel_dir_path_list:%0A        precomplete_file.writelines(%22rmdir %5C%22%22+rel_dir_path+%22%5C%22%5Cn%22)%0A%0A    precomplete_file.close()%0A%0Aif __name__ == %22__main__%22:%0A    generate_precomplete(os.getcwd())%0A

add createprecomplete.py from m-c.