Example #1
0
    def _setup_project(self):
        'Set up personal project'
        path = self.cfg.project_dir

        cmtprojectpath = os.path.dirname(path)
        try:
            cpp = self.env['CMTPROJECTPATH']
        except KeyError:
            cpp = cmtprojectpath
        else:
            cpp = cmtprojectpath + ':' + cpp
        self.env['CMTPROJECTPATH'] = cpp

        package = self.cfg.package
        path = os.path.join(path,package,'cmt')


        if not os.path.exists(path+'/setup.sh'):
            sys.stderr.write('Running "cmt config" in "%s"\n'%path)
            cmd('cmt config',env=self.env,path=path)
        # Do it twice. See bug #105
        sys.stderr.write('Sourcing setup.sh in "%s"\n'%path)
        self.env = source('setup.sh',env=self.env,path=path)
        self.env = source('setup.sh',env=self.env,path=path)
        return
Example #2
0
 def _setup_cmds(self,cmds):
     'Incorporate pre/post env commands'
     if type(cmds) == type(""): cmds = eval(cmds)
     new_env = self.env
     cmdlist = []
     for cmd in cmds:
         chunk = cmd.split()
         if chunk[0] == 'set':
             sk,v = cmd.split('=')
             v = v.strip()
             v = os.path.expanduser(os.path.expandvars(v))
             s,k = sk.split()
             k = k.strip()
             #sys.stderr.write('DEBUG: "%s" "%s" "%s"\n'%(s,k,v))
             new_env[k.strip()] = v
             cmdlist.append(('set',(k,v)))
             continue
         if chunk[0] == 'source':
             sys.stderr.write('source %s\n'%chunk[1])
             new_env = source(chunk[1],env=new_env)
             cmdlist.append(('source',chunk[1:]))
             continue
         if chunk[0] == 'emit':
             sys.stderr.write('Warning: not yet supported: emit %s\n'%\
                                  (' '.join(chunk[1:])))
             cmdlist.append(('emit',chunk[1:]))
             continue
         print 'Unknown command: "%s"'%cmd
         continue
     self.env.update(new_env)
     return cmdlist
Example #3
0
 def _setup_base(self):
     'Set up the base release'
     self._setup_cmt()
     rp = self.cfg.release_package
     if not rp: return
     if rp[0] != '/':
         br = self.cfg.base_release
         rp = os.path.join(br,rp)
     path = os.path.join(rp,'cmt')
     sys.stderr.write('source setup.sh in %s\n'%path)
     self.env = source('setup.sh',env=self.env,path=path)
     return
Example #4
0
 def _setup_cmt(self):
     'Do basic setup that brings in CMT.'
     path = self.cfg.base_release
     sys.stderr.write('source setup.sh in %s\n'%path)
     self.env = source('setup.sh',env=self.env,path=path)
     return