everything in src for packaging purposes
This commit is contained in:
parent
ddef37ed2a
commit
5e8c2d2ef0
18
src/README
18
src/README
@ -1,18 +0,0 @@
|
||||
--------
|
||||
LICENSES
|
||||
--------
|
||||
|
||||
Tiramisu is under the terms of the GNU General Public License v3.0 as
|
||||
published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
See gpl-3.0.txt for more informations.
|
||||
|
||||
Contributors:
|
||||
|
||||
Gwenaël Rémond <gremond@cadoles.com> lead developer
|
||||
Emmanuel Garette <egarette@cadoles.com> contributor
|
||||
|
||||
|
||||
|
||||
|
674
src/gpl-3.0.txt
674
src/gpl-3.0.txt
@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
@ -1,15 +0,0 @@
|
||||
.SUFFIXES:
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: html
|
||||
|
||||
generate:
|
||||
python ./generate.py
|
||||
|
||||
html: generate
|
||||
make -C ./build all
|
||||
|
||||
clean:
|
||||
make -C ./build clean
|
||||
|
@ -1,18 +0,0 @@
|
||||
SRC=$(wildcard *.txt)
|
||||
HTMLFRAGMENT=$(addsuffix .html, $(basename $(SRC)))
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: html
|
||||
|
||||
html: $(HTMLFRAGMENT)
|
||||
|
||||
%.html: %.txt
|
||||
./rst2html.py --stylesheet ./style.css $< > $@
|
||||
|
||||
clean:
|
||||
rm -f *.html
|
||||
rm -f *.txt
|
||||
|
@ -1,540 +0,0 @@
|
||||
/*
|
||||
* basic.css
|
||||
* ~~~~~~~~~
|
||||
*
|
||||
* Sphinx stylesheet -- basic theme.
|
||||
*
|
||||
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/* -- main layout ----------------------------------------------------------- */
|
||||
|
||||
div.clearer {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* -- relbar ---------------------------------------------------------------- */
|
||||
|
||||
div.related {
|
||||
width: 100%;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
div.related h3 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.related ul {
|
||||
margin: 0;
|
||||
padding: 0 0 0 10px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
div.related li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.related li.right {
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
/* -- sidebar --------------------------------------------------------------- */
|
||||
|
||||
div.sphinxsidebarwrapper {
|
||||
padding: 10px 5px 0 10px;
|
||||
}
|
||||
|
||||
div.sphinxsidebar {
|
||||
float: left;
|
||||
width: 230px;
|
||||
margin-left: -100%;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul ul,
|
||||
div.sphinxsidebar ul.want-points {
|
||||
margin-left: 20px;
|
||||
list-style: square;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.sphinxsidebar form {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
div.sphinxsidebar input {
|
||||
border: 1px solid #98dbcc;
|
||||
font-family: sans-serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
div.sphinxsidebar input[type="text"] {
|
||||
width: 170px;
|
||||
}
|
||||
|
||||
div.sphinxsidebar input[type="submit"] {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/* -- search page ----------------------------------------------------------- */
|
||||
|
||||
ul.search {
|
||||
margin: 10px 0 0 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.search li {
|
||||
padding: 5px 0 5px 20px;
|
||||
background-image: url(file.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 7px;
|
||||
}
|
||||
|
||||
ul.search li a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul.search li div.context {
|
||||
color: #888;
|
||||
margin: 2px 0 0 30px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
ul.keywordmatches li.goodmatch a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* -- index page ------------------------------------------------------------ */
|
||||
|
||||
table.contentstable {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
table.contentstable p.biglink {
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
a.biglink {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
span.linkdescr {
|
||||
font-style: italic;
|
||||
padding-top: 5px;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
/* -- general index --------------------------------------------------------- */
|
||||
|
||||
table.indextable {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.indextable td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.indextable dl, table.indextable dd {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
table.indextable tr.pcap {
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
table.indextable tr.cap {
|
||||
margin-top: 10px;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
img.toggler {
|
||||
margin-right: 3px;
|
||||
margin-top: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.modindex-jumpbox {
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
margin: 1em 0 1em 0;
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
div.genindex-jumpbox {
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
margin: 1em 0 1em 0;
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
/* -- general body styles --------------------------------------------------- */
|
||||
|
||||
a.headerlink {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
h1:hover > a.headerlink,
|
||||
h2:hover > a.headerlink,
|
||||
h3:hover > a.headerlink,
|
||||
h4:hover > a.headerlink,
|
||||
h5:hover > a.headerlink,
|
||||
h6:hover > a.headerlink,
|
||||
dt:hover > a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
div.body p.caption {
|
||||
text-align: inherit;
|
||||
}
|
||||
|
||||
div.body td {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.field-list ul {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.first {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
p.rubric {
|
||||
margin-top: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left {
|
||||
clear: left;
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right {
|
||||
clear: right;
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.align-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* -- sidebars -------------------------------------------------------------- */
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em;
|
||||
border: 1px solid #ddb;
|
||||
padding: 7px 7px 0 7px;
|
||||
background-color: #ffe;
|
||||
width: 40%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
p.sidebar-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* -- topics ---------------------------------------------------------------- */
|
||||
|
||||
div.topic {
|
||||
border: 1px solid #ccc;
|
||||
padding: 7px 7px 0 7px;
|
||||
margin: 10px 0 10px 0;
|
||||
}
|
||||
|
||||
p.topic-title {
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* -- admonitions ----------------------------------------------------------- */
|
||||
|
||||
div.admonition {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
div.admonition dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.admonition dl {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
p.admonition-title {
|
||||
margin: 0px 10px 5px 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.body p.centered {
|
||||
text-align: center;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
/* -- tables ---------------------------------------------------------------- */
|
||||
|
||||
table.docutils {
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.docutils td, table.docutils th {
|
||||
padding: 1px 8px 1px 5px;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
|
||||
table.field-list td, table.field-list th {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
table.footnote td, table.footnote th {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
table.citation td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* -- other body styles ----------------------------------------------------- */
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha;
|
||||
}
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha;
|
||||
}
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman;
|
||||
}
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman;
|
||||
}
|
||||
|
||||
dl {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
dd p {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
dd ul, dd table {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 10px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
dt:target, .highlighted {
|
||||
background-color: #fbe54e;
|
||||
}
|
||||
|
||||
dl.glossary dt {
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.field-list ul {
|
||||
margin: 0;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.field-list p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.refcount {
|
||||
color: #060;
|
||||
}
|
||||
|
||||
.optional {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.versionmodified {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.system-message {
|
||||
background-color: #fda;
|
||||
padding: 5px;
|
||||
border: 3px solid red;
|
||||
}
|
||||
|
||||
.footnote:target {
|
||||
background-color: #ffa;
|
||||
}
|
||||
|
||||
.line-block {
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.line-block .line-block {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
|
||||
.guilabel, .menuselection {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.accelerator {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.classifier {
|
||||
font-style: oblique;
|
||||
}
|
||||
|
||||
abbr, acronym {
|
||||
border-bottom: dotted 1px;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
/* -- code displays --------------------------------------------------------- */
|
||||
|
||||
pre {
|
||||
overflow: auto;
|
||||
overflow-y: hidden; /* fixes display issues on Chrome browsers */
|
||||
}
|
||||
|
||||
td.linenos pre {
|
||||
padding: 5px 0px;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
table.highlighttable {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
table.highlighttable td {
|
||||
padding: 0 0.5em 0 0.5em;
|
||||
}
|
||||
|
||||
tt.descname {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
tt.descclassname {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
tt.xref, a tt {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.viewcode-link {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.viewcode-back {
|
||||
float: right;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
div.viewcode-block:target {
|
||||
margin: -1px -10px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
/* -- math display ---------------------------------------------------------- */
|
||||
|
||||
img.math {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.body div.math p {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
span.eqno {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* -- printout stylesheet --------------------------------------------------- */
|
||||
|
||||
@media print {
|
||||
div.document,
|
||||
div.documentwrapper,
|
||||
div.bodywrapper {
|
||||
margin: 0 !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.sphinxsidebar,
|
||||
div.related,
|
||||
div.footer,
|
||||
#top-link {
|
||||
display: none;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# unproudly borrowed from David Goodger's rst2html.py
|
||||
|
||||
""" A minimal front end to the Docutils Publisher, producing HTML with a
|
||||
`config` role
|
||||
"""
|
||||
|
||||
try:
|
||||
import locale
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
except:
|
||||
pass
|
||||
|
||||
from docutils.core import publish_cmdline, default_description
|
||||
# ____________________________________________________________
|
||||
from docutils import nodes, utils
|
||||
from docutils.parsers.rst import roles
|
||||
|
||||
# ____________________________________________________________
|
||||
#register a :config: ReST link role for use in documentation
|
||||
def config_reference_role(role, rawtext, text, lineno, inliner,
|
||||
options={}, content=[]):
|
||||
basename = text
|
||||
refuri = "report/build" + basename + '.html'
|
||||
roles.set_classes(options)
|
||||
node = nodes.reference(rawtext, utils.unescape(text), refuri=refuri,
|
||||
**options)
|
||||
return [node], []
|
||||
|
||||
roles.register_local_role('config', config_reference_role)
|
||||
# ____________________________________________________________
|
||||
|
||||
|
||||
description = ('Generates (X)HTML documents from standalone reStructuredText '
|
||||
'sources. ' + default_description)
|
||||
|
||||
publish_cmdline(writer_name='html', description=description)
|
||||
|
@ -1,795 +0,0 @@
|
||||
/*
|
||||
* rtd.css
|
||||
* ~~~~~~~~~~~~~~~
|
||||
*
|
||||
* Sphinx stylesheet -- sphinxdoc theme. Originally created by
|
||||
* Armin Ronacher for Werkzeug.
|
||||
*
|
||||
* Customized for ReadTheDocs by Eric Pierce & Eric Holscher
|
||||
*
|
||||
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/* RTD colors
|
||||
* light blue: #e8ecef
|
||||
* medium blue: #8ca1af
|
||||
* dark blue: #465158
|
||||
* dark grey: #444444
|
||||
*
|
||||
* white hover: #d1d9df;
|
||||
* medium blue hover: #697983;
|
||||
* green highlight: #8ecc4c
|
||||
* light blue (project bar): #e8ecef
|
||||
*/
|
||||
|
||||
@import url("basic.css");
|
||||
|
||||
/* PAGE LAYOUT -------------------------------------------------------------- */
|
||||
|
||||
body {
|
||||
font: 100%/1.5 "ff-meta-web-pro-1","ff-meta-web-pro-2",Arial,"Helvetica Neue",sans-serif;
|
||||
text-align: center;
|
||||
color: black;
|
||||
background-color: #465158;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.document {
|
||||
text-align: left;
|
||||
background-color: #e8ecef;
|
||||
}
|
||||
|
||||
div.bodywrapper {
|
||||
background-color: #ffffff;
|
||||
border-left: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin: 0 0 0 16em;
|
||||
}
|
||||
|
||||
div.body {
|
||||
margin: 0;
|
||||
padding: 0.5em 1.3em;
|
||||
min-width: 20em;
|
||||
}
|
||||
|
||||
div.related {
|
||||
font-size: 1em;
|
||||
background-color: #465158;
|
||||
}
|
||||
|
||||
div.documentwrapper {
|
||||
float: left;
|
||||
width: 100%;
|
||||
background-color: #e8ecef;
|
||||
}
|
||||
|
||||
|
||||
/* HEADINGS --------------------------------------------------------------- */
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
padding: 0.7em 0 0.3em 0;
|
||||
font-size: 1.5em;
|
||||
line-height: 1.15;
|
||||
color: #111;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 2em 0 0.2em 0;
|
||||
font-size: 1.35em;
|
||||
padding: 0;
|
||||
color: #465158;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 1em 0 -0.3em 0;
|
||||
font-size: 1.2em;
|
||||
color: #6c818f;
|
||||
}
|
||||
|
||||
div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
|
||||
color: black;
|
||||
}
|
||||
|
||||
h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
|
||||
display: none;
|
||||
margin: 0 0 0 0.3em;
|
||||
padding: 0 0.2em 0 0.2em;
|
||||
color: #aaa !important;
|
||||
}
|
||||
|
||||
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
|
||||
h5:hover a.anchor, h6:hover a.anchor {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
|
||||
h5 a.anchor:hover, h6 a.anchor:hover {
|
||||
color: #777;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
|
||||
/* LINKS ------------------------------------------------------------------ */
|
||||
|
||||
/* Normal links get a pseudo-underline */
|
||||
a {
|
||||
color: #444;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
/* Links in sidebar, TOC, index trees and tables have no underline */
|
||||
.sphinxsidebar a,
|
||||
.toctree-wrapper a,
|
||||
.indextable a,
|
||||
#indices-and-tables a {
|
||||
color: #444;
|
||||
text-decoration: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Most links get an underline-effect when hovered */
|
||||
a:hover,
|
||||
div.toctree-wrapper a:hover,
|
||||
.indextable a:hover,
|
||||
#indices-and-tables a:hover {
|
||||
color: #111;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
|
||||
/* Footer links */
|
||||
div.footer a {
|
||||
color: #86989B;
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
}
|
||||
div.footer a:hover {
|
||||
color: #a6b8bb;
|
||||
text-decoration: underline;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Permalink anchor (subtle grey with a red hover) */
|
||||
div.body a.headerlink {
|
||||
color: #ccc;
|
||||
font-size: 1em;
|
||||
margin-left: 6px;
|
||||
padding: 0 4px 0 4px;
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
}
|
||||
div.body a.headerlink:hover {
|
||||
color: #c60f0f;
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
||||
/* NAVIGATION BAR --------------------------------------------------------- */
|
||||
|
||||
div.related ul {
|
||||
height: 2.5em;
|
||||
}
|
||||
|
||||
div.related ul li {
|
||||
margin: 0;
|
||||
padding: 0.65em 0;
|
||||
float: left;
|
||||
display: block;
|
||||
color: white; /* For the >> separators */
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
div.related ul li.right {
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
color: transparent; /* Hide the | separators */
|
||||
}
|
||||
|
||||
/* "Breadcrumb" links in nav bar */
|
||||
div.related ul li a {
|
||||
order: none;
|
||||
background-color: inherit;
|
||||
font-weight: bold;
|
||||
margin: 6px 0 6px 4px;
|
||||
line-height: 1.75em;
|
||||
color: #ffffff;
|
||||
padding: 0.4em 0.8em;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
}
|
||||
/* previous / next / modules / index links look more like buttons */
|
||||
div.related ul li.right a {
|
||||
margin: 0.375em 0;
|
||||
background-color: #697983;
|
||||
text-shadow: 0 1px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
}
|
||||
/* All navbar links light up as buttons when hovered */
|
||||
div.related ul li a:hover {
|
||||
background-color: #8ca1af;
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
}
|
||||
/* Take extra precautions for tt within links */
|
||||
a tt,
|
||||
div.related ul li a tt {
|
||||
background: inherit !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
|
||||
/* SIDEBAR ---------------------------------------------------------------- */
|
||||
|
||||
div.sphinxsidebarwrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.sphinxsidebar {
|
||||
margin: 0;
|
||||
margin-left: -100%;
|
||||
float: left;
|
||||
top: 3em;
|
||||
left: 0;
|
||||
padding: 0 1em;
|
||||
width: 14em;
|
||||
font-size: 1em;
|
||||
text-align: left;
|
||||
background-color: #e8ecef;
|
||||
}
|
||||
|
||||
div.sphinxsidebar img {
|
||||
max-width: 12em;
|
||||
}
|
||||
|
||||
div.sphinxsidebar h3,
|
||||
div.sphinxsidebar h4,
|
||||
div.sphinxsidebar p.logo {
|
||||
margin: 1.2em 0 0.3em 0;
|
||||
font-size: 1em;
|
||||
padding: 0;
|
||||
color: #222222;
|
||||
font-family: "ff-meta-web-pro-1", "ff-meta-web-pro-2", "Arial", "Helvetica Neue", sans-serif;
|
||||
}
|
||||
|
||||
div.sphinxsidebar h3 a {
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul,
|
||||
div.sphinxsidebar p {
|
||||
margin-top: 0;
|
||||
padding-left: 0;
|
||||
line-height: 130%;
|
||||
background-color: #e8ecef;
|
||||
}
|
||||
|
||||
/* No bullets for nested lists, but a little extra indentation */
|
||||
div.sphinxsidebar ul ul {
|
||||
list-style-type: none;
|
||||
margin-left: 1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* A little top/bottom padding to prevent adjacent links' borders
|
||||
* from overlapping each other */
|
||||
div.sphinxsidebar ul li {
|
||||
padding: 1px 0;
|
||||
}
|
||||
|
||||
/* A little left-padding to make these align with the ULs */
|
||||
div.sphinxsidebar p.topless {
|
||||
padding-left: 0 0 0 1em;
|
||||
}
|
||||
|
||||
/* Make these into hidden one-liners */
|
||||
div.sphinxsidebar ul li,
|
||||
div.sphinxsidebar p.topless {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* ...which become visible when hovered */
|
||||
div.sphinxsidebar ul li:hover,
|
||||
div.sphinxsidebar p.topless:hover {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* Search text box and "Go" button */
|
||||
#searchbox {
|
||||
margin-top: 2em;
|
||||
margin-bottom: 1em;
|
||||
background: #ddd;
|
||||
padding: 0.5em;
|
||||
border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
}
|
||||
#searchbox h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* Make search box and button abut and have a border */
|
||||
input,
|
||||
div.sphinxsidebar input {
|
||||
border: 1px solid #999;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* Search textbox */
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
padding: 0 3px;
|
||||
height: 20px;
|
||||
width: 144px;
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
-moz-border-radius-topleft: 3px;
|
||||
-moz-border-radius-bottomleft: 3px;
|
||||
-webkit-border-top-left-radius: 3px;
|
||||
-webkit-border-bottom-left-radius: 3px;
|
||||
}
|
||||
/* Search button */
|
||||
input[type="submit"] {
|
||||
margin: 0 0 0 -1px; /* -1px prevents a double-border with textbox */
|
||||
height: 22px;
|
||||
color: #444;
|
||||
background-color: #e8ecef;
|
||||
padding: 1px 4px;
|
||||
font-weight: bold;
|
||||
border-top-right-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
-moz-border-radius-topright: 3px;
|
||||
-moz-border-radius-bottomright: 3px;
|
||||
-webkit-border-top-right-radius: 3px;
|
||||
-webkit-border-bottom-right-radius: 3px;
|
||||
}
|
||||
input[type="submit"]:hover {
|
||||
color: #ffffff;
|
||||
background-color: #8ecc4c;
|
||||
}
|
||||
|
||||
div.sphinxsidebar p.searchtip {
|
||||
clear: both;
|
||||
padding: 0.5em 0 0 0;
|
||||
background: #ddd;
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
/* Sidebar links are unusual */
|
||||
div.sphinxsidebar li a,
|
||||
div.sphinxsidebar p a {
|
||||
background: #e8ecef; /* In case links overlap main content */
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border: 1px solid transparent; /* To prevent things jumping around on hover */
|
||||
padding: 0 5px 0 5px;
|
||||
}
|
||||
div.sphinxsidebar li a:hover,
|
||||
div.sphinxsidebar p a:hover {
|
||||
color: #111;
|
||||
text-decoration: none;
|
||||
border: 1px solid #888;
|
||||
}
|
||||
div.sphinxsidebar p.logo a {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/* Tweak any link appearing in a heading */
|
||||
div.sphinxsidebar h3 a {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* OTHER STUFF ------------------------------------------------------------ */
|
||||
|
||||
cite, code, tt {
|
||||
font-family: 'Consolas', 'Deja Vu Sans Mono',
|
||||
'Bitstream Vera Sans Mono', monospace;
|
||||
font-size: 0.95em;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
tt {
|
||||
background-color: #f2f2f2;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
tt.descname, tt.descclassname, tt.xref {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 1px solid #abc;
|
||||
margin: 2em;
|
||||
}
|
||||
|
||||
|
||||
pre, #_fontwidthtest {
|
||||
font-family: 'Consolas', 'Deja Vu Sans Mono',
|
||||
'Bitstream Vera Sans Mono', monospace;
|
||||
margin: 1em 2em;
|
||||
font-size: 0.95em;
|
||||
letter-spacing: 0.015em;
|
||||
line-height: 120%;
|
||||
padding: 0.5em;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #eee;
|
||||
border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
}
|
||||
|
||||
pre a {
|
||||
color: inherit;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
td.linenos pre {
|
||||
margin: 1em 0em;
|
||||
}
|
||||
|
||||
td.code pre {
|
||||
margin: 1em 0em;
|
||||
}
|
||||
|
||||
div.quotebar {
|
||||
background-color: #f8f8f8;
|
||||
max-width: 250px;
|
||||
float: right;
|
||||
padding: 2px 7px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
div.topic {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
margin: 0 -0.5em 0 -0.5em;
|
||||
}
|
||||
|
||||
table td, table th {
|
||||
padding: 0.2em 0.5em 0.2em 0.5em;
|
||||
}
|
||||
|
||||
|
||||
/* ADMONITIONS AND WARNINGS ------------------------------------------------- */
|
||||
|
||||
/* Shared by admonitions, warnings and sidebars */
|
||||
div.admonition,
|
||||
div.warning,
|
||||
div.sidebar {
|
||||
font-size: 0.9em;
|
||||
margin: 2em;
|
||||
padding: 0;
|
||||
/*
|
||||
border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
*/
|
||||
}
|
||||
div.admonition p,
|
||||
div.warning p,
|
||||
div.sidebar p {
|
||||
margin: 0.5em 1em 0.5em 1em;
|
||||
padding: 0;
|
||||
}
|
||||
div.admonition pre,
|
||||
div.warning pre,
|
||||
div.sidebar pre {
|
||||
margin: 0.4em 1em 0.4em 1em;
|
||||
}
|
||||
div.admonition p.admonition-title,
|
||||
div.warning p.admonition-title,
|
||||
div.sidebar p.sidebar-title {
|
||||
margin: 0;
|
||||
padding: 0.1em 0 0.1em 0.5em;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
text-shadow: 0 1px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
div.admonition ul, div.admonition ol,
|
||||
div.warning ul, div.warning ol,
|
||||
div.sidebar ul, div.sidebar ol {
|
||||
margin: 0.1em 0.5em 0.5em 3em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/* Admonitions and sidebars only */
|
||||
div.admonition, div.sidebar {
|
||||
border: 1px solid #609060;
|
||||
background-color: #e9ffe9;
|
||||
}
|
||||
div.admonition p.admonition-title,
|
||||
div.sidebar p.sidebar-title {
|
||||
background-color: #70A070;
|
||||
border-bottom: 1px solid #609060;
|
||||
}
|
||||
|
||||
|
||||
/* Warnings only */
|
||||
div.warning {
|
||||
border: 1px solid #900000;
|
||||
background-color: #ffe9e9;
|
||||
}
|
||||
div.warning p.admonition-title {
|
||||
background-color: #b04040;
|
||||
border-bottom: 1px solid #900000;
|
||||
}
|
||||
|
||||
|
||||
/* Sidebars only */
|
||||
div.sidebar {
|
||||
max-width: 30%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
div.versioninfo {
|
||||
margin: 1em 0 0 0;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #DDEAF0;
|
||||
padding: 8px;
|
||||
line-height: 1.3em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.viewcode-back {
|
||||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
|
||||
'Verdana', sans-serif;
|
||||
}
|
||||
|
||||
div.viewcode-block:target {
|
||||
background-color: #f4debf;
|
||||
border-top: 1px solid #ac9;
|
||||
border-bottom: 1px solid #ac9;
|
||||
}
|
||||
|
||||
dl {
|
||||
margin: 1em 0 2.5em 0;
|
||||
}
|
||||
|
||||
/* Highlight target when you click an internal link */
|
||||
dt:target {
|
||||
background: #ffe080;
|
||||
}
|
||||
/* Don't highlight whole divs */
|
||||
div.highlight {
|
||||
background: transparent;
|
||||
}
|
||||
/* But do highlight spans (so search results can be highlighted) */
|
||||
span.highlight {
|
||||
background: #ffe080;
|
||||
}
|
||||
|
||||
div.footer {
|
||||
background-color: #465158;
|
||||
color: #eeeeee;
|
||||
padding: 0 2em 2em 2em;
|
||||
clear: both;
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0.8em 0 0.5em 0;
|
||||
}
|
||||
|
||||
.section p img.math {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
.section p img {
|
||||
margin: 1em 2em;
|
||||
}
|
||||
|
||||
|
||||
/* MOBILE LAYOUT -------------------------------------------------------------- */
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 1.25em;
|
||||
}
|
||||
|
||||
div.bodywrapper a.headerlink, #indices-and-tables h1 a {
|
||||
color: #e6e6e6;
|
||||
font-size: 80%;
|
||||
float: right;
|
||||
line-height: 1.8;
|
||||
position: absolute;
|
||||
right: -0.7em;
|
||||
visibility: inherit;
|
||||
}
|
||||
|
||||
div.bodywrapper h1 a.headerlink, #indices-and-tables h1 a {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-size: 0.7em;
|
||||
overflow: auto;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
div.related ul {
|
||||
height: 2.5em;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.related ul li {
|
||||
clear: both;
|
||||
color: #465158;
|
||||
padding: 0.2em 0;
|
||||
}
|
||||
|
||||
div.related ul li:last-child {
|
||||
border-bottom: 1px dotted #8ca1af;
|
||||
padding-bottom: 0.4em;
|
||||
margin-bottom: 1em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.related ul li a {
|
||||
color: #465158;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
div.related ul li a:hover {
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
div.related ul li.right {
|
||||
clear: none;
|
||||
padding: 0.65em 0;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
div.related ul li.right a {
|
||||
color: #fff;
|
||||
padding-right: 0.8em;
|
||||
}
|
||||
|
||||
div.related ul li.right a:hover {
|
||||
background-color: #8ca1af;
|
||||
}
|
||||
|
||||
div.body {
|
||||
clear: both;
|
||||
min-width: 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
div.bodywrapper {
|
||||
margin: 0 0 0 0;
|
||||
}
|
||||
|
||||
div.sphinxsidebar {
|
||||
float: none;
|
||||
margin: 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
div.sphinxsidebar input[type="text"] {
|
||||
height: 2em;
|
||||
line-height: 2em;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
div.sphinxsidebar input[type="submit"] {
|
||||
height: 2em;
|
||||
margin-left: 0.5em;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
div.sphinxsidebar p.searchtip {
|
||||
background: inherit;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
div.sphinxsidebar ul li, div.sphinxsidebar p.topless {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.bodywrapper img {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
div.documentwrapper {
|
||||
float: none;
|
||||
}
|
||||
|
||||
div.admonition, div.warning, pre, blockquote {
|
||||
margin-left: 0em;
|
||||
margin-right: 0em;
|
||||
}
|
||||
|
||||
.body p img {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#searchbox {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.related:not(:first-child) li {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.related:not(:first-child) li.right {
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.footer {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.rtd_doc_footer .badge {
|
||||
float: none;
|
||||
margin: 1em auto;
|
||||
position: static;
|
||||
}
|
||||
|
||||
.rtd_doc_footer .badge.revsys-inline {
|
||||
margin-right: auto;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
table.indextable {
|
||||
display: block;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.indextable tr {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.indextable td {
|
||||
display: block;
|
||||
padding: 0;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.indextable td dt {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
ul.search {
|
||||
margin-left: 0.25em;
|
||||
}
|
||||
|
||||
ul.search li div.context {
|
||||
font-size: 90%;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 1;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
from os.path import dirname, join
|
||||
from rst import Rest, Paragraph, Strong, OrderedListItem, ListItem, Title, Link, Transition
|
||||
from rst import Directive, Em, Quote, Text
|
||||
from tiramisu.option import *
|
||||
from tiramisu.config import *
|
||||
#from makerestdoc import *
|
||||
|
||||
docdir = join(dirname(__file__), 'build')
|
||||
|
||||
def make_rst_file(filename, rstcontent):
|
||||
fh = file(filename, 'w')
|
||||
fh.write(rstcontent.text())
|
||||
fh.close()
|
||||
|
||||
def descr_content(path, prefix, descr, root=False):
|
||||
content = Rest()
|
||||
title = Title(abovechar="", belowchar="=")
|
||||
if root:
|
||||
title.join(Text("Configuration's overview for: "), Quote(descr._name))
|
||||
else:
|
||||
title.join(Text("Group's overview for: "), Quote(descr._name))
|
||||
content.add(title)
|
||||
content.add(ListItem().join(Strong("name:"), Text(descr._name)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("path:"), Text(path)))
|
||||
content.add(ListItem().join(Strong("description:"), Text(descr.doc)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("container:"), Text(prefix)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("type:"), Text(descr.group_type)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
|
||||
content.add(ListItem().join(Strong("is hidden:"), Text(str(descr._is_hidden()))))
|
||||
content.add(ListItem().join(Strong("is disabled:"), Text(str(descr._is_disabled()))))
|
||||
content.add(Transition())
|
||||
content.add(Title(abovechar="", belowchar="-").join(Text("Ordered list of childrens for:"), Text(path)))
|
||||
for opt in descr._children:
|
||||
name = opt._name
|
||||
link = Link(name + ":", join(path + '.' + name + ".html"))
|
||||
# because of SympLink opt
|
||||
if hasattr(opt, 'doc'):
|
||||
doc = opt.doc
|
||||
else:
|
||||
doc = name
|
||||
content.add(OrderedListItem(link, Text(opt.doc)))
|
||||
content.add(Transition())
|
||||
content.add(Paragraph(Link("back to index", "index.html")))
|
||||
make_rst_file(join(docdir, path + '.txt'), content)
|
||||
if root:
|
||||
make_rst_file(join(docdir, 'index.txt'), content)
|
||||
|
||||
def opt_rst_content(path, prefix, descr, value):
|
||||
content = Rest()
|
||||
title = Title(abovechar="", belowchar="=")
|
||||
title.join(Text("Configuration's option overview for: "), Quote(descr._name))
|
||||
content.add(title)
|
||||
content.add(ListItem().join(Strong("name:"), Text(descr._name)))
|
||||
content.add(ListItem().join(Strong("value:"), Text(str(value))))
|
||||
content.add(ListItem().join(Strong("path:"), Text(path)))
|
||||
content.add(ListItem().join(Strong("container:"), Text(prefix)))
|
||||
if isinstance(descr, ChoiceOption):
|
||||
content.add(ListItem().join(Strong("possible values:"), Text(str(descr.values))))
|
||||
if not isinstance(descr, SymLinkOption):
|
||||
content.add(ListItem().join(Strong("type:"), Text(str(descr.opt_type))))
|
||||
content.add(ListItem().join(Strong("default:"), Text(str(descr.getdefault()))))
|
||||
content.add(ListItem().join(Strong("description:"), Text(str(descr.getdoc()))))
|
||||
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
|
||||
content.add(ListItem().join(Strong("is hidden:"), Text(str(descr._is_hidden()))))
|
||||
content.add(ListItem().join(Strong("is disabled:"), Text(str(descr._is_disabled()))))
|
||||
content.add(ListItem().join(Strong("is frozen:"), Text(str(descr._frozen))))
|
||||
content.add(ListItem().join(Strong("is multi:"), Text(str(descr.multi))))
|
||||
content.add(ListItem().join(Strong("is mandatory:"), Text(str(descr.is_mandatory()))))
|
||||
else:
|
||||
content.add(ListItem().join(Strong("links to:"), Text(str(descr.path))))
|
||||
content.add(Transition())
|
||||
content.add(Paragraph(Link("back to container", join(prefix + ".html"))))
|
||||
make_rst_file(join(docdir, path + '.txt'), content)
|
||||
|
||||
def make_rest_overview(cfg, title=True):
|
||||
rootname = cfg._cfgimpl_descr._name
|
||||
descr_content(rootname, rootname, cfg._cfgimpl_descr, root=True)
|
||||
#cfg.cfgimpl_read_write()
|
||||
cfg._cfgimpl_disabled = False
|
||||
cfg._cfgimpl_hidden = False
|
||||
for path in cfg.getpaths(include_groups=True, allpaths=True):
|
||||
child = cfg.unwrap_from_path(path)
|
||||
fullpath = rootname + '.' + path
|
||||
prefix = fullpath.rsplit(".", 1)[0]
|
||||
if isinstance(child, OptionDescription):
|
||||
descr_content(fullpath, prefix, child)
|
||||
else:
|
||||
value = getattr(cfg, path)
|
||||
opt_rst_content(fullpath, prefix, child, value)
|
||||
|
||||
if __name__ == '__main__':
|
||||
from test_config_big_example import get_example_config
|
||||
make_rest_overview(get_example_config())
|
||||
# ____________________________________________________________
|
||||
|
@ -1,115 +0,0 @@
|
||||
from tiramisu.config import Config
|
||||
from tiramisu import option
|
||||
# we shall keep extendable types out of the reach of unexceptional guys like us
|
||||
# horror __metaclass__ = extendabletype
|
||||
|
||||
def get_fullpath(opt, path):
|
||||
if path:
|
||||
return "%s.%s" % (path, opt._name)
|
||||
else:
|
||||
return opt._name
|
||||
|
||||
class Option:
|
||||
def make_rest_doc(self, path=""):
|
||||
fullpath = get_fullpath(self, path)
|
||||
result = Rest(
|
||||
Title(fullpath, abovechar="=", belowchar="="),
|
||||
ListItem(Strong("name:"), self._name),
|
||||
ListItem(Strong("description:"), self.doc))
|
||||
return result
|
||||
|
||||
class ChoiceOption(Option, option.ChoiceOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(ChoiceOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "choice option"))
|
||||
content.add(ListItem(Strong("possible values:"),
|
||||
*[ListItem(str(val)) for val in self.values]))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
|
||||
# requirements = []
|
||||
#
|
||||
# for val in self.values:
|
||||
# if val not in self._requires:
|
||||
# continue
|
||||
# req = self._requires[val]
|
||||
# requirements.append(ListItem("value '%s' requires:" % (val, ),
|
||||
# *[ListItem(Link(opt, opt + ".html"),
|
||||
# "to be set to '%s'" % (rval, ))
|
||||
# for (opt, rval) in req]))
|
||||
# if requirements:
|
||||
# content.add(ListItem(Strong("requirements:"), *requirements))
|
||||
return content
|
||||
|
||||
class BoolOption(Option, option.BoolOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(BoolOption, self).make_rest_doc(path)
|
||||
fullpath = get_fullpath(self, path)
|
||||
content.add(ListItem(Strong("option type:"), "boolean option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
# if self._requires is not None:
|
||||
# requirements = [ListItem(Link(opt, opt + ".html"),
|
||||
# "must be set to '%s'" % (rval, ))
|
||||
# for (opt, rval) in self._requires]
|
||||
# if requirements:
|
||||
# content.add(ListItem(Strong("requirements:"), *requirements))
|
||||
return content
|
||||
|
||||
class IntOption(Option, option.IntOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(IntOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "integer option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
return content
|
||||
|
||||
class FloatOption(Option, option.FloatOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(FloatOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "float option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
return content
|
||||
|
||||
class StrOption(Option, option.StrOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(StrOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "string option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
return content
|
||||
|
||||
#class ArbitraryOption:
|
||||
# def make_rest_doc(self, path=""):
|
||||
# content = super(ArbitraryOption, self).make_rest_doc(path)
|
||||
# content.add(ListItem(Strong("option type:"),
|
||||
# "arbitrary option (mostly internal)"))
|
||||
# if self.default is not None:
|
||||
# content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
# elif self.defaultfactory is not None:
|
||||
# content.add(ListItem(Strong("factory for the default value:"),
|
||||
# str(self.defaultfactory)))
|
||||
# return content
|
||||
|
||||
class OptionDescription(option.OptionDescription):
|
||||
def make_rest_doc(self, path=""):
|
||||
fullpath = get_fullpath(self, path)
|
||||
content = Rest(
|
||||
Title(fullpath, abovechar="=", belowchar="="))
|
||||
toctree = []
|
||||
for child in self._children:
|
||||
subpath = fullpath + "." + child._name
|
||||
toctree.append(subpath)
|
||||
content.add(Directive("toctree", *toctree, **{'maxdepth': 4}))
|
||||
content.join(
|
||||
ListItem(Strong("name:"), self._name),
|
||||
ListItem(Strong("description:"), self.doc))
|
||||
stack = []
|
||||
curr = content
|
||||
# config = Config(self)
|
||||
return content
|
||||
|
||||
# ____________________________________________________________
|
||||
|
||||
|
@ -1,410 +0,0 @@
|
||||
# unproudly borrowed from pypy :
|
||||
# http://codespeak.net/svn/pypy/trunk/pypy/tool/rest/rst.py
|
||||
""" reStructuredText generation tools
|
||||
|
||||
provides an api to build a tree from nodes, which can be converted to
|
||||
ReStructuredText on demand
|
||||
|
||||
note that not all of ReST is supported, a usable subset is offered, but
|
||||
certain features aren't supported, and also certain details (like how links
|
||||
are generated, or how escaping is done) can not be controlled
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
def escape(txt):
|
||||
"""escape ReST markup"""
|
||||
if not isinstance(txt, str) and not isinstance(txt, unicode):
|
||||
txt = str(txt)
|
||||
# XXX this takes a very naive approach to escaping, but it seems to be
|
||||
# sufficient...
|
||||
for c in '\\*`|:_':
|
||||
txt = txt.replace(c, '\\%s' % (c,))
|
||||
return txt
|
||||
|
||||
class RestError(Exception):
|
||||
""" raised on containment errors (wrong parent) """
|
||||
|
||||
class AbstractMetaclass(type):
|
||||
def __new__(cls, *args):
|
||||
obj = super(AbstractMetaclass, cls).__new__(cls, *args)
|
||||
parent_cls = obj.parentclass
|
||||
if parent_cls is None:
|
||||
return obj
|
||||
if not isinstance(parent_cls, list):
|
||||
class_list = [parent_cls]
|
||||
else:
|
||||
class_list = parent_cls
|
||||
if obj.allow_nesting:
|
||||
class_list.append(obj)
|
||||
|
||||
for _class in class_list:
|
||||
if not _class.allowed_child:
|
||||
_class.allowed_child = {obj:True}
|
||||
else:
|
||||
_class.allowed_child[obj] = True
|
||||
return obj
|
||||
|
||||
class AbstractNode(object):
|
||||
""" Base class implementing rest generation
|
||||
"""
|
||||
sep = ''
|
||||
__metaclass__ = AbstractMetaclass
|
||||
parentclass = None # this exists to allow parent to know what
|
||||
# children can exist
|
||||
allow_nesting = False
|
||||
allowed_child = {}
|
||||
defaults = {}
|
||||
|
||||
_reg_whitespace = re.compile('\s+')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.parent = None
|
||||
self.children = []
|
||||
for child in args:
|
||||
self._add(child)
|
||||
for arg in kwargs:
|
||||
setattr(self, arg, kwargs[arg])
|
||||
|
||||
def join(self, *children):
|
||||
""" add child nodes
|
||||
|
||||
returns a reference to self
|
||||
"""
|
||||
for child in children:
|
||||
self._add(child)
|
||||
return self
|
||||
|
||||
def add(self, child):
|
||||
""" adds a child node
|
||||
|
||||
returns a reference to the child
|
||||
"""
|
||||
self._add(child)
|
||||
return child
|
||||
|
||||
def _add(self, child):
|
||||
if child.__class__ not in self.allowed_child:
|
||||
raise RestError("%r cannot be child of %r" % \
|
||||
(child.__class__, self.__class__))
|
||||
self.children.append(child)
|
||||
child.parent = self
|
||||
|
||||
def __getitem__(self, item):
|
||||
return self.children[item]
|
||||
|
||||
def __setitem__(self, item, value):
|
||||
self.children[item] = value
|
||||
|
||||
def text(self):
|
||||
""" return a ReST string representation of the node """
|
||||
return self.sep.join([child.text() for child in self.children])
|
||||
|
||||
def wordlist(self):
|
||||
""" return a list of ReST strings for this node and its children """
|
||||
return [self.text()]
|
||||
|
||||
class Rest(AbstractNode):
|
||||
""" Root node of a document """
|
||||
|
||||
sep = "\n\n"
|
||||
def __init__(self, *args, **kwargs):
|
||||
AbstractNode.__init__(self, *args, **kwargs)
|
||||
self.links = {}
|
||||
|
||||
def render_links(self, check=False):
|
||||
"""render the link attachments of the document"""
|
||||
assert not check, "Link checking not implemented"
|
||||
if not self.links:
|
||||
return ""
|
||||
link_texts = []
|
||||
# XXX this could check for duplicates and remove them...
|
||||
for link, target in self.links.iteritems():
|
||||
link_texts.append(".. _`%s`: %s" % (escape(link), target))
|
||||
return "\n" + "\n".join(link_texts) + "\n\n"
|
||||
|
||||
def text(self):
|
||||
outcome = []
|
||||
if (isinstance(self.children[0], Transition) or
|
||||
isinstance(self.children[-1], Transition)):
|
||||
raise ValueError, ('document must not begin or end with a '
|
||||
'transition')
|
||||
for child in self.children:
|
||||
outcome.append(child.text())
|
||||
|
||||
# always a trailing newline
|
||||
text = self.sep.join([i for i in outcome if i]) + "\n"
|
||||
return text + self.render_links()
|
||||
|
||||
class Transition(AbstractNode):
|
||||
""" a horizontal line """
|
||||
parentclass = Rest
|
||||
|
||||
def __init__(self, char='-', width=80, *args, **kwargs):
|
||||
self.char = char
|
||||
self.width = width
|
||||
super(Transition, self).__init__(*args, **kwargs)
|
||||
|
||||
def text(self):
|
||||
return (self.width - 1) * self.char
|
||||
|
||||
class Paragraph(AbstractNode):
|
||||
""" simple paragraph """
|
||||
|
||||
parentclass = Rest
|
||||
sep = " "
|
||||
indent = ""
|
||||
# FIXME
|
||||
width = 880
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
# make shortcut
|
||||
args = list(args)
|
||||
for num, arg in enumerate(args):
|
||||
if isinstance(arg, str):
|
||||
args[num] = Text(arg)
|
||||
super(Paragraph, self).__init__(*args, **kwargs)
|
||||
|
||||
def text(self):
|
||||
texts = []
|
||||
for child in self.children:
|
||||
texts += child.wordlist()
|
||||
|
||||
buf = []
|
||||
outcome = []
|
||||
lgt = len(self.indent)
|
||||
|
||||
def grab(buf):
|
||||
outcome.append(self.indent + self.sep.join(buf))
|
||||
|
||||
texts.reverse()
|
||||
while texts:
|
||||
next = texts[-1]
|
||||
if not next:
|
||||
texts.pop()
|
||||
continue
|
||||
if lgt + len(self.sep) + len(next) <= self.width or not buf:
|
||||
buf.append(next)
|
||||
lgt += len(next) + len(self.sep)
|
||||
texts.pop()
|
||||
else:
|
||||
grab(buf)
|
||||
lgt = len(self.indent)
|
||||
buf = []
|
||||
grab(buf)
|
||||
return "\n".join(outcome)
|
||||
|
||||
class SubParagraph(Paragraph):
|
||||
""" indented sub paragraph """
|
||||
|
||||
indent = " "
|
||||
|
||||
class Title(Paragraph):
|
||||
""" title element """
|
||||
|
||||
parentclass = Rest
|
||||
belowchar = "="
|
||||
abovechar = ""
|
||||
|
||||
def text(self):
|
||||
txt = self._get_text()
|
||||
lines = []
|
||||
if self.abovechar:
|
||||
lines.append(self.abovechar * len(txt))
|
||||
lines.append(txt)
|
||||
if self.belowchar:
|
||||
lines.append(self.belowchar * len(txt))
|
||||
return "\n".join(lines)
|
||||
|
||||
def _get_text(self):
|
||||
txt = []
|
||||
for node in self.children:
|
||||
txt += node.wordlist()
|
||||
return ' '.join(txt)
|
||||
|
||||
class AbstractText(AbstractNode):
|
||||
parentclass = [Paragraph, Title]
|
||||
start = ""
|
||||
end = ""
|
||||
def __init__(self, _text):
|
||||
self._text = _text
|
||||
|
||||
def text(self):
|
||||
text = self.escape(self._text)
|
||||
return self.start + text + self.end
|
||||
|
||||
def escape(self, text):
|
||||
if not isinstance(text, str) and not isinstance(text, unicode):
|
||||
text = str(text)
|
||||
if self.start:
|
||||
text = text.replace(self.start, '\\%s' % (self.start,))
|
||||
if self.end and self.end != self.start:
|
||||
text = text.replace(self.end, '\\%s' % (self.end,))
|
||||
return text
|
||||
|
||||
class Text(AbstractText):
|
||||
def wordlist(self):
|
||||
text = escape(self._text)
|
||||
return self._reg_whitespace.split(text)
|
||||
|
||||
class LiteralBlock(AbstractText):
|
||||
parentclass = Rest
|
||||
start = '::\n\n'
|
||||
|
||||
def text(self):
|
||||
if not self._text.strip():
|
||||
return ''
|
||||
text = self.escape(self._text).split('\n')
|
||||
for i, line in enumerate(text):
|
||||
if line.strip():
|
||||
text[i] = ' %s' % (line,)
|
||||
return self.start + '\n'.join(text)
|
||||
|
||||
class Em(AbstractText):
|
||||
start = "*"
|
||||
end = "*"
|
||||
|
||||
class Strong(AbstractText):
|
||||
start = "**"
|
||||
end = "**"
|
||||
|
||||
class Quote(AbstractText):
|
||||
start = '``'
|
||||
end = '``'
|
||||
|
||||
class Anchor(AbstractText):
|
||||
start = '_`'
|
||||
end = '`'
|
||||
|
||||
class Footnote(AbstractText):
|
||||
def __init__(self, note, symbol=False):
|
||||
raise NotImplemented('XXX')
|
||||
|
||||
class Citation(AbstractText):
|
||||
def __init__(self, text, cite):
|
||||
raise NotImplemented('XXX')
|
||||
|
||||
class ListItem(Paragraph):
|
||||
allow_nesting = True
|
||||
item_chars = '*+-'
|
||||
|
||||
def text(self):
|
||||
idepth = self.get_indent_depth()
|
||||
indent = self.indent + (idepth + 1) * ' '
|
||||
txt = '\n\n'.join(self.render_children(indent))
|
||||
ret = []
|
||||
item_char = self.item_chars[idepth]
|
||||
ret += [indent[len(item_char)+1:], item_char, ' ', txt[len(indent):]]
|
||||
return ''.join(ret)
|
||||
|
||||
def render_children(self, indent):
|
||||
txt = []
|
||||
buffer = []
|
||||
def render_buffer(fro, to):
|
||||
if not fro:
|
||||
return
|
||||
p = Paragraph(indent=indent, *fro)
|
||||
p.parent = self.parent
|
||||
to.append(p.text())
|
||||
for child in self.children:
|
||||
if isinstance(child, AbstractText):
|
||||
buffer.append(child)
|
||||
else:
|
||||
if buffer:
|
||||
render_buffer(buffer, txt)
|
||||
buffer = []
|
||||
txt.append(child.text())
|
||||
|
||||
render_buffer(buffer, txt)
|
||||
return txt
|
||||
|
||||
def get_indent_depth(self):
|
||||
depth = 0
|
||||
current = self
|
||||
while (current.parent is not None and
|
||||
isinstance(current.parent, ListItem)):
|
||||
depth += 1
|
||||
current = current.parent
|
||||
return depth
|
||||
|
||||
class OrderedListItem(ListItem):
|
||||
item_chars = ["#."] * 5
|
||||
|
||||
class DListItem(ListItem):
|
||||
item_chars = None
|
||||
def __init__(self, term, definition, *args, **kwargs):
|
||||
self.term = term
|
||||
super(DListItem, self).__init__(definition, *args, **kwargs)
|
||||
|
||||
def text(self):
|
||||
idepth = self.get_indent_depth()
|
||||
indent = self.indent + (idepth + 1) * ' '
|
||||
txt = '\n\n'.join(self.render_children(indent))
|
||||
ret = []
|
||||
ret += [indent[2:], self.term, '\n', txt]
|
||||
return ''.join(ret)
|
||||
|
||||
class Link(AbstractText):
|
||||
start = '`'
|
||||
end = '`_'
|
||||
|
||||
def __init__(self, _text, target):
|
||||
self._text = _text
|
||||
self.target = target
|
||||
self.rest = None
|
||||
|
||||
def text(self):
|
||||
if self.rest is None:
|
||||
self.rest = self.find_rest()
|
||||
if self.rest.links.get(self._text, self.target) != self.target:
|
||||
raise ValueError('link name %r already in use for a different '
|
||||
'target' % (self.target,))
|
||||
self.rest.links[self._text] = self.target
|
||||
return AbstractText.text(self)
|
||||
|
||||
def find_rest(self):
|
||||
# XXX little overkill, but who cares...
|
||||
next = self
|
||||
while next.parent is not None:
|
||||
next = next.parent
|
||||
return next
|
||||
|
||||
class InternalLink(AbstractText):
|
||||
start = '`'
|
||||
end = '`_'
|
||||
|
||||
class LinkTarget(Paragraph):
|
||||
def __init__(self, name, target):
|
||||
self.name = name
|
||||
self.target = target
|
||||
|
||||
def text(self):
|
||||
return ".. _`%s`:%s\n" % (self.name, self.target)
|
||||
|
||||
class Substitution(AbstractText):
|
||||
def __init__(self, text, **kwargs):
|
||||
raise NotImplemented('XXX')
|
||||
|
||||
class Directive(Paragraph):
|
||||
indent = ' '
|
||||
def __init__(self, name, *args, **options):
|
||||
self.name = name
|
||||
self.content = args
|
||||
super(Directive, self).__init__()
|
||||
self.options = options
|
||||
|
||||
def text(self):
|
||||
# XXX not very pretty...
|
||||
txt = '.. %s::' % (self.name,)
|
||||
options = '\n'.join([' :%s: %s' % (k, v) for (k, v) in
|
||||
self.options.iteritems()])
|
||||
if options:
|
||||
txt += '\n%s' % (options,)
|
||||
|
||||
if self.content:
|
||||
txt += '\n'
|
||||
for item in self.content:
|
||||
txt += '\n ' + item
|
||||
|
||||
return txt
|
||||
|
@ -1,27 +0,0 @@
|
||||
# coding: utf-8
|
||||
from tiramisu.config import *
|
||||
from tiramisu.option import *
|
||||
|
||||
all_modules = ['amon', 'sphynx', 'zephir']
|
||||
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False)
|
||||
|
||||
gcgroup = OptionDescription('gc', 'doc pour gc', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('essai', 'une éééééé doc pour essai', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
|
||||
def get_example_config():
|
||||
return Config(descr)
|
@ -1,13 +0,0 @@
|
||||
"""automatically sets the PYTHONPATH before running the unit tests
|
||||
|
||||
This is supposed to be used in development mode (i.e. testing from a fresh
|
||||
checkout)
|
||||
"""
|
||||
|
||||
from os.path import dirname, abspath, join, normpath
|
||||
import sys
|
||||
|
||||
HERE = dirname(abspath(__file__))
|
||||
PATH = normpath(join(HERE, '..'))
|
||||
if PATH not in sys.path:
|
||||
sys.path.insert(1, PATH)
|
@ -1,104 +0,0 @@
|
||||
#this test is much more to test that **it's there** and answers attribute access
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from config import *
|
||||
from option import *
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False)
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('tiram', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
def test_base_config():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy])
|
||||
cfg = Config(descr)
|
||||
assert cfg.dummy == False
|
||||
dm = cfg.unwrap_from_path('dummy')
|
||||
assert dm._name == 'dummy'
|
||||
|
||||
def test_reset_value():
|
||||
descr = make_description()
|
||||
cfg = Config(descr)
|
||||
assert cfg.gc.dummy == False
|
||||
cfg.gc.dummy = True
|
||||
assert cfg.gc.dummy == True
|
||||
cfg.gc.dummy = None
|
||||
|
||||
def test_base_config_and_groups():
|
||||
descr = make_description()
|
||||
# overrides the booloption default value
|
||||
config = Config(descr, bool=False)
|
||||
assert config.gc.name == 'ref'
|
||||
assert config.bool == False
|
||||
nm = config.unwrap_from_path('gc.name')
|
||||
assert nm._name == 'name'
|
||||
gc = config.unwrap_from_path('gc')
|
||||
assert gc._name == 'gc'
|
||||
nm = config.unwrap_from_name('name')
|
||||
assert nm._name == 'name'
|
||||
|
||||
def test_base_config_in_a_tree():
|
||||
"how options are organized into a tree"
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
|
||||
assert config.gc.name == 'ref'
|
||||
config.gc.name = 'framework'
|
||||
assert config.gc.name == 'framework'
|
||||
assert getattr(config, "gc.name") == 'framework'
|
||||
|
||||
assert config.objspace == 'std'
|
||||
config.objspace = 'thunk'
|
||||
assert config.objspace == 'thunk'
|
||||
|
||||
assert config.gc.float == 2.3
|
||||
assert config.int == 0
|
||||
config.gc.float = 3.4
|
||||
config.int = 123
|
||||
assert config.gc.float == 3.4
|
||||
assert config.int == 123
|
||||
|
||||
assert not config.wantref
|
||||
|
||||
assert config.str == "abc"
|
||||
config.str = "def"
|
||||
assert config.str == "def"
|
||||
|
||||
raises(AttributeError, 'config.gc.foo = "bar"')
|
||||
|
||||
config = Config(descr, bool=False)
|
||||
assert config.gc.name == 'ref'
|
||||
config.wantframework = True
|
||||
|
||||
def test_config_values():
|
||||
"_cfgimpl_values appears to be a simple dict"
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
config.set(dummy=False)
|
||||
assert config.gc._cfgimpl_values == {'dummy': False, 'float': 2.3, 'name': 'ref'}
|
||||
|
||||
def test_cfgimpl_get_home_by_path():
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
assert config._cfgimpl_get_home_by_path('gc.dummy')[1] == 'dummy'
|
||||
assert config._cfgimpl_get_home_by_path('dummy')[1] == 'dummy'
|
||||
assert config.getpaths(include_groups=False) == ['gc.name', 'gc.dummy', 'gc.float', 'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
||||
assert config.getpaths(include_groups=True) == ['gc', 'gc.name', 'gc.dummy', 'gc.float', 'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
@ -1,167 +0,0 @@
|
||||
"configuration objects global API"
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from config import *
|
||||
from option import *
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Tests', default=False)
|
||||
wantframework_option = BoolOption('wantframework', 'Test', default=False)
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
|
||||
def test_compare_configs():
|
||||
"config object comparison"
|
||||
descr = make_description()
|
||||
conf1 = Config(descr)
|
||||
conf2 = Config(descr, wantref=True)
|
||||
assert conf1 != conf2
|
||||
assert hash(conf1) != hash(conf2)
|
||||
assert conf1.getkey() != conf2.getkey()
|
||||
conf1.wantref = True
|
||||
assert conf1 == conf2
|
||||
assert hash(conf1) == hash(conf2)
|
||||
assert conf1.getkey() == conf2.getkey()
|
||||
# ____________________________________________________________
|
||||
|
||||
def test_iter_config():
|
||||
"iteration on config object"
|
||||
s = StrOption("string", "", default="string")
|
||||
s2 = StrOption("string2", "", default="string2")
|
||||
descr = OptionDescription("options", "", [s,s2])
|
||||
config = Config(descr)
|
||||
assert [(name, value) for name, value in config] == \
|
||||
[('string', 'string'), ('string2', 'string2')]
|
||||
|
||||
def test_iter_subconfig():
|
||||
"iteration on config sub object"
|
||||
descr = make_description()
|
||||
conf = Config(descr)
|
||||
for (name, value), (gname, gvalue) in \
|
||||
zip(conf.gc, [("name", "ref"), ("dummy", False)]):
|
||||
assert name == gname
|
||||
assert value == gvalue
|
||||
#____________________________________________________________
|
||||
def test_getpaths():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
|
||||
assert config.getpaths() == ['gc.name', 'gc.dummy', 'gc.float', 'bool',
|
||||
'objspace', 'wantref', 'str', 'wantframework',
|
||||
'int', 'boolop']
|
||||
assert config.getpaths() == descr.getpaths()
|
||||
assert config.gc.getpaths() == ['name', 'dummy', 'float']
|
||||
assert config.gc.getpaths() == descr.gc.getpaths()
|
||||
assert config.getpaths(include_groups=True) == [
|
||||
'gc', 'gc.name', 'gc.dummy', 'gc.float',
|
||||
'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
||||
|
||||
assert config.getpaths(True) == descr.getpaths(True)
|
||||
|
||||
def test_getpaths_with_hidden():
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
booloption.hide()
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False)
|
||||
|
||||
descr = OptionDescription('tiramisu', '', [booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
|
||||
config = Config(descr)
|
||||
result = ['objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
||||
assert config.getpaths() == result
|
||||
r2 = ['bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
||||
assert config.getpaths(allpaths=True) == r2
|
||||
|
||||
def test_str():
|
||||
descr = make_description()
|
||||
c = Config(descr)
|
||||
print c # does not crash
|
||||
|
||||
def test_dir():
|
||||
descr = make_description()
|
||||
c = Config(descr)
|
||||
print dir(c)
|
||||
|
||||
def test_make_dict():
|
||||
"serialization of the whole config to a dict"
|
||||
descr = OptionDescription("opt", "", [
|
||||
OptionDescription("s1", "", [
|
||||
BoolOption("a", "", default=False)]),
|
||||
IntOption("int", "", default=42)])
|
||||
config = Config(descr)
|
||||
d = make_dict(config)
|
||||
assert d == {"s1.a": False, "int": 42}
|
||||
config.int = 43
|
||||
config.s1.a = True
|
||||
d = make_dict(config)
|
||||
assert d == {"s1.a": True, "int": 43}
|
||||
d2 = make_dict(config, flatten=True)
|
||||
assert d2 == {'a': True, 'int': 43}
|
||||
|
||||
def test_delattr():
|
||||
"delattr, means suppression of an option in a config"
|
||||
descr = OptionDescription("opt", "", [
|
||||
OptionDescription("s1", "", [
|
||||
BoolOption("a", "", default=False)]),
|
||||
IntOption("int", "", default=42)])
|
||||
c = Config(descr)
|
||||
c.int = 45
|
||||
assert c.int == 45
|
||||
del c.int
|
||||
assert c.int == 42
|
||||
c.int = 45
|
||||
assert c.int == 45
|
||||
|
||||
#def test_validator():
|
||||
# "validates the integrity of an option towards a whole configuration"
|
||||
# def my_validator_1(config):
|
||||
# assert config is c
|
||||
|
||||
# def my_validator_2(config):
|
||||
# assert config is c
|
||||
# raise ConflictConfigError
|
||||
|
||||
# descr = OptionDescription("opt", "", [
|
||||
# BoolOption('booloption1', 'option test1', default=False,
|
||||
# validator=my_validator_1),
|
||||
# BoolOption('booloption2', 'option test2', default=False,
|
||||
# validator=my_validator_2),
|
||||
# BoolOption('booloption4', 'option test4', default=False,
|
||||
# ),
|
||||
# ])
|
||||
# c = Config(descr)
|
||||
# c.booloption1 = True
|
||||
## raises(ConfigError, "c.booloption2 = True")
|
||||
## assert c.booloption2 is False
|
||||
## raises(ConfigError, "c.booloption3 = True")
|
||||
# assert c.booloption2 is False
|
||||
# c.booloption4 = True
|
||||
# assert c.booloption2 is False
|
||||
# c.booloption2 = False
|
||||
# assert c.booloption2 is False
|
||||
#
|
@ -1,258 +0,0 @@
|
||||
#just a proof of concept with a lot of options and option groups
|
||||
import autopath
|
||||
from config import *
|
||||
from option import *
|
||||
|
||||
all_modules = ['amon', 'sphynx', 'zephir']
|
||||
|
||||
example__optiondescription = OptionDescription("objspace", "Object Space Options", [
|
||||
ChoiceOption("name", "Object Space name",
|
||||
["std", "flow", "thunk", "dump", "taint"],
|
||||
"std"),
|
||||
|
||||
OptionDescription("opcodes", "opcodes to enable in the interpreter", [
|
||||
BoolOption("CALL_LIKELY_BUILTIN", "emit a special bytecode for likely calls to builtin functions",
|
||||
default=False,
|
||||
requires=[("translation.stackless", False)]),
|
||||
BoolOption("CALL_METHOD", "emit a special bytecode for expr.name()",
|
||||
default=False),
|
||||
]),
|
||||
|
||||
BoolOption("nofaking", "disallow faking in the object space",
|
||||
default=False,
|
||||
requires=[
|
||||
("objspace.usemodules.posix", True),
|
||||
("objspace.usemodules.time", True),
|
||||
("objspace.usemodules.errno", True)],
|
||||
),
|
||||
|
||||
OptionDescription("usemodules", "Which Modules should be used", [
|
||||
BoolOption(modname, "use module %s" % (modname, ),
|
||||
default=True,
|
||||
requires= ['amon'],
|
||||
)
|
||||
for modname in all_modules]),
|
||||
|
||||
BoolOption("allworkingmodules", "use as many working modules as possible",
|
||||
default=True,
|
||||
),
|
||||
|
||||
BoolOption("translationmodules",
|
||||
"use only those modules that are needed to run translate.py on pypy",
|
||||
default=False,
|
||||
),
|
||||
|
||||
BoolOption("geninterp", "specify whether geninterp should be used",
|
||||
default=True),
|
||||
|
||||
BoolOption("logbytecodes",
|
||||
"keep track of bytecode usage",
|
||||
default=False),
|
||||
|
||||
BoolOption("usepycfiles", "Write and read pyc files when importing",
|
||||
default=True),
|
||||
|
||||
BoolOption("lonepycfiles", "Import pyc files with no matching py file",
|
||||
default=False,
|
||||
requires=[("objspace.usepycfiles", True)]),
|
||||
|
||||
StrOption("soabi",
|
||||
"Tag to differentiate extension modules built for different Python interpreters",
|
||||
default=None),
|
||||
|
||||
BoolOption("honor__builtins__",
|
||||
"Honor the __builtins__ key of a module dictionary",
|
||||
default=False),
|
||||
|
||||
BoolOption("disable_call_speedhacks",
|
||||
"make sure that all calls go through space.call_args",
|
||||
default=False),
|
||||
|
||||
BoolOption("timing",
|
||||
"timing of various parts of the interpreter (simple profiling)",
|
||||
default=False),
|
||||
|
||||
OptionDescription("std", "Standard Object Space Options", [
|
||||
BoolOption("withtproxy", "support transparent proxies",
|
||||
default=True),
|
||||
|
||||
BoolOption("withsmallint", "use tagged integers",
|
||||
default=False,
|
||||
requires=[("objspace.std.withprebuiltint", False),
|
||||
("translation.taggedpointers", True)]),
|
||||
|
||||
BoolOption("withprebuiltint", "prebuild commonly used int objects",
|
||||
default=False),
|
||||
|
||||
IntOption("prebuiltintfrom", "lowest integer which is prebuilt",
|
||||
default=-5),
|
||||
|
||||
IntOption("prebuiltintto", "highest integer which is prebuilt",
|
||||
default=100),
|
||||
|
||||
BoolOption("withstrjoin", "use strings optimized for addition",
|
||||
default=False),
|
||||
|
||||
BoolOption("withstrslice", "use strings optimized for slicing",
|
||||
default=False),
|
||||
|
||||
BoolOption("withstrbuf", "use strings optimized for addition (ver 2)",
|
||||
default=False),
|
||||
|
||||
BoolOption("withprebuiltchar",
|
||||
"use prebuilt single-character string objects",
|
||||
default=False),
|
||||
|
||||
BoolOption("sharesmallstr",
|
||||
"always reuse the prebuilt string objects "
|
||||
"(the empty string and potentially single-char strings)",
|
||||
default=False),
|
||||
|
||||
BoolOption("withrope", "use ropes as the string implementation",
|
||||
default=False,
|
||||
requires=[("objspace.std.withstrslice", False),
|
||||
("objspace.std.withstrjoin", False),
|
||||
("objspace.std.withstrbuf", False)],
|
||||
),
|
||||
|
||||
BoolOption("withropeunicode", "use ropes for the unicode implementation",
|
||||
default=False,
|
||||
requires=[("objspace.std.withrope", True)]),
|
||||
|
||||
BoolOption("withcelldict",
|
||||
"use dictionaries that are optimized for being used as module dicts",
|
||||
default=False,
|
||||
requires=[("objspace.opcodes.CALL_LIKELY_BUILTIN", False),
|
||||
("objspace.honor__builtins__", False)]),
|
||||
|
||||
BoolOption("withdictmeasurement",
|
||||
"create huge files with masses of information "
|
||||
"about dictionaries",
|
||||
default=False),
|
||||
|
||||
BoolOption("withmapdict",
|
||||
"make instances really small but slow without the JIT",
|
||||
default=False,
|
||||
requires=[("objspace.std.getattributeshortcut", True),
|
||||
("objspace.std.withtypeversion", True),
|
||||
]),
|
||||
|
||||
BoolOption("withrangelist",
|
||||
"enable special range list implementation that does not "
|
||||
"actually create the full list until the resulting "
|
||||
"list is mutated",
|
||||
default=False),
|
||||
|
||||
BoolOption("withtypeversion",
|
||||
"version type objects when changing them",
|
||||
default=False,
|
||||
# weakrefs needed, because of get_subclasses()
|
||||
requires=[("translation.rweakref", True)]),
|
||||
|
||||
BoolOption("withmethodcache",
|
||||
"try to cache method lookups",
|
||||
default=False,
|
||||
requires=[("objspace.std.withtypeversion", True),
|
||||
("translation.rweakref", True)]),
|
||||
BoolOption("withmethodcachecounter",
|
||||
"try to cache methods and provide a counter in __pypy__. "
|
||||
"for testing purposes only.",
|
||||
default=False,
|
||||
requires=[("objspace.std.withmethodcache", True)]),
|
||||
IntOption("methodcachesizeexp",
|
||||
" 2 ** methodcachesizeexp is the size of the of the method cache ",
|
||||
default=11),
|
||||
BoolOption("optimized_int_add",
|
||||
"special case the addition of two integers in BINARY_ADD",
|
||||
default=False),
|
||||
BoolOption("optimized_comparison_op",
|
||||
"special case the comparison of integers",
|
||||
default=False),
|
||||
BoolOption("optimized_list_getitem",
|
||||
"special case the 'list[integer]' expressions",
|
||||
default=False),
|
||||
BoolOption("builtinshortcut",
|
||||
"a shortcut for operations between built-in types",
|
||||
default=False),
|
||||
BoolOption("getattributeshortcut",
|
||||
"track types that override __getattribute__",
|
||||
default=False),
|
||||
BoolOption("newshortcut",
|
||||
"cache and shortcut calling __new__ from builtin types",
|
||||
default=False),
|
||||
|
||||
BoolOption("logspaceoptypes",
|
||||
"a instrumentation option: before exit, print the types seen by "
|
||||
"certain simpler bytecodes",
|
||||
default=False),
|
||||
ChoiceOption("multimethods", "the multimethod implementation to use",
|
||||
["doubledispatch", "mrd"],
|
||||
default="mrd"),
|
||||
BoolOption("immutable_builtintypes",
|
||||
"Forbid the changing of builtin types", default=True),
|
||||
]),
|
||||
])
|
||||
|
||||
# ____________________________________________________________
|
||||
|
||||
def get_combined_translation_config(other_optdescr=None,
|
||||
existing_config=None,
|
||||
overrides=None,
|
||||
translating=False):
|
||||
if overrides is None:
|
||||
overrides = {}
|
||||
d = BoolOption("translating",
|
||||
"indicates whether we are translating currently",
|
||||
default=False)
|
||||
if other_optdescr is None:
|
||||
children = []
|
||||
newname = ""
|
||||
else:
|
||||
children = [other_optdescr]
|
||||
newname = other_optdescr._name
|
||||
descr = OptionDescription("eole", "all options", children)
|
||||
config = Config(descr, **overrides)
|
||||
if translating:
|
||||
config.translating = True
|
||||
if existing_config is not None:
|
||||
for child in existing_config._cfgimpl_descr._children:
|
||||
if child._name == newname:
|
||||
continue
|
||||
value = getattr(existing_config, child._name)
|
||||
config._cfgimpl_values[child._name] = value
|
||||
return config
|
||||
|
||||
def get_example_config(overrides=None, translating=False):
|
||||
return get_combined_translation_config(
|
||||
example__optiondescription, overrides=overrides,
|
||||
translating=translating)
|
||||
|
||||
# ____________________________________________________________
|
||||
|
||||
def test_example_option():
|
||||
config = get_example_config()
|
||||
result = ['objspace.name', 'objspace.opcodes.CALL_LIKELY_BUILTIN',
|
||||
'objspace.opcodes.CALL_METHOD', 'objspace.nofaking',
|
||||
'objspace.usemodules.amon', 'objspace.usemodules.sphynx',
|
||||
'objspace.usemodules.zephir', 'objspace.allworkingmodules',
|
||||
'objspace.translationmodules', 'objspace.geninterp',
|
||||
'objspace.logbytecodes', 'objspace.usepycfiles', 'objspace.lonepycfiles',
|
||||
'objspace.soabi', 'objspace.honor__builtins__',
|
||||
'objspace.disable_call_speedhacks', 'objspace.timing',
|
||||
'objspace.std.withtproxy', 'objspace.std.withsmallint',
|
||||
'objspace.std.withprebuiltint', 'objspace.std.prebuiltintfrom',
|
||||
'objspace.std.prebuiltintto', 'objspace.std.withstrjoin',
|
||||
'objspace.std.withstrslice', 'objspace.std.withstrbuf',
|
||||
'objspace.std.withprebuiltchar', 'objspace.std.sharesmallstr',
|
||||
'objspace.std.withrope', 'objspace.std.withropeunicode',
|
||||
'objspace.std.withcelldict', 'objspace.std.withdictmeasurement',
|
||||
'objspace.std.withmapdict', 'objspace.std.withrangelist',
|
||||
'objspace.std.withtypeversion', 'objspace.std.withmethodcache',
|
||||
'objspace.std.withmethodcachecounter', 'objspace.std.methodcachesizeexp',
|
||||
'objspace.std.optimized_int_add', 'objspace.std.optimized_comparison_op',
|
||||
'objspace.std.optimized_list_getitem', 'objspace.std.builtinshortcut',
|
||||
'objspace.std.getattributeshortcut', 'objspace.std.newshortcut',
|
||||
'objspace.std.logspaceoptypes', 'objspace.std.multimethods',
|
||||
'objspace.std.immutable_builtintypes']
|
||||
|
||||
assert config.getpaths(allpaths=True) == result
|
@ -1,207 +0,0 @@
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from config import *
|
||||
from option import *
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
def make_description_duplicates():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
## dummy 1
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
# dummy2 (same name)
|
||||
gcdummy2 = BoolOption('dummy', 'dummy2', default=True)
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, gcdummy2, floatoption])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
def test_identical_names():
|
||||
"""If in the schema (the option description) there is something that
|
||||
have the same name, an exection is raised
|
||||
"""
|
||||
descr = make_description_duplicates()
|
||||
raises(ConflictConfigError, "cfg = Config(descr)")
|
||||
|
||||
def make_description2():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
# first multi
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
boolop.enable_multi()
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
# second multi
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option.enable_multi()
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
# FIXME: XXX would you mind putting the multi validations anywhere else
|
||||
# than in the requires !!!
|
||||
#def test_multi_constraints():
|
||||
# "a multi in a constraint has to have the same length"
|
||||
# descr = make_description2()
|
||||
# cfg = Config(descr)
|
||||
# cfg.boolop = [True, True, False]
|
||||
# cfg.wantframework = [False, False, True]
|
||||
#
|
||||
#def test_multi_raise():
|
||||
# "a multi in a constraint has to have the same length"
|
||||
# # FIXME fusionner les deux tests, MAIS PROBLEME :
|
||||
# # il ne devrait pas etre necessaire de refaire une config
|
||||
# # si la valeur est modifiee une deuxieme fois ->
|
||||
# #raises(ConflictConfigError, "cfg.wantframework = [False, False, True]")
|
||||
# # ExceptionFailure: 'DID NOT RAISE'
|
||||
# descr = make_description2()
|
||||
# cfg = Config(descr)
|
||||
# cfg.boolop = [True]
|
||||
# raises(ConflictConfigError, "cfg.wantframework = [False, False, True]")
|
||||
# ____________________________________________________________
|
||||
# adding dynamically new options description schema
|
||||
def test_newoption_add_in_descr():
|
||||
descr = make_description()
|
||||
newoption = BoolOption('newoption', 'dummy twoo', default=False)
|
||||
descr.add_child(newoption)
|
||||
config = Config(descr)
|
||||
assert config.newoption == False
|
||||
|
||||
def test_newoption_add_in_subdescr():
|
||||
descr = make_description()
|
||||
newoption = BoolOption('newoption', 'dummy twoo', default=False)
|
||||
descr.gc.add_child(newoption)
|
||||
config = Config(descr, bool=False)
|
||||
assert config.gc.newoption == False
|
||||
|
||||
def test_newoption_add_in_config():
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
newoption = BoolOption('newoption', 'dummy twoo', default=False)
|
||||
descr.add_child(newoption)
|
||||
config.cfgimpl_update()
|
||||
assert config.newoption == False
|
||||
# ____________________________________________________________
|
||||
def make_description_requires():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
stroption = StrOption('str', 'Test string option', default="abc",
|
||||
requires=[('int', 1, 'hide')])
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption,
|
||||
stroption, intoption])
|
||||
return descr
|
||||
|
||||
def test_hidden_if_in():
|
||||
descr = make_description_requires()
|
||||
cfg = Config(descr)
|
||||
intoption = cfg.unwrap_from_path('int')
|
||||
stroption = cfg.unwrap_from_path('str')
|
||||
assert not stroption._is_hidden()
|
||||
cfg.int = 1
|
||||
raises(HiddenOptionError, "cfg.str")
|
||||
raises(HiddenOptionError, 'cfg.str= "uvw"')
|
||||
assert stroption._is_hidden()
|
||||
|
||||
def test_hidden_if_in_with_group():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption],
|
||||
requires=[('int', 1, 'hide')])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption,
|
||||
objspaceoption, stroption, intoption])
|
||||
cfg = Config(descr)
|
||||
assert not gcgroup._is_hidden()
|
||||
cfg.int = 1
|
||||
raises(HiddenOptionError, "cfg.gc.name")
|
||||
# raises(HiddenOptionError, 'cfg.gc= "uvw"')
|
||||
assert gcgroup._is_hidden()
|
||||
|
||||
def test_disabled_with_group():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption],
|
||||
requires=[('int', 1, 'disable')])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption,
|
||||
objspaceoption, stroption, intoption])
|
||||
cfg = Config(descr)
|
||||
assert not gcgroup._is_disabled()
|
||||
cfg.int = 1
|
||||
raises(DisabledOptionError, "cfg.gc.name")
|
||||
# raises(HiddenOptionError, 'cfg.gc= "uvw"')
|
||||
assert gcgroup._is_disabled()
|
||||
|
||||
|
@ -1,121 +0,0 @@
|
||||
"test all types of option default values for options, add new option in a descr"
|
||||
import autopath
|
||||
|
||||
from py.test import raises
|
||||
from config import *
|
||||
from option import *
|
||||
from error import MandatoryError
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
#____________________________________________________________
|
||||
# default values
|
||||
def test_default_is_none():
|
||||
"""
|
||||
Most constructors take a ``default`` argument that specifies the default
|
||||
value of the option. If this argument is not supplied the default value is
|
||||
assumed to be ``None``.
|
||||
"""
|
||||
dummy1 = BoolOption('dummy1', 'doc dummy')
|
||||
dummy2 = BoolOption('dummy2', 'doc dummy')
|
||||
group = OptionDescription('group', '', [dummy1, dummy2])
|
||||
config = Config(group)
|
||||
# so when the default value is not set, there is actually a default value
|
||||
assert config.dummy1 == None
|
||||
assert config.dummy2 == None
|
||||
|
||||
def test_set_defaut_value_from_option_object():
|
||||
"""Options have an available default setting and can give it back"""
|
||||
b = BoolOption("boolean", "", default=False)
|
||||
assert b.getdefault() == False
|
||||
|
||||
def test_mandatory():
|
||||
dummy1 = BoolOption('dummy1', 'doc dummy', mandatory=True)
|
||||
dummy2 = BoolOption('dummy2', 'doc dummy', mandatory=True)
|
||||
group = OptionDescription('group', '', [dummy1, dummy2])
|
||||
config = Config(group)
|
||||
# config.setoption('dummy1', True)
|
||||
raises(MandatoryError, 'config.dummy1')
|
||||
config.dummy1 = True
|
||||
assert config.dummy1 == True
|
||||
raises(MandatoryError, 'config.dummy2 == None')
|
||||
raises(MandatoryError, "config.override({'dummy2':None})")
|
||||
config.set(dummy2=True)
|
||||
config.dummy2 = False
|
||||
assert config.dummy2 == False
|
||||
|
||||
def test_override_are_defaults():
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
|
||||
config.gc.dummy = True
|
||||
assert config._cfgimpl_values['gc']._cfgimpl_value_owners['dummy'] == 'user'
|
||||
#Options have an available default setting and can give it back
|
||||
assert config._cfgimpl_descr._children[0]._children[1].getdefault() == False
|
||||
config.override({'gc.dummy':True})
|
||||
#assert config.gc.dummy == True
|
||||
#assert config._cfgimpl_descr._children[0]._children[1].getdefault() == True
|
||||
#assert config._cfgimpl_values['gc']._cfgimpl_value_owners['dummy'] == 'default'
|
||||
|
||||
def test_overrides_changes_option_value():
|
||||
"with config.override(), the default is changed and the value is changed"
|
||||
descr = OptionDescription("test", "", [
|
||||
BoolOption("b", "", default=False)])
|
||||
config = Config(descr)
|
||||
config.b = True
|
||||
config.override({'b': False})
|
||||
assert config.b == False
|
||||
#____________________________________________________________
|
||||
# test various option types
|
||||
def test_choice_with_no_default():
|
||||
descr = OptionDescription("test", "", [
|
||||
ChoiceOption("backend", "", ["c", "cli"])])
|
||||
config = Config(descr)
|
||||
assert config.backend is None
|
||||
config.backend = "c"
|
||||
|
||||
def test_choice_with_default():
|
||||
descr = OptionDescription("test", "", [
|
||||
ChoiceOption("backend", "", ["c", "cli"], default="cli")])
|
||||
config = Config(descr)
|
||||
assert config.backend == "cli"
|
||||
|
||||
def test_arbitrary_option():
|
||||
descr = OptionDescription("top", "", [
|
||||
ArbitraryOption("a", "no help", default=None)
|
||||
])
|
||||
config = Config(descr)
|
||||
config.a = []
|
||||
config.a.append(1)
|
||||
assert config.a == [1]
|
||||
|
||||
descr = OptionDescription("top", "", [
|
||||
ArbitraryOption("a", "no help", defaultfactory=list)
|
||||
])
|
||||
c1 = Config(descr)
|
||||
c2 = Config(descr)
|
||||
c1.a.append(1)
|
||||
assert c2.a == []
|
||||
assert c1.a == [1]
|
||||
|
@ -1,131 +0,0 @@
|
||||
import autopath
|
||||
|
||||
from py.test import raises
|
||||
from config import *
|
||||
from option import *
|
||||
from error import SpecialOwnersError
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', callback="toto")
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
def make_description2():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
def test_override_are_default_owner():
|
||||
"config.override() implies that the owner is 'default' again"
|
||||
descr = make_description2()
|
||||
config = Config(descr, bool=False)
|
||||
# default
|
||||
assert config.gc._cfgimpl_value_owners['dummy'] == 'default'
|
||||
# user
|
||||
config.gc.dummy = True
|
||||
assert config.gc._cfgimpl_value_owners['dummy'] == 'user'
|
||||
assert config._cfgimpl_values['gc']._cfgimpl_value_owners['dummy'] == 'user'
|
||||
#Options have an available default setting and can give it back
|
||||
assert config._cfgimpl_descr._children[0]._children[1].getdefault() == False
|
||||
config.override({'gc.dummy':True})
|
||||
assert config.gc._cfgimpl_value_owners['dummy'] == 'default'
|
||||
# user again
|
||||
config.gc.dummy = False
|
||||
assert config.gc._cfgimpl_value_owners['dummy'] == 'user'
|
||||
|
||||
def test_change_owner():
|
||||
descr = make_description()
|
||||
# here the owner is 'default'
|
||||
config = Config(descr, bool=False)
|
||||
# the default owner is 'user' (which is not 'default')
|
||||
# Still not getting it ? read the docs
|
||||
config.gc.dummy = True
|
||||
assert config.gc._cfgimpl_value_owners['dummy'] == 'user'
|
||||
# config.cfgimpl_set_owner('eggs')
|
||||
# config.set(dummy=False)
|
||||
# assert config.gc._cfgimpl_value_owners['dummy'] == 'eggs'
|
||||
# config.cfgimpl_set_owner('spam')
|
||||
# gcdummy = config.unwrap_from_path('gc.dummy')
|
||||
# gcdummy.setowner(config.gc, 'blabla')
|
||||
# assert config.gc._cfgimpl_value_owners['dummy'] == 'blabla'
|
||||
# config.gc.dummy = True
|
||||
# assert config.gc._cfgimpl_value_owners['dummy'] == 'spam'
|
||||
|
||||
#____________________________________________________________
|
||||
# special owners
|
||||
def test_auto_owner():
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
config.gc.setoption('dummy', True, 'auto')
|
||||
raises(HiddenOptionError, "config.gc.dummy")
|
||||
raises(ConflictConfigError, "config.gc.setoption('dummy', False, 'auto')")
|
||||
# shall return an auto value...
|
||||
#assert config.gc.dummy == 'auto_dummy_value'
|
||||
|
||||
def test_cannot_override_special_owners():
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
config.gc.setoption('dummy', True, 'auto')
|
||||
raises(SpecialOwnersError, "config.override({'gc.dummy': True})")
|
||||
|
||||
# FIXME have to test the fills anyway
|
||||
#def test_fill_owner():
|
||||
# "fill option"
|
||||
# descr = make_description()
|
||||
# config = Config(descr, bool=False)
|
||||
# assert config.bool == False
|
||||
# assert config.gc.dummy == False
|
||||
# # 'fill' special values
|
||||
# config.gc.setoption('dummy', True, 'fill')
|
||||
# assert config.gc.dummy == False
|
||||
|
||||
#def test_auto_fill_and_override():
|
||||
# descr = make_description()
|
||||
# config = Config(descr, bool=False)
|
||||
# booloption = config.unwrap_from_path('bool')
|
||||
# booloption.callback = 'identical'
|
||||
# booloption.setowner(config, 'auto')
|
||||
# assert config.bool == 'identicalbool'
|
||||
# gcdummy = config.unwrap_from_path('gc.dummy')
|
||||
# gcdummy.callback = 'identical'
|
||||
# gcdummy.setowner(config.gc, 'fill')
|
||||
# raises(SpecialOwnersError, "config.override({'gc.dummy':True})")
|
||||
# config.gc.setoption('dummy', False, 'fill')
|
||||
# # value is returned
|
||||
# assert config.gc.dummy == False
|
||||
|
||||
|
@ -1,420 +0,0 @@
|
||||
"config.set() or config.setoption() or option.setoption()"
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from config import *
|
||||
from option import *
|
||||
from error import *
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False)
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
#____________________________________________________________
|
||||
# change with __setattr__
|
||||
def test_attribute_access():
|
||||
"Once set, option values can't be changed again by attribute access"
|
||||
s = StrOption("string", "", default="string")
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
# let's try to change it again
|
||||
config.string = "foo"
|
||||
assert config.string == "foo"
|
||||
|
||||
def test_setitem():
|
||||
s = StrOption("string", "", default=["string", "sdfsdf"], default_multi="prout", multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
print config.string[1]
|
||||
config.string[1] = "titi"
|
||||
print config.string[1]
|
||||
|
||||
def test_reset():
|
||||
"if value is None, resets to default owner"
|
||||
s = StrOption("string", "", default="string")
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
config.string = "foo"
|
||||
assert config.string == "foo"
|
||||
assert config._cfgimpl_value_owners['string'] == 'user'
|
||||
config.string = None
|
||||
assert config.string == 'string'
|
||||
assert config._cfgimpl_value_owners['string'] == 'default'
|
||||
|
||||
def test_reset_with_multi():
|
||||
s = StrOption("string", "", default=["string"], default_multi="string" , multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
config.string = []
|
||||
assert config.string == ["string"]
|
||||
assert config._cfgimpl_value_owners['string'] == ['default']
|
||||
config.string = ["eggs", "spam", "foo"]
|
||||
assert config._cfgimpl_value_owners['string'] == ['user', 'user', 'user']
|
||||
config.string = []
|
||||
assert config.string == ["string"]
|
||||
assert config._cfgimpl_value_owners['string'] == ['default']
|
||||
raises(ConfigError, "config.string = None")
|
||||
|
||||
def test_default_with_multi():
|
||||
"default with multi is a list"
|
||||
s = StrOption("string", "", default=[], default_multi="string" , multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
assert config.string == []
|
||||
s = StrOption("string", "", default=None, default_multi="string" , multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
assert config.string == []
|
||||
|
||||
def test_idontexist():
|
||||
descr = make_description()
|
||||
cfg = Config(descr)
|
||||
raises(AttributeError, "cfg.idontexist")
|
||||
# ____________________________________________________________
|
||||
def test_attribute_access_with_multi():
|
||||
s = StrOption("string", "", default=["string"], default_multi= "string" , multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
config.string = ["foo", "bar"]
|
||||
assert config.string == ["foo", "bar"]
|
||||
|
||||
def test_item_access_with_multi():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
config.string = ["foo", "bar"]
|
||||
assert config.string == ["foo", "bar"]
|
||||
assert config.string[0] == "foo"
|
||||
# FIXME
|
||||
config.string[0] = 'changetest'
|
||||
# assert config.string[0] == 'changetest'
|
||||
# assert config.string[
|
||||
|
||||
def test_access_with_multi_default():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
assert config._cfgimpl_value_owners["string"] == ['default']
|
||||
config.string = ["foo", "bar"]
|
||||
assert config.string == ["foo", "bar"]
|
||||
assert config._cfgimpl_value_owners["string"] == ['user', 'user']
|
||||
|
||||
#def test_attribute_access_with_multi2():
|
||||
# s = StrOption("string", "", default="string", multi=True)
|
||||
# descr = OptionDescription("options", "", [s])
|
||||
# config = Config(descr)
|
||||
# config.string = ["foo", "bar"]
|
||||
# assert config.string == ["foo", "bar"]
|
||||
|
||||
def test_multi_with_requires():
|
||||
s = StrOption("string", "", default=["string"], default_multi="string", multi=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
stroption = StrOption('str', 'Test string option', default=["abc"], default_multi = "abc",
|
||||
requires=[('int', 1, 'hide')], multi=True)
|
||||
descr = OptionDescription("options", "", [s, intoption, stroption])
|
||||
config = Config(descr)
|
||||
assert stroption._is_hidden() == False
|
||||
config.int = 1
|
||||
raises(HiddenOptionError, "config.str = ['a', 'b']")
|
||||
assert stroption._is_hidden()
|
||||
|
||||
def test__requires_with_inverted():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
stroption = StrOption('str', 'Test string option', default=["abc"], default_multi = "abc",
|
||||
requires=[('int', 1, 'hide', 'inverted')], multi=True)
|
||||
descr = OptionDescription("options", "", [s, intoption, stroption])
|
||||
config = Config(descr)
|
||||
assert stroption._is_hidden() == False
|
||||
config.int = 1
|
||||
assert stroption._is_hidden() == False
|
||||
|
||||
def test_multi_with_requires_in_another_group():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
descr = OptionDescription("options", "", [intoption])
|
||||
stroption = StrOption('str', 'Test string option', default=["abc"],
|
||||
requires=[('int', 1, 'hide')], multi=True)
|
||||
descr = OptionDescription("opt", "", [stroption])
|
||||
descr2 = OptionDescription("opt2", "", [intoption, s, descr])
|
||||
config = Config(descr2)
|
||||
assert stroption._is_hidden() == False
|
||||
config.int = 1
|
||||
raises(HiddenOptionError, "config.opt.str = ['a', 'b']")
|
||||
assert stroption._is_hidden()
|
||||
|
||||
def test_apply_requires_from_config():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
descr = OptionDescription("options", "", [intoption])
|
||||
stroption = StrOption('str', 'Test string option', default=["abc"],
|
||||
requires=[('int', 1, 'hide')], multi=True)
|
||||
descr = OptionDescription("opt", "", [stroption])
|
||||
descr2 = OptionDescription("opt2", "", [intoption, s, descr])
|
||||
config = Config(descr2)
|
||||
assert stroption._is_hidden() == False
|
||||
config.int = 1
|
||||
try:
|
||||
config.opt.str
|
||||
except:
|
||||
pass
|
||||
assert stroption._is_hidden()
|
||||
|
||||
|
||||
def test_apply_requires_with_disabled():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
descr = OptionDescription("options", "", [intoption])
|
||||
stroption = StrOption('str', 'Test string option', default=["abc"],
|
||||
requires=[('int', 1, 'disable')], multi=True)
|
||||
descr = OptionDescription("opt", "", [stroption])
|
||||
descr2 = OptionDescription("opt2", "", [intoption, s, descr])
|
||||
config = Config(descr2)
|
||||
assert stroption._is_disabled() == False
|
||||
config.int = 1
|
||||
try:
|
||||
config.opt.str
|
||||
except:
|
||||
pass
|
||||
assert stroption._is_disabled()
|
||||
|
||||
def test_multi_with_requires_with_disabled_in_another_group():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
descr = OptionDescription("options", "", [intoption])
|
||||
stroption = StrOption('str', 'Test string option', default=["abc"],
|
||||
requires=[('int', 1, 'disable')], multi=True)
|
||||
descr = OptionDescription("opt", "", [stroption])
|
||||
descr2 = OptionDescription("opt2", "", [intoption, s, descr])
|
||||
config = Config(descr2)
|
||||
assert stroption._is_disabled() == False
|
||||
config.int = 1
|
||||
raises(DisabledOptionError, "config.opt.str = ['a', 'b']")
|
||||
assert stroption._is_disabled()
|
||||
|
||||
def test_multi_with_requires_that_is_multi():
|
||||
s = StrOption("string", "", default=["string"], multi=True)
|
||||
intoption = IntOption('int', 'Test int option', default=[0], multi=True)
|
||||
stroption = StrOption('str', 'Test string option', default=["abc"],
|
||||
requires=[('int', [1, 1], 'hide')], multi=True)
|
||||
descr = OptionDescription("options", "", [s, intoption, stroption])
|
||||
config = Config(descr)
|
||||
assert stroption._is_hidden() == False
|
||||
config.int = [1, 1]
|
||||
raises(HiddenOptionError, "config.str = ['a', 'b']")
|
||||
assert stroption._is_hidden()
|
||||
|
||||
def test_multi_with_bool():
|
||||
s = BoolOption("bool", "", default=[False], multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
assert descr.bool.multi == True
|
||||
config.bool = [True, False]
|
||||
assert config._cfgimpl_values['bool'] == [True, False]
|
||||
assert config.bool == [True, False]
|
||||
|
||||
def test_multi_with_bool_two():
|
||||
s = BoolOption("bool", "", default=[False], multi=True)
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
assert descr.bool.multi == True
|
||||
raises(ConfigError, "config.bool = True")
|
||||
|
||||
def test_choice_access_with_multi():
|
||||
ch = ChoiceOption("t1", "", ["a", "b"], default=["a"], multi=True)
|
||||
descr = OptionDescription("options", "", [ch])
|
||||
config = Config(descr)
|
||||
config.t1 = ["a", "b", "a", "b"]
|
||||
assert config.t1 == ["a", "b", "a", "b"]
|
||||
# ____________________________________________________________
|
||||
|
||||
def test_setoption_from_option():
|
||||
"a setoption directly from the option is **not** a good practice"
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
descr = OptionDescription('descr', '', [booloption])
|
||||
cfg = Config(descr)
|
||||
booloption.setoption(cfg, False, 'owner')
|
||||
assert cfg.bool == False
|
||||
# ____________________________________________________________
|
||||
def test_set_mode_in_config():
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True,
|
||||
mode='expert')
|
||||
descr = OptionDescription('descr', '', [booloption])
|
||||
cfg = Config(descr)
|
||||
cfg.cfgimpl_set_mode('expert')
|
||||
raises(ModeOptionError, "cfg.bool")
|
||||
cfg.cfgimpl_set_mode('normal')
|
||||
assert cfg.bool == True
|
||||
#____________________________________________________________
|
||||
def test_dwim_set():
|
||||
descr = OptionDescription("opt", "", [
|
||||
OptionDescription("sub", "", [
|
||||
BoolOption("b1", ""),
|
||||
ChoiceOption("c1", "", ['a', 'b', 'c'], 'a'),
|
||||
BoolOption("d1", ""),
|
||||
]),
|
||||
BoolOption("b2", ""),
|
||||
BoolOption("d1", ""),
|
||||
])
|
||||
c = Config(descr)
|
||||
c.set(b1=False, c1='b')
|
||||
assert not c.sub.b1
|
||||
assert c.sub.c1 == 'b'
|
||||
# new config, because you cannot change values once they are set
|
||||
c = Config(descr)
|
||||
c.set(b2=False, **{'sub.c1': 'c'})
|
||||
assert not c.b2
|
||||
assert c.sub.c1 == 'c'
|
||||
raises(AmbigousOptionError, "c.set(d1=True)")
|
||||
raises(NoMatchingOptionFound, "c.set(unknown='foo')")
|
||||
|
||||
def test_more_set():
|
||||
descr = OptionDescription("opt", "", [
|
||||
OptionDescription("s1", "", [
|
||||
BoolOption("a", "", default=False)]),
|
||||
IntOption("int", "", default=42)])
|
||||
d = {'s1.a': True, 'int': 23}
|
||||
config = Config(descr)
|
||||
config.set(**d)
|
||||
assert config.s1.a
|
||||
assert config.int == 23
|
||||
|
||||
def test_set_with_hidden_option():
|
||||
boolopt = BoolOption("a", "", default=False)
|
||||
boolopt.hide()
|
||||
descr = OptionDescription("opt", "", [
|
||||
OptionDescription("s1", "", [boolopt]),
|
||||
IntOption("int", "", default=42)])
|
||||
d = {'s1.a': True, 'int': 23}
|
||||
config = Config(descr)
|
||||
raises(HiddenOptionError, "config.set(**d)")
|
||||
|
||||
def test_set_with_unknown_option():
|
||||
boolopt = BoolOption("b", "", default=False)
|
||||
descr = OptionDescription("opt", "", [
|
||||
OptionDescription("s1", "", [boolopt]),
|
||||
IntOption("int", "", default=42)])
|
||||
d = {'s1.a': True, 'int': 23}
|
||||
config = Config(descr)
|
||||
raises(NoMatchingOptionFound, "config.set(**d)")
|
||||
|
||||
|
||||
def test_set_symlink_option():
|
||||
boolopt = BoolOption("b", "", default=False)
|
||||
linkopt = SymLinkOption("c", "s1.b")
|
||||
descr = OptionDescription("opt", "",
|
||||
[linkopt, OptionDescription("s1", "", [boolopt])])
|
||||
config = Config(descr)
|
||||
setattr(config, "s1.b", True)
|
||||
setattr(config, "s1.b", False)
|
||||
assert config.s1.b == False
|
||||
assert config.c == False
|
||||
config.c = True
|
||||
assert config.s1.b == True
|
||||
assert config.c == True
|
||||
config.c = False
|
||||
assert config.s1.b == False
|
||||
assert config.c == False
|
||||
|
||||
#____________________________________________________________
|
||||
def test_config_impl_values():
|
||||
descr = make_description()
|
||||
config = Config(descr, bool=False)
|
||||
# gcdummy.setoption(config, True, "user")
|
||||
# config.setoption("gc.dummy", True, "user")
|
||||
#config.gc.dummy = True
|
||||
# config.setoption("bool", False, "user")
|
||||
config.set(dummy=False)
|
||||
assert config.gc._cfgimpl_values == {'dummy': False, 'float': 2.3, 'name': 'ref'}
|
||||
## acces to the option object
|
||||
# config.gc._cfgimpl_descr.dummy.setoption(config, True, "user")
|
||||
assert config.gc.dummy == False
|
||||
# config.set(dummy=True)
|
||||
# assert config.gc.dummy == True
|
||||
|
||||
#____________________________________________________________
|
||||
def test_accepts_multiple_changes_from_option():
|
||||
s = StrOption("string", "", default="string")
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
config.string = "egg"
|
||||
assert s.getdefault() == "string"
|
||||
assert config.string == "egg"
|
||||
s.setoption(config, 'blah', "default")
|
||||
assert s.getdefault() == "blah"
|
||||
assert config.string == "blah"
|
||||
s.setoption(config, 'bol', "user")
|
||||
assert config.string == 'bol'
|
||||
config.override({'string': "blurp"})
|
||||
assert config.string == 'blurp'
|
||||
assert s.getdefault() == 'blurp'
|
||||
|
||||
def test_allow_multiple_changes_from_config():
|
||||
"""
|
||||
a `setoption` from the config object is much like the attribute access,
|
||||
except the fact that value owner can bet set
|
||||
"""
|
||||
s = StrOption("string", "", default="string")
|
||||
s2 = StrOption("string2", "", default="string")
|
||||
suboption = OptionDescription("bip", "", [s2])
|
||||
descr = OptionDescription("options", "", [s, suboption])
|
||||
config = Config(descr)
|
||||
config.setoption("string", 'blah', "user")
|
||||
config.setoption("string", "oh", "user")
|
||||
assert config.string == "oh"
|
||||
config.set(string2= 'blah')
|
||||
assert config.bip.string2 == 'blah'
|
||||
# ____________________________________________________________
|
||||
|
||||
def test_overrides_are_defaults():
|
||||
descr = OptionDescription("test", "", [
|
||||
BoolOption("b1", "", default=False),
|
||||
BoolOption("b2", "", default=False),
|
||||
])
|
||||
# overrides here
|
||||
config = Config(descr, b2=True)
|
||||
assert config.b2
|
||||
# test with a require
|
||||
config.b1 = True
|
||||
assert config.b2
|
||||
|
||||
# ____________________________________________________________
|
||||
# accessing a value by the get method
|
||||
def test_access_by_get():
|
||||
descr = make_description()
|
||||
cfg = Config(descr)
|
||||
raises(NotFoundError, "cfg.get('idontexist')" )
|
||||
assert cfg.get('wantref') == False
|
||||
assert cfg.gc.dummy == False
|
||||
assert cfg.get('dummy') == False
|
||||
|
||||
def test_access_by_get_whith_hide():
|
||||
b1 = BoolOption("b1", "")
|
||||
b1.hide()
|
||||
descr = OptionDescription("opt", "", [
|
||||
OptionDescription("sub", "", [
|
||||
b1,
|
||||
ChoiceOption("c1", "", ['a', 'b', 'c'], 'a'),
|
||||
BoolOption("d1", ""),
|
||||
]),
|
||||
BoolOption("b2", ""),
|
||||
BoolOption("d1", ""),
|
||||
])
|
||||
c = Config(descr)
|
||||
raises(HiddenOptionError, "c.get('b1')")
|
||||
|
@ -1,141 +0,0 @@
|
||||
# coding: utf-8
|
||||
"frozen and hidden values"
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from config import *
|
||||
from option import *
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcoption.set_mode("expert")
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
# hidding dummy here
|
||||
gcdummy.hide()
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=[('gc.name', 'ref')])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=[('gc.name', 'framework')])
|
||||
|
||||
# ____________________________________________________________
|
||||
booloptiontwo = BoolOption('booltwo', 'Test boolean option two', default=False)
|
||||
subgroup = OptionDescription('subgroup', '', [booloptiontwo])
|
||||
# ____________________________________________________________
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [subgroup, gcoption, gcdummy, floatoption])
|
||||
gcgroup.set_mode("expert")
|
||||
descr = OptionDescription('trs', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption])
|
||||
return descr
|
||||
#____________________________________________________________
|
||||
#freeze
|
||||
def make_description_freeze():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=['boolop'])
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=['boolop'])
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
def test_freeze_one_option():
|
||||
"freeze an option "
|
||||
descr = make_description_freeze()
|
||||
conf = Config(descr)
|
||||
#freeze only one option
|
||||
conf.gc._cfgimpl_descr.dummy.freeze()
|
||||
assert conf.gc.dummy == False
|
||||
raises(TypeError, "conf.gc.dummy = True")
|
||||
|
||||
def test_frozen_value():
|
||||
"setattr a frozen value at the config level"
|
||||
s = StrOption("string", "", default="string")
|
||||
descr = OptionDescription("options", "", [s])
|
||||
config = Config(descr)
|
||||
s.freeze()
|
||||
raises(ConfigError, 'config.string = "egg"')
|
||||
|
||||
def test_freeze():
|
||||
"freeze a whole configuration object"
|
||||
descr = make_description()
|
||||
conf = Config(descr)
|
||||
conf.cfgimpl_freeze()
|
||||
raises(ConfigError, "conf.gc.name = 'try to modify'")
|
||||
# ____________________________________________________________
|
||||
def test_is_hidden():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
assert config.gc._cfgimpl_descr.dummy._is_hidden() == True
|
||||
# setattr
|
||||
raises(HiddenOptionError, "config.gc.dummy == False")
|
||||
# getattr
|
||||
raises(HiddenOptionError, "config.gc.dummy")
|
||||
# I want to access to this option anyway
|
||||
path = 'gc.dummy'
|
||||
homeconfig, name = config._cfgimpl_get_home_by_path(path)
|
||||
assert homeconfig._cfgimpl_values[name] == False
|
||||
|
||||
def test_group_is_hidden():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
gc = config.unwrap_from_path('gc')
|
||||
gc.hide()
|
||||
dummy = config.unwrap_from_path('gc.dummy')
|
||||
raises(HiddenOptionError, "config.gc.dummy")
|
||||
assert gc._is_hidden()
|
||||
raises(HiddenOptionError, "config.gc.float")
|
||||
# manually set the subconfigs to "show"
|
||||
gc.show()
|
||||
assert gc._is_hidden() == False
|
||||
assert config.gc.float == 2.3
|
||||
#dummy est en hide
|
||||
raises(HiddenOptionError, "config.gc.dummy == False")
|
||||
|
||||
def test_global_show():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
assert config.gc._cfgimpl_descr.dummy._is_hidden() == True
|
||||
raises(HiddenOptionError, "config.gc.dummy == False")
|
||||
|
||||
def test_with_many_subgroups():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
assert config.gc.subgroup._cfgimpl_descr.booltwo._is_hidden() == False
|
||||
assert config.gc.subgroup.booltwo == False
|
||||
config.gc.subgroup._cfgimpl_descr.booltwo.hide()
|
||||
path = 'gc.subgroup.booltwo'
|
||||
homeconfig, name = config._cfgimpl_get_home_by_path(path)
|
||||
assert name == "booltwo"
|
||||
option = getattr(homeconfig._cfgimpl_descr, name)
|
||||
assert option._is_hidden()
|
||||
|
||||
def test_option_mode():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
assert config.gc._cfgimpl_descr.name.get_mode() == 'expert'
|
||||
assert config._cfgimpl_descr.gc.get_mode() == 'expert'
|
||||
|
@ -1,47 +0,0 @@
|
||||
#this test is much more to test that **it's there** and answers attribute access
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from config import *
|
||||
from option import *
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
gcdummy2 = BoolOption('hide', 'dummy', default=True)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
['std', 'thunk'], 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False)
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption, gcdummy2])
|
||||
descr = OptionDescription('tiram', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
def test_base_config_and_groups():
|
||||
descr = make_description()
|
||||
# overrides the booloption default value
|
||||
config = Config(descr, bool=False)
|
||||
assert config.gc.hide == True
|
||||
|
||||
def test_root_config_answers_ok():
|
||||
"if you hide the root config, the options in this namespace behave normally"
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
descr = OptionDescription('tiramisu', '', [gcdummy, boolop])
|
||||
cfg = Config(descr)
|
||||
cfg.cfgimpl_hide()
|
||||
assert cfg.dummy == False
|
||||
assert cfg.boolop == True
|
||||
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
# coding: utf-8
|
||||
import autopath
|
||||
from config import *
|
||||
from option import *
|
||||
|
||||
def make_description():
|
||||
numero_etab = StrOption('numero_etab', "identifiant de l'établissement")
|
||||
nom_machine = StrOption('nom_machine', "nom de la machine", default="eoleng")
|
||||
nombre_interfaces = IntOption('nombre_interfaces', "nombre d'interfaces à activer",
|
||||
default=1)
|
||||
activer_proxy_client = BoolOption('activer_proxy_client', "utiliser un proxy",
|
||||
default=False)
|
||||
mode_conteneur_actif = BoolOption('mode_conteneur_actif', "le serveur est en mode conteneur",
|
||||
default=False)
|
||||
# hidden (variable cachée)
|
||||
# mode_conteneur_actif.taint()
|
||||
adresse_serveur_ntp = StrOption('serveur_ntp', "adresse serveur ntp", multi=True)
|
||||
time_zone = ChoiceOption('time_zone', 'fuseau horaire du serveur',
|
||||
['Paris', 'Londres'], 'Paris')
|
||||
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé")
|
||||
netmask_admin_eth0 = StrOption('netmask_admin_eth0', "masque du sous-réseau")
|
||||
|
||||
master = OptionDescription('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
|
||||
interface1 = OptionDescription('interface1', '', [master])
|
||||
interface1.set_group_type('group')
|
||||
|
||||
general = OptionDescription('general', '', [numero_etab, nom_machine,
|
||||
nombre_interfaces, activer_proxy_client,
|
||||
mode_conteneur_actif, adresse_serveur_ntp,
|
||||
time_zone])
|
||||
general.set_group_type('family')
|
||||
creole = OptionDescription('creole', 'first tiramisu configuration', [general, interface1])
|
||||
descr = OptionDescription('baseconfig', 'baseconifgdescr', [creole] )
|
||||
return descr
|
||||
|
||||
def test_base_config():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
assert config.creole.general.activer_proxy_client == False
|
||||
assert config.creole.general.nom_machine == "eoleng"
|
||||
assert config.get('nom_machine') == "eoleng"
|
||||
result = {'general.numero_etab': None, 'general.nombre_interfaces': 1,
|
||||
'general.serveur_ntp': [], 'interface1.ip_admin_eth0.ip_admin_eth0': None,
|
||||
'general.mode_conteneur_actif': False, 'general.time_zone': 'Paris',
|
||||
'interface1.ip_admin_eth0.netmask_admin_eth0': None, 'general.nom_machine':
|
||||
'eoleng', 'general.activer_proxy_client': False}
|
||||
assert make_dict(config.creole) == result
|
||||
result = {'serveur_ntp': [], 'mode_conteneur_actif': False,
|
||||
'ip_admin_eth0': None, 'time_zone': 'Paris', 'numero_etab': None,
|
||||
'netmask_admin_eth0': None, 'nom_machine': 'eoleng', 'activer_proxy_client':
|
||||
False, 'nombre_interfaces': 1}
|
||||
assert make_dict(config.creole, flatten=True) == result
|
||||
|
||||
def test_get_group_type():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
grp = config.unwrap_from_path('creole.general')
|
||||
assert grp.get_group_type() == "family"
|
||||
|
||||
def test_iter_on_groups():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
result = list(config.creole.iter_groups(group_type= "family"))
|
||||
group_names = [res[0] for res in result]
|
||||
assert group_names == ['general']
|
||||
result = list(config.creole.iter_groups())
|
||||
group_names = [res[0] for res in result]
|
||||
assert group_names == ['general', 'interface1']
|
||||
|
@ -1,42 +0,0 @@
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from tool import reverse_from_paths
|
||||
|
||||
#def make_description():
|
||||
# gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
# gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
# objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
# ['std', 'thunk'], 'std')
|
||||
# booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
# intoption = IntOption('int', 'Test int option', default=0)
|
||||
# floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
# stroption = StrOption('str', 'Test string option', default="abc")
|
||||
# boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
# wantref_option = BoolOption('wantref', 'Test requires', default=False)
|
||||
# wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
# default=False)
|
||||
#
|
||||
# gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||
# descr = OptionDescription('tiram', '', [gcgroup, booloption, objspaceoption,
|
||||
# wantref_option, stroption,
|
||||
# wantframework_option,
|
||||
# intoption, boolop])
|
||||
# return descr
|
||||
|
||||
def test_rebuild():
|
||||
# pouvoir faire une comparaison avec equal
|
||||
d = {"s1.s2.s3.s4.a": True, "int": 43, "s2.b":True, "s3.c": True, "s3.d":[1,2,3]}
|
||||
cfg = reverse_from_paths(d)
|
||||
assert cfg.s1.s2.s3.s4.a == True
|
||||
assert cfg.int == 43
|
||||
assert cfg.s2.b == True
|
||||
assert cfg.s3.c == True
|
||||
assert cfg.s3.d == [1,2,3]
|
||||
|
||||
# assert config.getpaths() == ['gc.name', 'gc.dummy', 'gc.float', 'bool',
|
||||
# 'objspace', 'wantref', 'str', 'wantframework',
|
||||
# 'int', 'boolop']
|
||||
|
||||
# assert config.getpaths(include_groups=False) == ['gc.name', 'gc.dummy', 'gc.float', 'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
||||
# assert config.getpaths(include_groups=True) == ['gc', 'gc.name', 'gc.dummy', 'gc.float', 'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int', 'boolop']
|
@ -1,26 +0,0 @@
|
||||
#this test is much more to test that **it's there** and answers attribute access
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from tool import extend
|
||||
|
||||
class A:
|
||||
a = 'titi'
|
||||
def tarte(self):
|
||||
return "tart"
|
||||
class B:
|
||||
__metaclass__ = extend
|
||||
|
||||
def to_rst(self):
|
||||
return "hello"
|
||||
|
||||
B.extend(A)
|
||||
|
||||
a = B()
|
||||
|
||||
def test_extendable():
|
||||
assert a.a == 'titi'
|
||||
assert a.tarte() == 'tart'
|
||||
assert a.to_rst() == "hello"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user