40 lines
1.7 KiB
Python
40 lines
1.7 KiB
Python
# Copyright (C) 2012 Team tiramisu (see AUTHORS for all contributors)
|
|
#
|
|
# This program 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; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
# The original `Config` design model is unproudly borrowed from
|
|
# the rough gus of pypy: pypy: http://codespeak.net/svn/pypy/dist/pypy/config/
|
|
# the whole pypy projet is under MIT licence
|
|
from tiramisu.config import Config
|
|
from tiramisu.option import (OptionDescription, Option, ChoiceOption, BoolOption,
|
|
FloatOption, StrOption, IntOption, IPOption, NetmaskOption,
|
|
apply_requires)
|
|
|
|
# extendable type
|
|
class extend(type):
|
|
"""
|
|
A magic trick for classes, which lets you add methods or attributes to a
|
|
class
|
|
"""
|
|
def extend(cls, extclass):
|
|
bases = list(extclass.__bases__)
|
|
bases.append(extclass)
|
|
for cl in bases:
|
|
for key, value in cl.__dict__.items():
|
|
if key == '__module__':
|
|
continue
|
|
setattr(cls, key, value)
|
|
|
|
# ____________________________________________________________
|