phase1, phase2: sort and move imports to the top of the file
[buildbot.git] / phase2 / master.cfg
index d3a76144b33ff31cc3170de72e01c7d8ec72fe14..dd4db32b46d2adf9cde547272e230f024cfdfdab 100644 (file)
@@ -8,6 +8,25 @@ import subprocess
 import configparser
 
 from buildbot import locks
+from buildbot.changes import filter
+from buildbot.changes.gitpoller import GitPoller
+from buildbot.config import BuilderConfig
+from buildbot.plugins import schedulers
+from buildbot.plugins import steps
+from buildbot.plugins import util
+from buildbot.process.factory import BuildFactory
+from buildbot.process.properties import Property
+from buildbot.process.properties import WithProperties
+from buildbot.schedulers.basic import SingleBranchScheduler
+from buildbot.schedulers.forcesched import ForceScheduler
+from buildbot.steps.master import MasterShellCommand
+from buildbot.steps.shell import SetProperty
+from buildbot.steps.shell import ShellCommand
+from buildbot.steps.transfer import FileDownload
+from buildbot.steps.transfer import FileUpload
+from buildbot.steps.transfer import StringDownload
+from buildbot.worker import Worker
+
 
 ini = configparser.ConfigParser()
 ini.read(os.getenv("BUILDMASTER_CONFIG", "./config.ini"))
@@ -26,7 +45,6 @@ c = BuildmasterConfig = {}
 # The 'workers' list defines the set of recognized buildslaves. Each element is
 # a Worker object, specifying a unique slave name and password.  The same
 # slave name and password must be configured on the slave.
-from buildbot.worker import Worker
 
 slave_port = 9990
 persistent = False
@@ -161,7 +179,6 @@ while True:
 feeds = []
 feedbranches = dict()
 
-from buildbot.changes.gitpoller import GitPoller
 c['change_source'] = []
 
 def parse_feed_entry(line):
@@ -190,20 +207,12 @@ with open(work_dir+'/source.git/feeds.conf.default', 'r') as f:
 # Configure the Schedulers, which decide how to react to incoming changes.  In this
 # case, just kick off a 'basebuild' build
 
-def branch_change_filter(change):
-       return change.branch == feedbranches[change.repository]
-
-from buildbot.schedulers.basic import SingleBranchScheduler
-from buildbot.schedulers.forcesched import ForceScheduler
-from buildbot.plugins import schedulers
-from buildbot.plugins import util
-from buildbot.plugins import steps
-from buildbot.changes import filter
-
 c['schedulers'] = []
 c['schedulers'].append(SingleBranchScheduler(
        name            = "all",
-       change_filter   = filter.ChangeFilter(filter_fn=branch_change_filter),
+       change_filter   = filter.ChangeFilter(
+               filter_fn = lambda change: change.branch == feedbranches[change.repository]
+       ),
        treeStableTimer = 60,
        builderNames    = archnames))
 
@@ -255,18 +264,6 @@ c['schedulers'].append(ForceScheduler(
 # what steps, and which workers can execute them.  Note that any particular build will
 # only take place on one slave.
 
-from buildbot.process.factory import BuildFactory
-from buildbot.steps.shell import ShellCommand
-from buildbot.steps.shell import SetProperty
-from buildbot.steps.transfer import FileUpload
-from buildbot.steps.transfer import FileDownload
-from buildbot.steps.transfer import StringDownload
-from buildbot.steps.master import MasterShellCommand
-from buildbot.process.properties import WithProperties
-from buildbot.process.properties import Property
-from buildbot.config import BuilderConfig
-
-
 def GetDirectorySuffix(props):
        verpat = re.compile(r'^([0-9]{2})\.([0-9]{2})(?:\.([0-9]+)(?:-rc([0-9]+))?|-(SNAPSHOT))$')
        if props.hasProperty("release_version"):
@@ -687,8 +684,6 @@ for arch in arches:
 # pushed to these arches. buildbot/status/*.py has a variety to choose from,
 # including web pages, email senders, and IRC bots.
 
-from buildbot.plugins import util
-
 if ini.has_option("phase2", "status_bind"):
        c['www'] = {
                'port': ini.get("phase2", "status_bind"),