def extract_xpi(xpi, path, expand=False, verify=True):
 expand_allow_list = ['.crx', '.jar', '.xpi', '.zip']
 tempdir = extract_zip(xpi)
 all_files = get_all_files(tempdir)
 if expand:
  for x in xrange(0, 10):
   flag = False
   for (root, dirs, files) in os.walk(tempdir):
    for name in files:
     if (os.path.splitext(name)[1] in expand_allow_list):
      src = os.path.join(root, name)
      if (not os.path.isdir(src)):
       dest = extract_zip(src, remove=True, fatal=False)
       all_files.extend(get_all_files(dest, strip_prefix=tempdir, prefix=src))
       if dest:
        copy_over(dest, src)
        flag = True
   if (not flag):
    break
 copy_over(tempdir, path)
 return all_files

def extract_xpi ( xpi , path , expand = False , verify = True ) : expand_allow_list = [ '.crx' , '.jar' , '.xpi' , '.zip' ] tempdir = extract_zip ( xpi ) all_files = get_all_files ( tempdir ) if expand : for x in xrange ( 0 , 10 ) : flag = False for ( root , dirs , files ) in os . walk ( tempdir ) : for name in files : if ( os . path . splitext ( name ) [ 1 ] in expand_allow_list ) : src = os . path . join ( root , name ) if ( not os . path . isdir ( src ) ) : dest = extract_zip ( src , remove = True , fatal = False ) all_files . extend ( get_all_files ( dest , strip_prefix = tempdir , prefix = src ) ) if dest : copy_over ( dest , src ) flag = True if ( not flag ) : break copy_over ( tempdir , path ) return all_files
if expand is given .