76 lines
2.3 KiB
Text
76 lines
2.3 KiB
Text
==================================
|
||
Getting started
|
||
==================================
|
||
|
||
What is options handling ?
|
||
=================================
|
||
|
||
Due to more and more available options required to set up an operating system,
|
||
to set up compiler options, vs... it became quite annoying to hand the
|
||
necessary options to where they are actually used and even more annoying to add
|
||
new options. To circumvent these problems the configuration management was
|
||
introduced...
|
||
|
||
What is Tiramisu ?
|
||
===================
|
||
|
||
Tiramisu is an options handler and an options controller, wich aims at
|
||
producing flexible and fast options access. The main advantages are its access
|
||
rules and the fact that the whole consistency is preserved at any time, see
|
||
:doc:`consistency`. There is of course type and structure validations, but also
|
||
validations towards the whole options.
|
||
|
||
Last but not least, options can be reached and changed according to the access
|
||
rules from nearly everywhere in your appliance.
|
||
|
||
Just the facts
|
||
==============
|
||
|
||
.. _gettingtiramisu:
|
||
|
||
Download
|
||
---------
|
||
|
||
To obtain a copy of the sources, check it out from the repository using `git`.
|
||
We suggest using `git` if one wants to access the current developments.
|
||
|
||
::
|
||
|
||
git clone git://git.labs.libre-entreprise.org/tiramisu.git
|
||
|
||
This will get you a fresh checkout of the code repository in a local directory
|
||
named ``tiramisu``.
|
||
|
||
Getting started
|
||
-------------------
|
||
|
||
Option objects can be created in different ways. Let's perform very basic
|
||
:class:`~tiramisu.option.Option` and :class:`~tiramisu.config.Config` object
|
||
manipulations:
|
||
|
||
::
|
||
|
||
>>> from tiramisu.config import Config
|
||
>>> from tiramisu.option import OptionDescription, BoolOption
|
||
>>> descr = OptionDescription("optgroup", "", [
|
||
... BoolOption("bool", "", default=False)])
|
||
>>>
|
||
>>> config = Config(descr)
|
||
>>> # now we have a config, wich contains an option:
|
||
>>> config.bool
|
||
False
|
||
>>> config.bool = True
|
||
>>> config.bool
|
||
True
|
||
|
||
|
||
So by now, we have
|
||
|
||
- a namespace (which is `config` here)
|
||
- the access of an option's value by the
|
||
attribute access way (here `bool`, wich is a boolean option:
|
||
:class:`tiramisu.option.BoolOption()`.
|
||
|
||
So, option objects are produced at the entry point and then handed down to
|
||
where they are actually used. This keeps options local but available everywhere
|
||
and consistent.
|