Filewatcher File Search
FTP Search
  
Directory (beta)
  
Content Search (beta)
   
pkg://katana-build-2.0.0-1.noarch.rpm:11897/usr/share/katana/build/stage3.py  info  downloads

import operator
import os
import zipfile

def listClasses(jarfile):
    return [item for item in zipfile.ZipFile(jarfile, "r").namelist()
            if item.endswith(".class")]


def locateClasses(classes):
    # Build a list of all source files (hashed for speed)
    def visit(hash, dirname, names):
        for name in names:
            if name.endswith(".java"):
                path = os.path.join(dirname, name)
                if os.path.isfile(path):
                    if not hash.has_key(name):
                        hash[name] = []
                    hash[name].append(os.path.normpath(path))
    sources = {}
    os.path.walk(".", visit, sources)

    # Build a list of all directories we need to copy
    dirs = []
    for source in [cls[:-6] + ".java" for cls in classes if not "$" in cls]:
        for path in sources.get(os.path.split(source)[1], []):
            if path == source:
                continue
            if path.endswith(source):
                dir = os.path.join(
                    path[:-len(source)], source.split(os.sep, 1)[0])
                if dir not in dirs:
                    dirs.append(dir)
                break
    return dirs

def getCopyCommands(dirs):
    return ["cp -a %s ." % dir for dir in dirs] # XXX todo

if __name__ == "__main__":
    import sys
    for command in getCopyCommands(locateClasses(
        reduce(operator.add, map(listClasses, sys.argv[1:])))):
        print command
Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2008 IT MARUHN