Package buildbot :: Package scripts :: Module checkconfig
[frames] | no frames]

Source Code for Module buildbot.scripts.checkconfig

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16  import sys 
17  import os 
18  from twisted.internet import defer 
19  from buildbot import master 
20   
21 -class ConfigLoader(object):
22 - def __init__(self, basedir=os.getcwd(), configFileName="master.cfg"):
23 self.basedir = os.path.abspath(basedir) 24 self.configFileName = os.path.abspath( 25 os.path.join(basedir, configFileName))
26
27 - def load(self):
28 d = defer.succeed(None) 29 30 old_sys_path = sys.path[:] 31 32 def loadcfg(_): 33 sys.path.append(self.basedir) 34 35 bmaster = master.BuildMaster(self.basedir, self.configFileName) 36 return bmaster.loadConfig(open(self.configFileName, "r"), 37 checkOnly=True)
38 d.addCallback(loadcfg) 39 40 # restore sys.path 41 def fixup(x): 42 sys.path[:] = old_sys_path 43 return x
44 d.addBoth(fixup) 45 46 return d 47