Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (37 sloc) 1.48 KB
# Copyright 2008 Google Inc. All Rights Reserved.
If you need to change the default behavior of some atest commands, you
can create a site_<topic>.py file to subclass some of the classes from
The following example would prevent the creation of platform labels.
import inspect, new, sys
from autotest_lib.cli import topic_common, label
class site_label(label.label):
class site_label_create(label.label_create):
"""Disable the platform option
atest label create <labels>|--blist <file>"""
def __init__(self):
super(site_label_create, self).__init__()
def parse(self):
(options, leftover) = super(site_label_create, self).parse()
self.is_platform = False
return (options, leftover)
# The following boiler plate code should be added at the end to create
# all the other site_<topic>_<action> classes that do not modify their
# <topic>_<action> super class.
# Any classes we don't override in label should be copied automatically
for cls in [getattr(label, n) for n in dir(label) if not n.startswith("_")]:
if not inspect.isclass(cls):
cls_name = cls.__name__
site_cls_name = 'site_' + cls_name
if hasattr(sys.modules[__name__], site_cls_name):
bases = (site_label, cls)
members = {'__doc__': cls.__doc__}
site_cls = new.classobj(site_cls_name, bases, members)
setattr(sys.modules[__name__], site_cls_name, site_cls)
Jump to Line
Something went wrong with that request. Please try again.