[buildbot] phase1, phase2: sort and move imports to the top of the file

LEDE Commits lede-commits at lists.infradead.org
Thu Jul 30 06:14:25 EDT 2020


jow pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/0e70afb6b28a2d9e4e0d463ee7e2bc28957e1c90

commit 0e70afb6b28a2d9e4e0d463ee7e2bc28957e1c90
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Mon Feb 3 16:57:12 2020 +0100

    phase1, phase2: sort and move imports to the top of the file
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 phase1/master.cfg | 53 ++++++++++++++++++++++++-----------------------------
 phase2/master.cfg | 49 ++++++++++++++++++++++---------------------------
 2 files changed, 46 insertions(+), 56 deletions(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index 83d9e8b..3e06733 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -8,6 +8,30 @@ 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 reporters
+from buildbot.plugins import schedulers
+from buildbot.plugins import steps
+from buildbot.plugins import util
+from buildbot.process import properties
+from buildbot.process.factory import BuildFactory
+from buildbot.process.properties import Interpolate
+from buildbot.process.properties import Property
+from buildbot.schedulers.basic import SingleBranchScheduler
+from buildbot.schedulers.forcesched import BaseParameter
+from buildbot.schedulers.forcesched import ForceScheduler
+from buildbot.schedulers.forcesched import ValidationError
+from buildbot.steps.master import MasterShellCommand
+from buildbot.steps.shell import SetPropertyFromCommand
+from buildbot.steps.shell import ShellCommand
+from buildbot.steps.source.git import Git
+from buildbot.steps.transfer import FileDownload
+from buildbot.steps.transfer import FileUpload
+from buildbot.steps.transfer import StringDownload
+from buildbot.worker import Worker
+
 
 # This is a sample buildmaster config file. It must be installed as
 # 'master.cfg' in your buildmaster's base directory.
@@ -41,7 +65,6 @@ c['buildbotURL'] = ini.get("phase1", "buildbot_url")
 # 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 = 9989
 
@@ -191,7 +214,6 @@ while True:
 # the 'change_source' setting tells the buildmaster how it should find out
 # about source code changes.  Here we point to the buildbot clone of pyflakes.
 
-from buildbot.changes.gitpoller import GitPoller
 c['change_source'] = []
 c['change_source'].append(GitPoller(
 	repo_url,
@@ -203,14 +225,6 @@ c['change_source'].append(GitPoller(
 # Configure the Schedulers, which decide how to react to incoming changes.  In this
 # case, just kick off a 'basebuild' build
 
-from buildbot.schedulers.basic import SingleBranchScheduler
-from buildbot.schedulers.forcesched import ForceScheduler
-from buildbot.schedulers.forcesched import BaseParameter
-from buildbot.schedulers.forcesched import ValidationError
-from buildbot.plugins import schedulers
-from buildbot.plugins import util
-from buildbot.changes import filter
-
 class TagChoiceParameter(BaseParameter):
 	spec_attributes = ["strict", "choices"]
 	type = "list"
@@ -313,21 +327,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.source.git import Git
-from buildbot.steps.shell import ShellCommand
-from buildbot.steps.shell import SetPropertyFromCommand
-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.plugins import steps
-from buildbot.process.properties import Interpolate
-from buildbot.process.properties import Property
-from buildbot.process import properties
-from buildbot.config import BuilderConfig
-
-
 CleanTargetMap = [
 	[ "tools",	"tools/clean"			],
 	[ "chain",	"toolchain/clean"		],
@@ -1308,8 +1307,6 @@ for target in targets:
 # pushed to these targets. 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("phase1", "status_bind"):
 	c['www'] = {
 		'port': ini.get("phase1", "status_bind"),
@@ -1330,8 +1327,6 @@ if ini.has_option("phase1", "status_bind"):
 		)
 
 
-from buildbot.plugins import reporters
-
 if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.has_option("irc", "channel"):
 	irc_host = ini.get("irc", "host")
 	irc_port = 6667
diff --git a/phase2/master.cfg b/phase2/master.cfg
index d3a7614..dd4db32 100644
--- a/phase2/master.cfg
+++ b/phase2/master.cfg
@@ -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"),



More information about the lede-commits mailing list