Esempio n. 1
0
def printDirs():
    D = read_spr_page.getproject()
    dirs = D['dirlist']
    #print dirs
    for dir in dirs:
        print dir
        procs, subdirs = D[dir]
        for sub in subdirs:
            print "    " + sub
Esempio n. 2
0
def printDirs():
    D = read_spr_page.getproject()
    dirs = D['dirlist']
    #print dirs
    for dir in dirs:
        print dir
        procs, subdirs = D[dir]
        for sub in subdirs:
            print "    " + sub
Esempio n. 3
0
def printAll():
    D = read_spr_page.getproject()
    dirs = D['dirlist']
    #print dirs
    for dir in dirs:
        print dir
        procs, subdirs = D[dir]
        for proc in procs:
            print "    " + proc
        for sub in subdirs:
            print "    " + sub + "/"
Esempio n. 4
0
def printAll():
    D = read_spr_page.getproject()
    dirs = D['dirlist']
    #Print dirs
    for dir in dirs:
        print dir
        procs, subdirs = D[dir]
        for proc in procs:
            print "    " + proc
        for sub in subdirs:
            print "    " + sub + "/"
Esempio n. 5
0
    def __init__(self, target, source=None, dirobj=None, ask=1):
        # initialize some variables
        self.write_all = 0
        self.quit = 0
        self.cwd = os.getcwd()
        
        if source == None:
            source = SpiderBatchDir
        if not os.path.exists(source):
            self.displayerror('Error', "UNABLE TO FIND BATCH DIRECTORY " + source)
            return
        if dirobj != None:
            D = dirobj
        else:
            D = read_spr_page.getproject()

        # make the main project directory (target)
        os.chdir(self.cwd)
        if os.path.exists(target) != 1:
            if ask:
                self.displayerror(message="Directory %s not found." % (target))
                askstr = "Create " + target + " and subdirectories? (y/n): "
                yn = self.askinput(askstr)
            else:
                yn = 'y'
            
            if yn == 'y' or yn == 'Y':
                #print "ok"
                try:
                    os.mkdir(target, 0775)
                except:
                    self.displayerror(message='Error: Unable to create ' + target)
                    return
            else:
                return
            
        target = os.path.abspath(target)
        os.chdir(target)
        # make the subdirectories and load the batch files
        dirlist = D['dirlist']

        for dir in dirlist:
            if dir == topleveldir:   # the top-level project directory
                procs, subdirs = D[dir]
                if len(procs) > 0:
                    self.loadBatch(target, procs, source)
                    if self.quit: return
            else:
                if not self.makeDirectory(dir):
                    return
                procs, subdirs = D[dir]
                if len(procs) > 0:
                    self.loadBatch(dir, procs, source)
                    if self.quit: return
                
                if len(subdirs) > 0:
                    os.chdir(dir)
                    for subdir in subdirs:
                        self.makeDirectory(subdir)
                        if self.quit: return
                    os.chdir(target)
Esempio n. 6
0
    def __init__(self, target, source=None, dirobj=None, ask=1):
        # Initialize some variables
        self.write_all = 0
        self.quit = 0
        self.cwd = os.getcwd()
        
        if source == None:
            source = SpiderBatchDir
        if not os.path.exists(source):
            self.displayerror('Error', " UNABLE TO FIND PROCEDURE DIRECTORY " + source)
            return
        if dirobj != None:
            D = dirobj
        else:
            D = read_spr_page.getproject()

        # Make the main project directory (target)
        os.chdir(self.cwd)
        if os.path.exists(target) != 1:
            if ask:
                self.displayerror(message=" Directory %s not found." % (target))
                askstr = "Create " + target + " and subdirectories? (y/n): "
                yn = self.askinput(askstr)
            else:
                yn = 'y'
            
            if yn == 'y' or yn == 'Y':
                #Print "ok"
                try:
                    os.mkdir(target, 0775)
                except:
                    self.displayerror(message=' Error: Unable to create: ' + target)
                    return
            else:
                return
            
        target = os.path.abspath(target)
        os.chdir(target)
        # Make the subdirectories and load the batch files
        dirlist = D['dirlist']

        for dir in dirlist:
            if dir == topleveldir:   # The top-level project directory
                procs, subdirs = D[dir]
                if len(procs) > 0:
                    self.loadBatch(target, procs, source)
                    if self.quit: return
            else:
                if not self.makeDirectory(dir):
                    return
                procs, subdirs = D[dir]
                if len(procs) > 0:
                    self.loadBatch(dir, procs, source)
                    if self.quit: return
                
                if len(subdirs) > 0:
                    os.chdir(dir)
                    for subdir in subdirs:
                        self.makeDirectory(subdir)
                        if self.quit: return
                    os.chdir(target)