15 """ Iterates through the root_path, creating a list for each file and
16 directory. Excludes any path starting with extensions or distribution.
18 rel_file_path_set = set()
19 rel_dir_path_set = set()
20 for root, dirs, files
in os.walk(root_path):
21 for file_name
in files:
22 parent_dir_rel_path = root[len(root_path)+1:]
23 rel_path_file = os.path.join(parent_dir_rel_path, file_name)
24 rel_path_file = rel_path_file.replace(
"\\",
"/")
25 if not (rel_path_file.startswith(
"distribution/")
or
26 rel_path_file.startswith(
"extensions/")):
27 rel_file_path_set.add(rel_path_file)
30 parent_dir_rel_path = root[len(root_path)+1:]
31 rel_path_dir = os.path.join(parent_dir_rel_path, dir_name)
32 rel_path_dir = rel_path_dir.replace(
"\\",
"/")+
"/"
33 if not (rel_path_dir.startswith(
"distribution/")
or
34 rel_path_dir.startswith(
"extensions/")):
35 rel_dir_path_set.add(rel_path_dir)
37 rel_file_path_list = list(rel_file_path_set)
38 rel_file_path_list.sort(reverse=
True)
39 rel_dir_path_list = list(rel_dir_path_set)
40 rel_dir_path_list.sort(reverse=
True)
42 return rel_file_path_list, rel_dir_path_list
45 """ Creates the precomplete file containing the remove, remove-cc, and rmdir
46 application update instructions. The current working directory is used
47 for the location to enumerate and to create the precomplete file.
49 root_path = os.getcwd()
51 if os.path.basename(root_path) ==
"MacOS":
52 root_path = os.path.abspath(os.path.join(root_path,
'../../'))
55 precomplete_file_path = os.path.join(root_path,
"precomplete")
57 precomplete_file = open(precomplete_file_path,
"wb")
58 for rel_file_path
in rel_file_path_list:
59 if rel_file_path.endswith(
"channel-prefs.js"):
60 precomplete_file.writelines(
"remove-cc \""+rel_file_path+
"\"\n")
62 precomplete_file.writelines(
"remove \""+rel_file_path+
"\"\n")
64 for rel_dir_path
in rel_dir_path_list:
65 precomplete_file.writelines(
"rmdir \""+rel_dir_path+
"\"\n")
67 precomplete_file.close()
69 if __name__ ==
"__main__":