2012-07-13 09:40:48 +02:00
|
|
|
|
==================================
|
2013-05-17 12:11:14 +02:00
|
|
|
|
Getting started
|
2012-07-13 09:40:48 +02:00
|
|
|
|
==================================
|
|
|
|
|
|
2013-08-23 11:16:26 +02:00
|
|
|
|
What is options handling ?
|
2012-11-20 17:14:58 +01:00
|
|
|
|
=================================
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
Due to more and more available options required to set up an operating system,
|
2013-08-28 09:22:44 +02:00
|
|
|
|
to set up compiler options, and so on. it became quite annoying to hand the
|
2013-08-23 11:42:22 +02:00
|
|
|
|
necessary options to where they are actually used and even more annoying to add
|
|
|
|
|
new options. To circumvent these problems the configuration management was
|
2013-08-23 11:16:26 +02:00
|
|
|
|
introduced...
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
|
|
|
|
What is Tiramisu ?
|
2012-11-20 17:14:58 +01:00
|
|
|
|
===================
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
Tiramisu is an options handler and an options controller, wich aims at
|
|
|
|
|
producing flexible and fast options access. The main advantages are its access
|
2013-08-23 11:16:26 +02:00
|
|
|
|
rules and the fact that the whole consistency is preserved at any time, see
|
2013-08-23 11:42:22 +02:00
|
|
|
|
:doc:`consistency`. There is of course type and structure validations, but also
|
2013-08-23 11:16:26 +02:00
|
|
|
|
validations towards the whole options.
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
Last but not least, options can be reached and changed according to the access
|
2013-08-23 11:16:26 +02:00
|
|
|
|
rules from nearly everywhere in your appliance.
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2012-11-20 17:14:58 +01:00
|
|
|
|
Just the facts
|
|
|
|
|
==============
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2012-11-20 17:14:58 +01:00
|
|
|
|
.. _gettingtiramisu:
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
|
|
|
|
Download
|
|
|
|
|
---------
|
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
To obtain a copy of the sources, check it out from the repository using `git`.
|
2013-05-15 17:35:49 +02:00
|
|
|
|
We suggest using `git` if one wants to access the current developments.
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
git clone git://git.labs.libre-entreprise.org/tiramisu.git
|
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
This will get you a fresh checkout of the code repository in a local directory
|
2013-05-15 17:35:49 +02:00
|
|
|
|
named ``tiramisu``.
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2013-05-15 17:35:49 +02:00
|
|
|
|
Getting started
|
|
|
|
|
-------------------
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
Option objects can be created in different ways. Let's perform very basic
|
|
|
|
|
:class:`~tiramisu.option.Option` and :class:`~tiramisu.config.Config` object
|
2013-08-23 11:16:26 +02:00
|
|
|
|
manipulations:
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2013-05-15 17:35:49 +02:00
|
|
|
|
::
|
2012-07-13 09:40:48 +02:00
|
|
|
|
|
2013-05-15 17:35:49 +02:00
|
|
|
|
>>> from tiramisu.config import Config
|
|
|
|
|
>>> from tiramisu.option import OptionDescription, BoolOption
|
|
|
|
|
>>> descr = OptionDescription("optgroup", "", [
|
|
|
|
|
... BoolOption("bool", "", default=False)])
|
|
|
|
|
>>>
|
2013-08-23 11:42:22 +02:00
|
|
|
|
>>> c = Config(descr)
|
|
|
|
|
>>> # now we have a container, wich contains an option:
|
|
|
|
|
>>> c.bool
|
2013-05-15 17:35:49 +02:00
|
|
|
|
False
|
2013-08-23 11:42:22 +02:00
|
|
|
|
>>> c.bool = True
|
|
|
|
|
>>> c.bool
|
2013-05-15 17:35:49 +02:00
|
|
|
|
True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
So by now, we have
|
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
- a namespace (which is `c` here)
|
2013-05-15 17:35:49 +02:00
|
|
|
|
- the access of an option's value by the
|
|
|
|
|
attribute access way (here `bool`, wich is a boolean option:
|
2013-08-23 11:42:22 +02:00
|
|
|
|
:class:`~tiramisu.option.BoolOption()`.
|
2013-05-15 17:35:49 +02:00
|
|
|
|
|
2013-08-23 11:42:22 +02:00
|
|
|
|
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
|
2013-08-23 11:16:26 +02:00
|
|
|
|
and consistent.
|
2013-08-23 11:42:22 +02:00
|
|
|
|
|
|
|
|
|
The namespace is created, we can set a `read_write` access to the options::
|
|
|
|
|
|
|
|
|
|
>>> c.read_write()
|