def setup(): 'Add CMT setup scripts to the setup directory.' setup = srcdir() + '/mgr/setup' fs.assure(fs.setup()) fs.goto(fs.setup()) def do_link(ext): if os.path.exists('00_cmt'+ext): os.remove('00_cmt'+ext) import shutil shutil.copy(setup+ext,'00_cmt'+ext) for ext in ['.sh','.csh']: do_link(ext) return fs.setup() + '/00_cmt.sh'
def setup(): "Add GIT setup scripts to the setup directory." fs.assure(fs.setup()) fs.goto(fs.setup()) for export, letter, equals in [("export", "", "="), ("setenv", "c", " ")]: ss = open("00_git.%ssh" % letter, "w") ss.write( """#!/bin/%ssh %s PATH%s%s:${PATH} """ % (letter, export, equals, os.path.join(prefix(), "bin")) ) ss.close() return fs.setup() + "/00_git.sh"
def do_init_cmtconfig(self,cmtconfig = None): 'Add setting CMTCONFIG to setup project.' import os if cmtconfig is None: cmtconfig = os.getenv('CMTCONFIG',None) if cmtconfig is None: cmtconfig = self.lcgcmt.cmtconfig() if cmtconfig is None: raise ValueError, 'Unable to get good CMTCONFIG' if isinstance(cmtconfig,list): cmtconfig = cmtconfig[0] print 'Saving CMTCONFIG =',cmtconfig import fs base = fs.setup() # Bourne Shell sh = open(os.path.join(base,'20_cmtconfig.sh'),'w') sh.write('''#!/bin/sh CMTCONFIG=%s export CMTCONFIG '''%cmtconfig) sh.close() # C(rappy) Shell csh = open(os.path.join(base,'20_cmtconfig.csh'),'w') csh.write('''#!/bin/csh setenv CMTCONFIG %s '''%cmtconfig) csh.close() return
def init(): import fs setupdir = fs.setup() fs.assure(setupdir) # Note, we use the setup directory name as the base name for # top-level setup files, this is just coincidence/convention dump_sh(setupdir) dump_csh(setupdir)
def init_project(self,deps=None): 'Initialize the LCGCMT project' import fs,os from ConfigParser import NoOptionError setupdir = fs.setup() fs.assure(setupdir) base = fs.setup() tags = ['garpi'] try: extra_tags = eval(self.get_config('extra_tags')) tags += extra_tags except NoOptionError: pass tags = ','.join(tags) #print 'setting extra tags =',tags values = (os.path.dirname(fs.projects()), os.path.basename(fs.projects()),tags) # Bourne Shell sh = open(os.path.join(base,'10_lcgcmt.sh'),'w') sh.write('''#!/bin/sh SITEROOT=%s export SITEROOT CMTPROJECTPATH=$SITEROOT/%s export CMTPROJECTPATH CMTEXTRATAGS=%s export CMTEXTRATAGS '''%values) sh.close() # C(rappy) Shell csh = open(os.path.join(base,'10_lcgcmt.csh'),'w') csh.write('''#!/bin/csh setenv SITEROOT %s setenv CMTPROJECTPATH %s setenv CMTEXTRATAGS %s '''%values) csh.close() return