コード例 #1
0
ファイル: playlist.py プロジェクト: LeonB/pmpd
    def add(self, input):
        clss = input.__class__

        #Array
        if clss == list:
          for x in input:
            self.add(x)

        #String
        elif clss == str:
            input = os.path.expanduser(input)

            if os.path.isfile(input):
                input = os.path.abspath(input)
                self.add_file(file(input))
            elif os.path.isdir(input):
                self.add_dir(input)
            else:
                files = mglob.expand(input)
                files.sort()

                for i in files:
                    if not os.path.isfile(i) and not os.path.isdir(i):
                        files.remove(i)
                    else:
                        self.add(i)

        #File
        elif clss == file:
            self.add_file(input)

        #directory
        elif clss == dir:
            self.add_dir(input)
コード例 #2
0
ファイル: ashac.py プロジェクト: vivainio/ashac
def myapps_cmd(args):
	print "myapps_cmd",args
	files = mglob.expand(args.file)
	tg = pj(ctr.get_fs(), "C/predefjava/predefcollections")

	print "Copying",files, "to",tg
	for f in files:
		shutil.copy(f, tg)
コード例 #3
0
ファイル: jardumpr.py プロジェクト: bincker/jardumpr
def extract_jar(jarf):
    try:
        zf = zipfile.ZipFile(jarf, "r")
    except zipfile.BadZipfile:
        print "corrupt: bad zip,",jarf
        raise
    td = tempfile.mkdtemp()
    tempdirs.append(td)
    zf.extractall(td)
    return mglob.expand("rec:" + td + "=*.class")
コード例 #4
0
ファイル: atbldr.py プロジェクト: grodniewicz/oship
def CreatePy(adlDir,py_filesDir):
    """
    Create parse results to send to the builder.
    """

    fnames = mglob.expand("rec:"+adlDir+"=*.adl")
    n=0
    e=0
    errCount=0
    count=len(fnames)
    #startTime=time.clock()

    fnames.sort()
    print "ADL File count: ",count," in ",adlDir
    print "\n Placing Python source files in ", py_filesDir

    for fname in fnames:
        n+=1
        print "\n\nProcessing # ",n,' of ',count,' --->',fname
        adlSource = file(fname).read()

        try:
            # parsed_adl is the returned ParseResults object
            parsed_adl = adl_1_4.archetypeDefinition.parseString(adlSource)
        except ParseException:
            e+=1
            logging.error("Error # "+str(e)+" Occured Parsing "+fname+':\n')
            print "Parsing Failed -- Error Logged!\n"
            errCount+=1
        else:
            logging.info("Processing: "+fname)
            bldArchetype(fname,parsed_adl,py_filesDir)


    #print "\n\nParsed ",count," files in",time.clock()-startTime," seconds."
    print "\n\nParsed ",count," files."
    print "There were ",errCount," parse errors. "
    logging.info("There were "+repr(errCount)+" parse errors. ")
    if errCount > 0:
        print "Please see the error log file for errors & warnings."


    logging.info("*******END OF LOG FILE FOR THIS RUN*******")

    return