[Uludag-commits] r15613 - branches/pisi-1.1/pisi

uludag-commits at pardus.org.tr uludag-commits at pardus.org.tr
3 Eki 2007 Çar 16:44:33 EEST


Author: caglar
Date: Wed Oct  3 16:44:32 2007
New Revision: 15613

Modified:
   branches/pisi-1.1/pisi/util.py
Log:
see ya

Modified: branches/pisi-1.1/pisi/util.py
=================================================================
--- branches/pisi-1.1/pisi/util.py	(original)
+++ branches/pisi-1.1/pisi/util.py	Wed Oct  3 16:44:32 2007
@@ -386,96 +386,6 @@
                 yield calculate_hash(root)
 
 
-# FIXME: this should be done in a much much simpler way
-# as it stands, it seems to be a kludge to solve
-# an unrelated problem
-def crap_get_file_hashes(top, excludePrefix=None, removePrefix=None):
-    """Iterate over given path and return a list of file hashes.
-    
-    Generator function iterates over a toplevel path and returns the
-    (filePath, sha1Hash) tuples for all files. If excludePrefixes list
-    is given as a parameter, function will exclude the filePaths
-    matching those prefixes. The removePrefix string parameter will be
-    used to remove prefix from filePath while matching excludes, if
-    given.
-    """
-
-    def sha1_sum(f, data=False):
-        if not data and f.endswith('.a'):
-            #workaround for .a issue..
-            #don't skip .a files,
-            #but pad their timestamps with '0'..
-            clean_ar_timestamps(f)
-
-        func = None
-
-        if data:
-            func = sha1_data
-        else:
-            func = sha1_file
-
-        try:
-            return func(f)
-        except FileError, e:
-            if os.path.islink(f):
-                ctx.ui.info(_("Including external link '%s'") % f)
-            elif os.path.isdir(f):
-                ctx.ui.info(_("Including directory '%s'") % f)
-            else:
-                raise e
-            return None
-
-    def has_excluded_prefix(filename):
-        if excludePrefix and removePrefix:
-            tempfnam = remove_prefix(removePrefix, filename)
-            for p in excludePrefix:
-                if tempfnam.startswith(p):
-                    return 1
-        return 0
-
-    # handle single file
-    if os.path.isfile(top):
-        yield (top, sha1_sum(top))
-        return
-
-    # handle single symlink declaration here.
-    if os.path.islink(top):
-        yield (top, sha1_sum(os.readlink(top), True))
-        return
-
-    for root, dirs, files in os.walk(top, topdown=False):
-        #bug 339
-        if os.path.islink(root) and not has_excluded_prefix(root):
-            #yield the symlink..
-            #bug 373
-            yield (root, sha1_sum(os.readlink(root), True))
-            excludePrefix.append(remove_prefix(removePrefix, root) + "/")
-            continue
-
-        #bug 397
-        for directory in dirs:
-            d = join_path(root, directory)
-            if os.path.islink(d) and not has_excluded_prefix(d):
-                yield (d, sha1_sum(os.readlink(d), True))
-                excludePrefix.append(remove_prefix(removePrefix, d) + "/")
-
-        #bug 340
-        if os.path.isdir(root) and not has_excluded_prefix(root):
-            parent, r, d, f = root, '', '', ''
-            for r, d, f in os.walk(parent, topdown=False): pass
-            if not f and not d:
-                yield (parent, sha1_sum(parent))
-
-        for fname in files:
-            f = join_path(root, fname)
-            if has_excluded_prefix(f):
-                continue
-            #bug 373
-            elif os.path.islink(f):
-                yield (f, sha1_sum(os.readlink(f), True))
-            else:
-                yield (f, sha1_sum(f))
-
 def copy_dir(src, dest):
     """Copy source dir to destination dir recursively."""
     shutil.copytree(src, dest)


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi