def test_module_reload(self): Worker = type("Worker", (object,), {}) buildbot_module = new.module('buildbot_module') buildbot_module.Worker = Worker with mock.patch.dict(sys.modules, {'buildbot_module': buildbot_module}): scope = buildbot_module.__dict__ deprecatedWorkerModuleAttribute(scope, Worker) # Overwrite with Twisted's module wrapper. import buildbot_module # Module reload is effectively re-run of module contents. Worker = type("Worker", (object,), {}) buildbot_module.Worker = Worker scope = buildbot_module.__dict__ deprecatedWorkerModuleAttribute(scope, Worker) # Overwrite with Twisted's module wrapper. import buildbot_module with assertNotProducesWarnings(DeprecatedWorkerAPIWarning): W = buildbot_module.Worker self.assertIdentical(W, Worker) with assertProducesWarning( DeprecatedWorkerNameWarning, message_pattern=r"buildbot_module\.Slave was deprecated in " r"Buildbot 0.9.0: Use Worker instead."): S = buildbot_module.Slave self.assertIdentical(S, Worker)
def test_explicit_new_name(self): BuildSlave = type("BuildSlave", (object,), {}) buildbot_module = new.module('buildbot_module') buildbot_module.BuildSlave = BuildSlave with mock.patch.dict(sys.modules, {'buildbot_module': buildbot_module}): scope = buildbot_module.__dict__ deprecatedWorkerModuleAttribute( scope, BuildSlave, compat_name="BuildSlave", new_name="Worker") # Overwrite with Twisted's module wrapper. import buildbot_module with assertProducesWarning( DeprecatedWorkerNameWarning, message_pattern=r"buildbot_module\.BuildSlave was deprecated in " r"Buildbot 0.9.0: Use Worker instead."): S = buildbot_module.BuildSlave self.assertIdentical(S, BuildSlave)
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from __future__ import absolute_import from __future__ import print_function from buildbot.process.workerforbuilder import AbstractWorkerForBuilder as _AbstractWorkerForBuilder from buildbot.process.workerforbuilder import LatentWorkerForBuilder as _LatentWorkerForBuilder from buildbot.process.workerforbuilder import WorkerForBuilder as _WorkerForBuilder from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.process.workerforbuilder' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), _AbstractWorkerForBuilder, compat_name="AbstractSlaveBuilder", new_name="AbstractWorkerForBuilder") deprecatedWorkerModuleAttribute(locals(), _WorkerForBuilder, compat_name="SlaveBuilder", new_name="WorkerForBuilder") deprecatedWorkerModuleAttribute(locals(), _LatentWorkerForBuilder, compat_name="LatentSlaveBuilder", new_name="LatentWorkerForBuilder")
from buildbot.util import epoch2datetime from buildbot.worker_transition import WorkerAPICompatMixin from buildbot.worker_transition import deprecatedWorkerClassMethod from buildbot.worker_transition import deprecatedWorkerModuleAttribute def enforceChosenWorker(bldr, workerforbuilder, breq): if 'workername' in breq.properties: workername = breq.properties['workername'] if isinstance(workername, string_types): return workername == workerforbuilder.worker.workername return True deprecatedWorkerModuleAttribute(locals(), enforceChosenWorker) class Builder(util_service.ReconfigurableServiceMixin, service.MultiService, WorkerAPICompatMixin): # reconfigure builders before workers reconfig_priority = 196 @property def expectations(self): warnings.warn("'Builder.expectations' is deprecated.") return None def __init__(self, name):
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker.libvirt import LibVirtWorker as _LibVirtWorker from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.worker.libvirt' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), _LibVirtWorker, compat_name="LibVirtSlave", new_name="LibVirtWorker")
# License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.steps.worker' module instead".format(old=__name__)) # pylint: disable=unused-import # pylint: disable=wildcard-import # pylint: disable=unused-wildcard-import from buildbot.steps.worker import * # noqa deprecatedWorkerModuleAttribute(locals(), WorkerBuildStep) del WorkerBuildStep # noqa
owner count, to allow some workers more parallelism than others. """ compare_attrs = ('name', 'maxCount', '_maxCountForWorkerList') lockClass = RealWorkerLock def __init__(self, name, maxCount=1, maxCountForWorker=None, # deprecated, use `maxCountForWorker` instead maxCountForSlave=None ): # Deprecated API support. if maxCountForSlave is not None: reportDeprecatedWorkerNameUsage( "'maxCountForSlave' keyword argument is deprecated, " "use 'maxCountForWorker' instead") assert maxCountForWorker is None maxCountForWorker = maxCountForSlave self.name = name self.maxCount = maxCount if maxCountForWorker is None: maxCountForWorker = {} self.maxCountForWorker = maxCountForWorker self._registerOldWorkerAttr("maxCountForWorker") # for comparison purposes, turn this dictionary into a stably-sorted # list of tuples self._maxCountForWorkerList = tuple( sorted(self.maxCountForWorker.items())) deprecatedWorkerModuleAttribute(locals(), WorkerLock)
# no preference, so dont set a parameter at all return ChoiceStringParameter.updateFromKwargs(self, kwargs=kwargs, **unused) def getChoices(self, master, scheduler, buildername): if buildername is None: # this is the "Force All Builds" page workernames = master.status.getWorkerNames() else: builderStatus = master.status.getBuilder(buildername) workernames = [worker.getName() for worker in builderStatus.getWorkers()] workernames.sort() workernames.insert(0, self.anySentinel) return workernames deprecatedWorkerModuleAttribute(locals(), WorkerChoiceParameter, compat_name="BuildslaveChoiceParameter") class NestedParameter(BaseParameter): """A 'parent' parameter for a set of related parameters. This provides a logical grouping for the child parameters. Typically, the 'fullName' of the child parameters mix in the parent's 'fullName'. This allows for a field to appear multiple times in a form (for example, two codebases each have a 'branch' field). If the 'name' of the parent is the empty string, then the parent's name does not mix in with the child 'fullName'. This is useful when a field will not appear multiple time in a scheduler but the logical grouping is helpful.
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.worker.ec2' module instead".format(old=__name__)) from buildbot.worker.ec2 import EC2LatentWorker as _EC2LatentWorker deprecatedWorkerModuleAttribute(locals(), _EC2LatentWorker, compat_name="EC2LatentBuildSlave")
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.db.workers import WorkersConnectorComponent as _WorkersConnectorComponent from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.db.worker' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), _WorkersConnectorComponent, compat_name="BuildslavesConnectorComponent", new_name="WorkersConnectorComponent")
from zope.interface import Attribute from zope.interface import Interface from buildbot.worker_transition import deprecatedWorkerModuleAttribute # exceptions that can be raised while trying to start a build # This class is deprecated and should no longer be used. class NoSlaveError(Exception): pass deprecatedWorkerModuleAttribute(locals(), NoSlaveError, compat_name="NoSlaveError", new_name="") class BuilderInUseError(Exception): pass class WorkerTooOldError(Exception): pass deprecatedWorkerModuleAttribute(locals(), WorkerTooOldError, compat_name="BuildSlaveTooOldError")
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.worker.openstack' module instead".format(old=__name__)) from buildbot.worker.openstack import OpenStackLatentWorker as _OpenStackLatentWorker deprecatedWorkerModuleAttribute(locals(), _OpenStackLatentWorker, compat_name="OpenStackLatentBuildSlave", new_name="OpenStackLatentWorker")
# this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.worker' module instead".format(old=__name__)) from buildbot.worker import AbstractLatentWorker as _AbstractLatentWorker from buildbot.worker import AbstractWorker as _AbstractWorker from buildbot.worker import Worker as _Worker deprecatedWorkerModuleAttribute(locals(), _AbstractWorker, compat_name="AbstractBuildSlave", new_name="AbstractWorker") deprecatedWorkerModuleAttribute(locals(), _Worker, compat_name="BuildSlave", new_name="Worker") deprecatedWorkerModuleAttribute(locals(), _AbstractLatentWorker, compat_name="AbstractLatentBuildSlave", new_name="AbstractLatentWorker")
# redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.db.worker' module instead".format(old=__name__)) from buildbot.db.workers import WorkersConnectorComponent as _WorkersConnectorComponent deprecatedWorkerModuleAttribute(locals(), _WorkersConnectorComponent, compat_name="BuildslavesConnectorComponent", new_name="WorkersConnectorComponent")
from buildbot.util import epoch2datetime from buildbot.worker_transition import WorkerAPICompatMixin from buildbot.worker_transition import deprecatedWorkerClassMethod from buildbot.worker_transition import deprecatedWorkerModuleAttribute def enforceChosenWorker(bldr, workerforbuilder, breq): if 'workername' in breq.properties: workername = breq.properties['workername'] if isinstance(workername, string_types): return workername == workerforbuilder.worker.workername return True deprecatedWorkerModuleAttribute(locals(), enforceChosenWorker) class Builder(util_service.ReconfigurableServiceMixin, service.MultiService, WorkerAPICompatMixin): # reconfigure builders before workers reconfig_priority = 196 @property def expectations(self): warnings.warn("'Builder.expectations' is deprecated.") return None def __init__(self, name): service.MultiService.__init__(self)
# pylint: disable=no-method-argument from zope.interface import Attribute from zope.interface import Interface from buildbot.worker_transition import deprecatedWorkerModuleAttribute # exceptions that can be raised while trying to start a build # This class is deprecated and should no longer be used. class NoSlaveError(Exception): pass deprecatedWorkerModuleAttribute(locals(), NoSlaveError, compat_name="NoSlaveError", new_name="") class BuilderInUseError(Exception): pass class WorkerTooOldError(Exception): pass deprecatedWorkerModuleAttribute( locals(), WorkerTooOldError, compat_name="BuildSlaveTooOldError") class LatentWorkerFailedToSubstantiate(Exception): pass
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker.openstack import OpenStackLatentWorker as _OpenStackLatentWorker from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.worker.openstack' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), _OpenStackLatentWorker, compat_name="OpenStackLatentBuildSlave", new_name="OpenStackLatentWorker")
# Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from __future__ import absolute_import from __future__ import print_function from buildbot.process.workerforbuilder import AbstractWorkerForBuilder as _AbstractWorkerForBuilder from buildbot.process.workerforbuilder import LatentWorkerForBuilder as _LatentWorkerForBuilder from buildbot.process.workerforbuilder import WorkerForBuilder as _WorkerForBuilder from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.process.workerforbuilder' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), _AbstractWorkerForBuilder, compat_name="AbstractSlaveBuilder", new_name="AbstractWorkerForBuilder") deprecatedWorkerModuleAttribute(locals(), _WorkerForBuilder, compat_name="SlaveBuilder", new_name="WorkerForBuilder") deprecatedWorkerModuleAttribute(locals(), _LatentWorkerForBuilder, compat_name="LatentSlaveBuilder", new_name="LatentWorkerForBuilder")
from __future__ import absolute_import from __future__ import print_function from buildbot.steps.worker import CompositeStepMixin from buildbot.steps.worker import CopyDirectory from buildbot.steps.worker import FileExists from buildbot.steps.worker import MakeDirectory from buildbot.steps.worker import RemoveDirectory from buildbot.steps.worker import SetPropertiesFromEnv from buildbot.steps.worker import WorkerBuildStep # pylint: disable=unused-import from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage __all__ = [ 'CompositeStepMixin', 'CopyDirectory', 'FileExists', 'MakeDirectory', 'RemoveDirectory', 'SetPropertiesFromEnv', ] reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.steps.worker' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), WorkerBuildStep) del WorkerBuildStep # noqa
""" compare_attrs = ('name', 'maxCount', '_maxCountForWorkerList') lockClass = RealWorkerLock def __init__(self, name, maxCount=1, maxCountForWorker=None, # deprecated, use `maxCountForWorker` instead maxCountForSlave=None ): # Deprecated API support. if maxCountForSlave is not None: reportDeprecatedWorkerNameUsage( "'maxCountForSlave' keyword argument is deprecated, " "use 'maxCountForWorker' instead") assert maxCountForWorker is None maxCountForWorker = maxCountForSlave self.name = name self.maxCount = maxCount if maxCountForWorker is None: maxCountForWorker = {} self.maxCountForWorker = maxCountForWorker self._registerOldWorkerAttr("maxCountForWorker") # for comparison purposes, turn this dictionary into a stably-sorted # list of tuples self._maxCountForWorkerList = tuple( sorted(self.maxCountForWorker.items())) deprecatedWorkerModuleAttribute(locals(), WorkerLock)
# License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from __future__ import absolute_import from __future__ import print_function from buildbot.worker.ec2 import EC2LatentWorker as _EC2LatentWorker from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.worker.ec2' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), _EC2LatentWorker, compat_name="EC2LatentBuildSlave")
# # Copyright Buildbot Team Members # This module is left for backward compatibility of old-named worker API. # It should never be imported by Buildbot. from buildbot.worker import AbstractLatentWorker as _AbstractLatentWorker from buildbot.worker import AbstractWorker as _AbstractWorker from buildbot.worker import Worker as _Worker from buildbot.worker_transition import deprecatedWorkerModuleAttribute from buildbot.worker_transition import reportDeprecatedWorkerModuleUsage reportDeprecatedWorkerModuleUsage( "'{old}' module is deprecated, use " "'buildbot.worker' module instead".format(old=__name__)) deprecatedWorkerModuleAttribute(locals(), _AbstractWorker, compat_name="AbstractBuildSlave", new_name="AbstractWorker") deprecatedWorkerModuleAttribute(locals(), _Worker, compat_name="BuildSlave", new_name="Worker") deprecatedWorkerModuleAttribute(locals(), _AbstractLatentWorker, compat_name="AbstractLatentBuildSlave", new_name="AbstractLatentWorker")