tiramisu/doc/getting-started.txt

82 lines
2.6 KiB
Plaintext
Raw Normal View History

==================================
2013-05-17 12:11:14 +02:00
Getting started
==================================
2013-08-23 11:16:26 +02:00
What is options handling ?
2012-11-20 17:14:58 +01:00
=================================
2013-08-29 11:48:34 +02:00
Due to more and more available options required to set up an operating system,
compiler options or whatever, 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 control was
2013-08-23 11:16:26 +02:00
introduced...
What is Tiramisu ?
2012-11-20 17:14:58 +01:00
===================
2013-09-05 16:56:02 +02:00
Tiramisu is an options handler and an options controller, which aims at
2013-08-23 11:42:22 +02:00
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-29 11:48:34 +02:00
validations towards the whole options. Furthermore, options can be reached and
changed according to the access rules from nearly everywhere in your appliance.
2012-11-20 17:14:58 +01:00
Just the facts
==============
2012-11-20 17:14:58 +01:00
.. _gettingtiramisu:
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-08-29 11:48:34 +02:00
We suggest using `git` if one wants to access to the current developments.
::
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
named ``tiramisu``.
Getting started
-------------------
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:
::
>>> from tiramisu.config import Config
>>> from tiramisu.option import OptionDescription, BoolOption
2013-08-29 11:48:34 +02:00
>>> # let's create a group of options... with only one option inside
>>> descr = OptionDescription("optgroup", "", [
... BoolOption("bool", "", default=False)])
2013-08-29 11:48:34 +02:00
>>> # c is a namespace as well as a container for the options
2013-08-23 11:42:22 +02:00
>>> c = Config(descr)
>>> c.bool
False
2013-08-23 11:42:22 +02:00
>>> c.bool = True
>>> c.bool
True
2013-08-29 11:48:34 +02:00
So by now, we have:
2013-08-23 11:42:22 +02:00
- a namespace (which is `c` here)
- the access of an option's value by the
2013-09-05 16:56:02 +02:00
attribute access way (here `bool`, which is a boolean option
2013-08-23 11:42:22 +02:00
:class:`~tiramisu.option.BoolOption()`.
2013-08-29 11:48:34 +02:00
So, option objects are produced at the entry point `c` and then handed down to
where they are actually used when `c.bool` is triggered. This keeps options
local but available at any timer and consistent.
2013-08-23 11:42:22 +02:00
2013-08-29 11:48:34 +02:00
Once the namespace is created, we can set a
:meth:`~config.CommonConfig.read_write()` access to the options::
2013-08-23 11:42:22 +02:00
>>> c.read_write()
2013-08-29 11:48:34 +02:00
which enables us to set a bunch of access rules that we wil explain later in
:doc:`status`.