[80193] contrib/buildbot/master.cfg

wsiegrist at apple.com wsiegrist at apple.com
Wed Jul 6 08:59:56 PDT 2011


Revision: 80193
          http://trac.macports.org/changeset/80193
Author:   wsiegrist at apple.com
Date:     2011-07-06 08:59:55 -0700 (Wed, 06 Jul 2011)
Log Message:
-----------
Tweak json file logic so non-production does not need any files

Modified Paths:
--------------
    contrib/buildbot/master.cfg

Modified: contrib/buildbot/master.cfg
===================================================================
--- contrib/buildbot/master.cfg	2011-07-06 15:55:28 UTC (rev 80192)
+++ contrib/buildbot/master.cfg	2011-07-06 15:59:55 UTC (rev 80193)
@@ -4,6 +4,10 @@
 import json
 import os
 
+
+def _path(name):
+    return os.path.join(os.path.dirname(__file__), name)
+
 # This is a buildmaster config file. It must be installed as
 # 'master.cfg' in your buildmaster's base directory.
 
@@ -16,8 +20,9 @@
 # it has to be)
 
 production = False
-with open(os.path.join(os.path.dirname(__file__), 'config.json')) as f:
-    production = json.load(f)['production']
+if os.path.exists(_path('config.json')):
+    with open(_path('config.json')) as f:
+        production = json.load(f)['production']
 
 ####### BUILDSLAVES
 
@@ -29,7 +34,7 @@
 c['slaves'] = []
 if production:
     slavedata = {}
-    with open(os.path.join(os.path.dirname(__file__), 'slaves.json')) as f:
+    with open(_path('slaves.json')) as f:
         slavedata = json.load(f)
     for slave, pwd in slavedata.items():
         c['slaves'].append(BuildSlave(slave, pwd))
@@ -53,7 +58,7 @@
 if production:
     from buildbot.changes.pb import PBChangeSource
     sourcedata = []
-    with open(os.path.join(os.path.dirname(__file__), 'source.json')) as f:
+    with open(_path('source.json')) as f:
         sourcedata = json.load(f)
     c['change_source'] = PBChangeSource(user=sourcedata[0], passwd=sourcedata[1])
 else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110706/35cefa49/attachment.html>


More information about the macports-changes mailing list