Back to index

enigmail  1.4.3
Functions
createprecomplete Namespace Reference

Functions

def get_build_entries
def generate_precomplete

Function Documentation

Creates the precomplete file containing the remove and rmdir
    application update instructions. The current working directory is used
    for the location to enumerate and to create the precomplete file.

Definition at line 44 of file createprecomplete.py.

00044 
00045 def generate_precomplete():
00046     """ Creates the precomplete file containing the remove and rmdir
00047         application update instructions. The current working directory is used
00048         for the location to enumerate and to create the precomplete file.
00049     """
00050     root_path = os.getcwd()
00051     # If inside a Mac bundle use the root of the bundle for the path.
00052     if os.path.basename(root_path) == "MacOS":
00053         root_path = os.path.abspath(os.path.join(root_path, '../../'))
00054 
00055     rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)
00056     precomplete_file_path = os.path.join(root_path,"precomplete")
00057     # open in binary mode to prevent OS specific line endings.
00058     precomplete_file = open(precomplete_file_path, "wb")
00059     for rel_file_path in rel_file_path_list:
00060         precomplete_file.writelines("remove \""+rel_file_path+"\"\n")
00061 
00062     for rel_dir_path in rel_dir_path_list:
00063         precomplete_file.writelines("rmdir \""+rel_dir_path+"\"\n")
00064 
00065     precomplete_file.close()

Here is the call graph for this function:

Iterates through the root_path, creating a list for each file and
    directory. Excludes any path starting with extensions or distribution
    and paths ending with channel-prefs.js.

Definition at line 12 of file createprecomplete.py.

00012 
00013 def get_build_entries(root_path):
00014     """ Iterates through the root_path, creating a list for each file and
00015         directory. Excludes any path starting with extensions or distribution
00016         and paths ending with channel-prefs.js.
00017     """
00018     rel_file_path_set = set()
00019     rel_dir_path_set = set()
00020     for root, dirs, files in os.walk(root_path):
00021         for file_name in files:
00022             parent_dir_rel_path = root[len(root_path)+1:]
00023             rel_path_file = os.path.join(parent_dir_rel_path, file_name)
00024             rel_path_file = rel_path_file.replace("\\", "/")
00025             if not (rel_path_file.startswith("distribution/") or
00026                     rel_path_file.startswith("extensions/") or
00027                     rel_path_file.endswith("channel-prefs.js")):
00028                 rel_file_path_set.add(rel_path_file)
00029 
00030         for dir_name in dirs:
00031             parent_dir_rel_path = root[len(root_path)+1:]
00032             rel_path_dir = os.path.join(parent_dir_rel_path, dir_name)
00033             rel_path_dir = rel_path_dir.replace("\\", "/")+"/"
00034             if not (rel_path_dir.startswith("distribution/") or
00035                     rel_path_dir.startswith("extensions/")):
00036                 rel_dir_path_set.add(rel_path_dir)
00037 
00038     rel_file_path_list = list(rel_file_path_set)
00039     rel_file_path_list.sort(reverse=True)
00040     rel_dir_path_list = list(rel_dir_path_set)
00041     rel_dir_path_list.sort(reverse=True)
00042 
00043     return rel_file_path_list, rel_dir_path_list

Here is the caller graph for this function: