Compare commits
15 Commits
pkg/dev/ri
...
54df7aca12
Author | SHA1 | Date | |
---|---|---|---|
54df7aca12 | |||
ccc6924866 | |||
6c6746c58f | |||
08ed28fc95 | |||
afdc19887f | |||
0e08757e22 | |||
90bd72de69 | |||
80b7f1b083 | |||
7d42517430 | |||
d18906e011 | |||
62bccfc352 | |||
7db3e2c2a9 | |||
3ad1bf0604 | |||
d5129d6fe7 | |||
6bda645903 |
662
debian/agpl-3
vendored
662
debian/agpl-3
vendored
@ -1,662 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are 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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
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 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 work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
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 AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
|||||||
11
|
|
14
debian/control
vendored
14
debian/control
vendored
@ -1,14 +0,0 @@
|
|||||||
Source: rougail
|
|
||||||
Section: admin
|
|
||||||
Priority: extra
|
|
||||||
Maintainer: Cadoles <contact@cadoles.com>
|
|
||||||
Build-depends: debhelper (>=11), python3-all, python3-setuptools, dh-python
|
|
||||||
Standards-Version: 3.9.4
|
|
||||||
Homepage: https://forge.cadoles.com/Infra/rougail
|
|
||||||
|
|
||||||
Package: python3-rougail
|
|
||||||
Architecture: any
|
|
||||||
Pre-Depends: dpkg, python3, ${misc:Pre-Depends}
|
|
||||||
Depends: ${python:Depends}, ${misc:Depends}, python3-cheetah, python3-tiramisu3
|
|
||||||
Description: configuration manager
|
|
||||||
|
|
22
debian/copyright
vendored
22
debian/copyright
vendored
@ -1,22 +0,0 @@
|
|||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
||||||
Upstream-Name: risotto
|
|
||||||
Upstream-Contact: Cadoles <contact@cadoles.com>
|
|
||||||
Source: https://forge.cadoles.com/Infra/rougail
|
|
||||||
|
|
||||||
Files: *
|
|
||||||
Copyright: 2019-2020 Cadoles <contact@cadoles.com>
|
|
||||||
License: AGPL-3+
|
|
||||||
|
|
||||||
License: AGPL-3+
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
||||||
.
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
3
debian/rougail.dirs
vendored
3
debian/rougail.dirs
vendored
@ -1,3 +0,0 @@
|
|||||||
/var/rougail/patches
|
|
||||||
/var/rougail/templates
|
|
||||||
/var/rougail/manifests
|
|
10
debian/rules
vendored
10
debian/rules
vendored
@ -1,10 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
# See debhelper(7) (uncomment to enable)
|
|
||||||
# output every command that modifies files on the build system.
|
|
||||||
#DH_VERBOSE = 1
|
|
||||||
|
|
||||||
export PYBUILD_NAME = rougail
|
|
||||||
export PYBUILD_DISABLE_python3 = test
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@ --with python3 --buildsystem=pybuild
|
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
|||||||
3.0 (quilt)
|
|
@ -1,5 +1,5 @@
|
|||||||
#from .loader import load
|
#from .loader import load
|
||||||
from .objspace import CreoleObjSpace
|
from .objspace import RougailObjSpace
|
||||||
from .annotator import modes
|
from .annotator import modes
|
||||||
|
|
||||||
__ALL__ = ('CreoleObjSpace', 'modes')
|
__ALL__ = ('RougailObjSpace', 'modes')
|
||||||
|
@ -5,7 +5,7 @@ from typing import List
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from os.path import join, basename
|
from os.path import join, basename
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
|
|
||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
@ -34,6 +34,33 @@ def mode_factory():
|
|||||||
modes = mode_factory()
|
modes = mode_factory()
|
||||||
|
|
||||||
|
|
||||||
|
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
|
'float': dict(opttype="FloatOption", func=float),
|
||||||
|
'choice': dict(opttype="ChoiceOption"),
|
||||||
|
'string': dict(opttype="StrOption"),
|
||||||
|
'password': dict(opttype="PasswordOption"),
|
||||||
|
'mail': dict(opttype="EmailOption"),
|
||||||
|
'boolean': dict(opttype="BoolOption"),
|
||||||
|
'symlink': dict(opttype="SymLinkOption"),
|
||||||
|
'filename': dict(opttype="FilenameOption"),
|
||||||
|
'date': dict(opttype="DateOption"),
|
||||||
|
'unix_user': dict(opttype="UsernameOption"),
|
||||||
|
'ip': dict(opttype="IPOption", initkwargs={'allow_reserved': True}),
|
||||||
|
'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, 'warnings_only': True}),
|
||||||
|
'netmask': dict(opttype="NetmaskOption"),
|
||||||
|
'network': dict(opttype="NetworkOption"),
|
||||||
|
'broadcast': dict(opttype="BroadcastOption"),
|
||||||
|
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}),
|
||||||
|
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}),
|
||||||
|
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}),
|
||||||
|
'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}),
|
||||||
|
'port': dict(opttype="PortOption", initkwargs={'allow_private': True}),
|
||||||
|
'mac': dict(opttype="MACOption"),
|
||||||
|
'cidr': dict(opttype="IPOption", initkwargs={'cidr': True}),
|
||||||
|
'network_cidr': dict(opttype="NetworkOption", initkwargs={'cidr': True}),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# a CreoleObjSpace's attribute has some annotations
|
# a CreoleObjSpace's attribute has some annotations
|
||||||
# that shall not be present in the exported (flatened) XML
|
# that shall not be present in the exported (flatened) XML
|
||||||
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
||||||
@ -56,8 +83,6 @@ KEY_TYPE = {'variable': 'symlink',
|
|||||||
'URLOption': 'web_address',
|
'URLOption': 'web_address',
|
||||||
'FilenameOption': 'filename'}
|
'FilenameOption': 'filename'}
|
||||||
|
|
||||||
CONVERSION = {'number': int}
|
|
||||||
|
|
||||||
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie'
|
||||||
|
|
||||||
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
PROPERTIES = ('hidden', 'frozen', 'auto_freeze', 'auto_save', 'force_default_on_freeze',
|
||||||
@ -108,7 +133,7 @@ class GroupAnnotator:
|
|||||||
self.manage_follower(namespace,
|
self.manage_follower(namespace,
|
||||||
leader_family_name,
|
leader_family_name,
|
||||||
variable,
|
variable,
|
||||||
leader_name,
|
leadership_name,
|
||||||
follower_names,
|
follower_names,
|
||||||
leader_space,
|
leader_space,
|
||||||
leader_is_hidden,
|
leader_is_hidden,
|
||||||
@ -126,8 +151,13 @@ class GroupAnnotator:
|
|||||||
# leader_is_hidden = True
|
# leader_is_hidden = True
|
||||||
else:
|
else:
|
||||||
leader_space = self.objectspace.Leadership(variable.xmlfiles)
|
leader_space = self.objectspace.Leadership(variable.xmlfiles)
|
||||||
|
if hasattr(group, 'name'):
|
||||||
|
leadership_name = group.name
|
||||||
|
else:
|
||||||
|
leadership_name = leader_name
|
||||||
leader_is_hidden = self.manage_leader(leader_space,
|
leader_is_hidden = self.manage_leader(leader_space,
|
||||||
leader_family_name,
|
leader_family_name,
|
||||||
|
leadership_name,
|
||||||
leader_name,
|
leader_name,
|
||||||
namespace,
|
namespace,
|
||||||
variable,
|
variable,
|
||||||
@ -136,12 +166,13 @@ class GroupAnnotator:
|
|||||||
)
|
)
|
||||||
has_a_leader = True
|
has_a_leader = True
|
||||||
else:
|
else:
|
||||||
raise DictConsistencyError(_('cannot found followers {}').format(follower_names))
|
raise DictConsistencyError(_('cannot found followers "{}"').format('", "'.join(follower_names)))
|
||||||
del self.objectspace.space.constraints.group
|
del self.objectspace.space.constraints.group
|
||||||
|
|
||||||
def manage_leader(self,
|
def manage_leader(self,
|
||||||
leader_space: 'Leadership',
|
leader_space: 'Leadership',
|
||||||
leader_family_name: str,
|
leader_family_name: str,
|
||||||
|
leadership_name: str,
|
||||||
leader_name: str,
|
leader_name: str,
|
||||||
namespace: str,
|
namespace: str,
|
||||||
variable: 'Variable',
|
variable: 'Variable',
|
||||||
@ -152,7 +183,7 @@ class GroupAnnotator:
|
|||||||
if variable.multi is not True:
|
if variable.multi is not True:
|
||||||
raise DictConsistencyError(_('the variable {} in a group must be multi').format(variable.name))
|
raise DictConsistencyError(_('the variable {} in a group must be multi').format(variable.name))
|
||||||
leader_space.variable = []
|
leader_space.variable = []
|
||||||
leader_space.name = leader_name
|
leader_space.name = leadership_name
|
||||||
leader_space.hidden = variable.hidden
|
leader_space.hidden = variable.hidden
|
||||||
if variable.hidden:
|
if variable.hidden:
|
||||||
leader_is_hidden = True
|
leader_is_hidden = True
|
||||||
@ -167,9 +198,9 @@ class GroupAnnotator:
|
|||||||
leader_space.doc = variable.description
|
leader_space.doc = variable.description
|
||||||
else:
|
else:
|
||||||
leader_space.doc = variable.name
|
leader_space.doc = variable.name
|
||||||
leader_path = namespace + '.' + leader_family_name + '.' + leader_name
|
leadership_path = namespace + '.' + leader_family_name + '.' + leadership_name
|
||||||
self.objectspace.paths.add_family(namespace,
|
self.objectspace.paths.add_family(namespace,
|
||||||
leader_path,
|
leadership_path,
|
||||||
leader_space,
|
leader_space,
|
||||||
)
|
)
|
||||||
leader_family = self.objectspace.space.variables[namespace].family[leader_family_name]
|
leader_family = self.objectspace.space.variables[namespace].family[leader_family_name]
|
||||||
@ -433,8 +464,7 @@ class ServiceAnnotator:
|
|||||||
if not hasattr(file_, 'source'):
|
if not hasattr(file_, 'source'):
|
||||||
file_.source = basename(file_.name)
|
file_.source = basename(file_.name)
|
||||||
elif not hasattr(file_, 'source'):
|
elif not hasattr(file_, 'source'):
|
||||||
raise DictConsistencyError(_('attribute source mandatory for file with variable name '
|
raise DictConsistencyError(_('attribute source mandatory for file with variable name for {}').format(file_.name))
|
||||||
'for {}').format(file_.name))
|
|
||||||
|
|
||||||
|
|
||||||
class VariableAnnotator:
|
class VariableAnnotator:
|
||||||
@ -443,7 +473,6 @@ class VariableAnnotator:
|
|||||||
):
|
):
|
||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
self.convert_variable()
|
self.convert_variable()
|
||||||
self.convert_helps()
|
|
||||||
self.convert_auto_freeze()
|
self.convert_auto_freeze()
|
||||||
self.convert_separators()
|
self.convert_separators()
|
||||||
|
|
||||||
@ -459,7 +488,7 @@ class VariableAnnotator:
|
|||||||
for value in variable.value:
|
for value in variable.value:
|
||||||
if not hasattr(value, 'type'):
|
if not hasattr(value, 'type'):
|
||||||
value.type = variable.type
|
value.type = variable.type
|
||||||
value.name = CONVERSION.get(value.type, str)(value.name)
|
value.name = CONVERT_OPTION.get(value.type, {}).get('func', str)(value.name)
|
||||||
for key, value in RENAME_ATTIBUTES.items():
|
for key, value in RENAME_ATTIBUTES.items():
|
||||||
setattr(variable, value, getattr(variable, key))
|
setattr(variable, value, getattr(variable, key))
|
||||||
setattr(variable, key, None)
|
setattr(variable, key, None)
|
||||||
@ -491,6 +520,11 @@ class VariableAnnotator:
|
|||||||
self.objectspace.space.constraints.check.append(check)
|
self.objectspace.space.constraints.check.append(check)
|
||||||
variable.type = 'string'
|
variable.type = 'string'
|
||||||
|
|
||||||
|
def _valid_type(variable):
|
||||||
|
if variable.type not in CONVERT_OPTION:
|
||||||
|
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
||||||
|
raise DictConsistencyError(_(f'unvalid type "{variable.type}" for variable "{variable.name}" in {xmlfiles}'))
|
||||||
|
|
||||||
if not hasattr(self.objectspace.space, 'variables'):
|
if not hasattr(self.objectspace.space, 'variables'):
|
||||||
return
|
return
|
||||||
for families in self.objectspace.space.variables.values():
|
for families in self.objectspace.space.variables.values():
|
||||||
@ -520,6 +554,7 @@ class VariableAnnotator:
|
|||||||
follower,
|
follower,
|
||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
|
_valid_type(follower)
|
||||||
else:
|
else:
|
||||||
path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name)
|
path = '{}.{}.{}'.format(namespace, normalize_family(family.name), variable.name)
|
||||||
_convert_variable(variable,
|
_convert_variable(variable,
|
||||||
@ -529,20 +564,7 @@ class VariableAnnotator:
|
|||||||
variable,
|
variable,
|
||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
|
_valid_type(variable)
|
||||||
def convert_helps(self):
|
|
||||||
if not hasattr(self.objectspace.space, 'help'):
|
|
||||||
return
|
|
||||||
helps = self.objectspace.space.help
|
|
||||||
if hasattr(helps, 'variable'):
|
|
||||||
for hlp in helps.variable.values():
|
|
||||||
variable = self.objectspace.paths.get_variable_obj(hlp.name)
|
|
||||||
variable.help = hlp.text
|
|
||||||
if hasattr(helps, 'family'):
|
|
||||||
for hlp in helps.family.values():
|
|
||||||
variable = self.objectspace.paths.get_family_obj(hlp.name)
|
|
||||||
variable.help = hlp.text
|
|
||||||
del self.objectspace.space.help
|
|
||||||
|
|
||||||
def convert_auto_freeze(self): # pylint: disable=C0111
|
def convert_auto_freeze(self): # pylint: disable=C0111
|
||||||
def _convert_auto_freeze(variable, namespace):
|
def _convert_auto_freeze(variable, namespace):
|
||||||
@ -602,7 +624,7 @@ class ConstraintAnnotator:
|
|||||||
if not hasattr(objectspace.space, 'constraints'):
|
if not hasattr(objectspace.space, 'constraints'):
|
||||||
return
|
return
|
||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
eosfunc = imp.load_source('eosfunc', eosfunc_file)
|
eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module()
|
||||||
self.functions = dir(eosfunc)
|
self.functions = dir(eosfunc)
|
||||||
self.functions.extend(INTERNAL_FUNCTIONS)
|
self.functions.extend(INTERNAL_FUNCTIONS)
|
||||||
self.valid_enums = {}
|
self.valid_enums = {}
|
||||||
@ -667,7 +689,9 @@ class ConstraintAnnotator:
|
|||||||
for idx, check in enumerate(self.objectspace.space.constraints.check):
|
for idx, check in enumerate(self.objectspace.space.constraints.check):
|
||||||
if check.name == 'valid_enum':
|
if check.name == 'valid_enum':
|
||||||
if check.target in self.valid_enums:
|
if check.target in self.valid_enums:
|
||||||
raise DictConsistencyError(_(f'valid_enum already set for {check.target}'))
|
old_xmlfiles = self.objectspace.display_xmlfiles(self.valid_enums[check.target]['xmlfiles'])
|
||||||
|
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||||
|
raise DictConsistencyError(_(f'valid_enum define in {xmlfiles} but already set in {old_xmlfiles} for "{check.target}", did you forget remove_check?'))
|
||||||
if not hasattr(check, 'param'):
|
if not hasattr(check, 'param'):
|
||||||
raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}'))
|
raise DictConsistencyError(_(f'param is mandatory for a valid_enum of variable {check.target}'))
|
||||||
variable = self.objectspace.paths.get_variable_obj(check.target)
|
variable = self.objectspace.paths.get_variable_obj(check.target)
|
||||||
@ -678,7 +702,8 @@ class ConstraintAnnotator:
|
|||||||
self._set_valid_enum(variable,
|
self._set_valid_enum(variable,
|
||||||
values,
|
values,
|
||||||
variable.type,
|
variable.type,
|
||||||
check.target
|
check.target,
|
||||||
|
check.xmlfiles,
|
||||||
)
|
)
|
||||||
remove_indexes.append(idx)
|
remove_indexes.append(idx)
|
||||||
remove_indexes.sort(reverse=True)
|
remove_indexes.sort(reverse=True)
|
||||||
@ -727,6 +752,7 @@ class ConstraintAnnotator:
|
|||||||
if target.type == 'variable':
|
if target.type == 'variable':
|
||||||
variable = self.objectspace.paths.get_variable_obj(target.name)
|
variable = self.objectspace.paths.get_variable_obj(target.name)
|
||||||
family = self.objectspace.paths.get_family_obj(target.name.rsplit('.', 1)[0])
|
family = self.objectspace.paths.get_family_obj(target.name.rsplit('.', 1)[0])
|
||||||
|
# it's a leader, so apply property to leadership
|
||||||
if isinstance(family, self.objectspace.Leadership) and family.name == variable.name:
|
if isinstance(family, self.objectspace.Leadership) and family.name == variable.name:
|
||||||
return family, family.variable
|
return family, family.variable
|
||||||
return variable, [variable]
|
return variable, [variable]
|
||||||
@ -750,13 +776,15 @@ class ConstraintAnnotator:
|
|||||||
if condition.source == target.name:
|
if condition.source == target.name:
|
||||||
raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source))
|
raise DictConsistencyError(_('target name and source name must be different: {}').format(condition.source))
|
||||||
try:
|
try:
|
||||||
target.name = self.objectspace.paths.get_variable_path(target.name, namespace)
|
target_names = [normalize_family(name) for name in target.name.split('.')]
|
||||||
|
target.name = self.objectspace.paths.get_variable_path('.'.join(target_names), namespace)
|
||||||
except DictConsistencyError:
|
except DictConsistencyError:
|
||||||
# for optional variable
|
# for optional variable
|
||||||
pass
|
pass
|
||||||
elif target.type == 'family':
|
elif target.type == 'family':
|
||||||
try:
|
try:
|
||||||
target.name = self.objectspace.paths.get_family_path(target.name, namespace)
|
target_names = [normalize_family(name) for name in target.name.split('.')]
|
||||||
|
target.name = self.objectspace.paths.get_family_path('.'.join(target_names), namespace)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise DictConsistencyError(_('cannot found family {}').format(target.name))
|
raise DictConsistencyError(_('cannot found family {}').format(target.name))
|
||||||
|
|
||||||
@ -889,34 +917,41 @@ class ConstraintAnnotator:
|
|||||||
inverse = condition.name.endswith('_if_not_in')
|
inverse = condition.name.endswith('_if_not_in')
|
||||||
actions = self._get_condition_actions(condition.name)
|
actions = self._get_condition_actions(condition.name)
|
||||||
for param in condition.param:
|
for param in condition.param:
|
||||||
if hasattr(param, 'text'):
|
text = getattr(param, 'text', None)
|
||||||
param = param.text
|
|
||||||
else:
|
|
||||||
param = None
|
|
||||||
for target in condition.target:
|
for target in condition.target:
|
||||||
leader_or_variable, variables = self._get_family_variables_from_target(target)
|
leader_or_variable, variables = self._get_family_variables_from_target(target)
|
||||||
# if option is already disable, do not apply disable_if_in
|
# if option is already disable, do not apply disable_if_in
|
||||||
if hasattr(leader_or_variable, actions[0]) and getattr(leader_or_variable, actions[0]) is True:
|
# check only the first action (example of multiple actions: 'hidden', 'frozen', 'force_default_on_freeze')
|
||||||
|
main_action = actions[0]
|
||||||
|
if getattr(leader_or_variable, main_action, False) is True:
|
||||||
continue
|
continue
|
||||||
for idx, action in enumerate(actions):
|
for idx, action in enumerate(actions):
|
||||||
prop = self.objectspace.property_(leader_or_variable.xmlfiles)
|
prop = self.objectspace.property_(leader_or_variable.xmlfiles)
|
||||||
prop.type = 'calculation'
|
prop.type = 'calculation'
|
||||||
prop.inverse = inverse
|
prop.inverse = inverse
|
||||||
prop.source = condition.source
|
prop.source = condition.source
|
||||||
prop.expected = param
|
prop.expected = text
|
||||||
prop.name = action
|
prop.name = action
|
||||||
if idx == 0:
|
if idx == 0:
|
||||||
|
# main action is for the variable or family
|
||||||
if not hasattr(leader_or_variable, 'property'):
|
if not hasattr(leader_or_variable, 'property'):
|
||||||
leader_or_variable.property = []
|
leader_or_variable.property = []
|
||||||
leader_or_variable.property.append(prop)
|
leader_or_variable.property.append(prop)
|
||||||
else:
|
else:
|
||||||
|
# other actions are set to the variable or children of family
|
||||||
for variable in variables:
|
for variable in variables:
|
||||||
if not hasattr(variable, 'property'):
|
if not hasattr(variable, 'property'):
|
||||||
variable.property = []
|
variable.property = []
|
||||||
variable.property.append(prop)
|
variable.property.append(prop)
|
||||||
del self.objectspace.space.constraints.condition
|
del self.objectspace.space.constraints.condition
|
||||||
|
|
||||||
def _set_valid_enum(self, variable, values, type_, target):
|
def _set_valid_enum(self,
|
||||||
|
variable,
|
||||||
|
values,
|
||||||
|
type_,
|
||||||
|
target: str,
|
||||||
|
xmlfiles: List[str],
|
||||||
|
):
|
||||||
# value for choice's variable is mandatory
|
# value for choice's variable is mandatory
|
||||||
variable.mandatory = True
|
variable.mandatory = True
|
||||||
# build choice
|
# build choice
|
||||||
@ -929,13 +964,14 @@ class ConstraintAnnotator:
|
|||||||
else:
|
else:
|
||||||
self.valid_enums[target] = {'type': type_,
|
self.valid_enums[target] = {'type': type_,
|
||||||
'values': values,
|
'values': values,
|
||||||
|
'xmlfiles': xmlfiles,
|
||||||
}
|
}
|
||||||
choices = []
|
choices = []
|
||||||
for value in values:
|
for value in values:
|
||||||
choice = self.objectspace.choice(variable.xmlfiles)
|
choice = self.objectspace.choice(variable.xmlfiles)
|
||||||
try:
|
try:
|
||||||
if value is not None:
|
if value is not None:
|
||||||
choice.name = CONVERSION.get(type_, str)(value)
|
choice.name = CONVERT_OPTION[type_].get('func', str)(value)
|
||||||
else:
|
else:
|
||||||
choice.name = value
|
choice.name = value
|
||||||
except:
|
except:
|
||||||
@ -950,7 +986,7 @@ class ConstraintAnnotator:
|
|||||||
for value in variable.value:
|
for value in variable.value:
|
||||||
value.type = type_
|
value.type = type_
|
||||||
try:
|
try:
|
||||||
cvalue = CONVERSION.get(type_, str)(value.name)
|
cvalue = CONVERT_OPTION[type_].get('func', str)(value.name)
|
||||||
except:
|
except:
|
||||||
raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'))
|
raise DictConsistencyError(_(f'unable to change type of value "{value}" is not a valid "{type_}" for "{variable.name}"'))
|
||||||
if cvalue not in choices:
|
if cvalue not in choices:
|
||||||
@ -1023,8 +1059,9 @@ class ConstraintAnnotator:
|
|||||||
for idx in indexes:
|
for idx in indexes:
|
||||||
fill = fills[idx]
|
fill = fills[idx]
|
||||||
# test if it's redefined calculation
|
# test if it's redefined calculation
|
||||||
if fill.target in targets and not fill.redefine:
|
if fill.target in targets:
|
||||||
raise DictConsistencyError(_(f"A fill already exists for the target: {fill.target}"))
|
xmlfiles = self.objectspace.display_xmlfiles(fill.xmlfiles)
|
||||||
|
raise DictConsistencyError(_(f'A fill already exists for the target of "{fill.target}" created in {xmlfiles}'))
|
||||||
targets.append(fill.target)
|
targets.append(fill.target)
|
||||||
#
|
#
|
||||||
if fill.name not in self.functions:
|
if fill.name not in self.functions:
|
||||||
|
@ -50,21 +50,21 @@
|
|||||||
<!ATTLIST service manage (True|False) "True">
|
<!ATTLIST service manage (True|False) "True">
|
||||||
|
|
||||||
<!ELEMENT port (#PCDATA)>
|
<!ELEMENT port (#PCDATA)>
|
||||||
<!ATTLIST port port_type (PortOption|SymLinkOption|variable) "PortOption">
|
<!ATTLIST port port_type (PortOption|variable) "PortOption">
|
||||||
<!ATTLIST port portlist CDATA #IMPLIED >
|
<!ATTLIST port portlist CDATA #IMPLIED >
|
||||||
<!ATTLIST port protocol (tcp|udp) "tcp">
|
<!ATTLIST port protocol (tcp|udp) "tcp">
|
||||||
|
|
||||||
<!ELEMENT ip (#PCDATA)>
|
<!ELEMENT ip (#PCDATA)>
|
||||||
<!ATTLIST ip iplist CDATA #IMPLIED >
|
<!ATTLIST ip iplist CDATA #IMPLIED >
|
||||||
<!ATTLIST ip ip_type (NetworkOption|SymLinkOption|variable) "NetworkOption">
|
<!ATTLIST ip ip_type (NetworkOption|variable) "NetworkOption">
|
||||||
<!ATTLIST ip interface_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
|
<!ATTLIST ip interface_type (UnicodeOption|variable) "UnicodeOption">
|
||||||
<!ATTLIST ip interface CDATA #REQUIRED>
|
<!ATTLIST ip interface CDATA #REQUIRED>
|
||||||
<!ATTLIST ip netmask_type (NetmaskOption|SymLinkOption|variable) "NetmaskOption">
|
<!ATTLIST ip netmask_type (NetmaskOption|variable) "NetmaskOption">
|
||||||
<!ATTLIST ip netmask CDATA "255.255.255.255">
|
<!ATTLIST ip netmask CDATA "255.255.255.255">
|
||||||
|
|
||||||
<!ELEMENT file EMPTY>
|
<!ELEMENT file EMPTY>
|
||||||
<!ATTLIST file name CDATA #REQUIRED >
|
<!ATTLIST file name CDATA #REQUIRED >
|
||||||
<!ATTLIST file file_type (UnicodeOption|SymLinkOption|variable) "UnicodeOption">
|
<!ATTLIST file file_type (UnicodeOption|variable) "UnicodeOption">
|
||||||
<!ATTLIST file variable CDATA #IMPLIED>
|
<!ATTLIST file variable CDATA #IMPLIED>
|
||||||
<!ATTLIST file variable_type (variable) "variable">
|
<!ATTLIST file variable_type (variable) "variable">
|
||||||
<!ATTLIST file source CDATA #IMPLIED>
|
<!ATTLIST file source CDATA #IMPLIED>
|
||||||
@ -80,17 +80,19 @@
|
|||||||
<!ATTLIST override templating (True|False) "True">
|
<!ATTLIST override templating (True|False) "True">
|
||||||
|
|
||||||
<!ELEMENT variables (family*, separators*)>
|
<!ELEMENT variables (family*, separators*)>
|
||||||
<!ELEMENT family (#PCDATA | variable)*>
|
<!ELEMENT family (variable*)>
|
||||||
<!ATTLIST family name CDATA #REQUIRED>
|
<!ATTLIST family name CDATA #REQUIRED>
|
||||||
<!ATTLIST family description CDATA #IMPLIED>
|
<!ATTLIST family description CDATA #IMPLIED>
|
||||||
|
<!ATTLIST family help CDATA #IMPLIED>
|
||||||
<!ATTLIST family mode (basic|normal|expert) "basic">
|
<!ATTLIST family mode (basic|normal|expert) "basic">
|
||||||
<!ATTLIST family hidden (True|False) "False">
|
<!ATTLIST family hidden (True|False) "False">
|
||||||
<!ATTLIST family dynamic CDATA #IMPLIED>
|
<!ATTLIST family dynamic CDATA #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT variable (#PCDATA | value)*>
|
<!ELEMENT variable (value*)>
|
||||||
<!ATTLIST variable name CDATA #REQUIRED>
|
<!ATTLIST variable name CDATA #REQUIRED>
|
||||||
<!ATTLIST variable type CDATA #IMPLIED>
|
<!ATTLIST variable type CDATA #IMPLIED>
|
||||||
<!ATTLIST variable description CDATA #IMPLIED>
|
<!ATTLIST variable description CDATA #IMPLIED>
|
||||||
|
<!ATTLIST variable help CDATA #IMPLIED>
|
||||||
<!ATTLIST variable hidden (True|False) "False">
|
<!ATTLIST variable hidden (True|False) "False">
|
||||||
<!ATTLIST variable disabled (True|False) "False">
|
<!ATTLIST variable disabled (True|False) "False">
|
||||||
<!ATTLIST variable multi (True|False) "False">
|
<!ATTLIST variable multi (True|False) "False">
|
||||||
@ -131,6 +133,7 @@
|
|||||||
|
|
||||||
<!ELEMENT group (follower+)>
|
<!ELEMENT group (follower+)>
|
||||||
<!ATTLIST group leader CDATA #REQUIRED>
|
<!ATTLIST group leader CDATA #REQUIRED>
|
||||||
|
<!ATTLIST group name CDATA #IMPLIED>
|
||||||
<!ATTLIST group description CDATA #IMPLIED>
|
<!ATTLIST group description CDATA #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT param (#PCDATA)>
|
<!ELEMENT param (#PCDATA)>
|
||||||
@ -144,5 +147,3 @@
|
|||||||
<!ATTLIST target optional (True|False) "False">
|
<!ATTLIST target optional (True|False) "False">
|
||||||
|
|
||||||
<!ELEMENT follower (#PCDATA)>
|
<!ELEMENT follower (#PCDATA)>
|
||||||
|
|
||||||
<!ELEMENT help ((variable* | family*)*)>
|
|
||||||
|
@ -1,87 +1,81 @@
|
|||||||
"""
|
"""
|
||||||
Creole flattener. Takes a bunch of Creole XML dispatched in differents folders
|
Takes a bunch of Rougail XML dispatched in differents folders
|
||||||
as an input and outputs a human readable flatened XML
|
as an input and outputs a Tiramisu's file
|
||||||
|
|
||||||
Sample usage::
|
Sample usage::
|
||||||
|
|
||||||
>>> from rougail.objspace import CreoleObjSpace
|
eolobj.space_visitor(func)
|
||||||
>>> eolobj = CreoleObjSpace('/usr/share/rougail/rougail.dtd')
|
xml = eolobj.save()
|
||||||
>>> eolobj.create_or_populate_from_xml('rougail', ['/usr/share/eole/rougail/dicos'])
|
|
||||||
>>> eolobj.space_visitor()
|
|
||||||
>>> eolobj.save('/tmp/rougail_flatened_output.xml')
|
|
||||||
|
|
||||||
The CreoleObjSpace
|
|
||||||
|
|
||||||
- loads the XML into an internal CreoleObjSpace representation
|
|
||||||
|
>>> from rougail.objspace import RougailObjSpace
|
||||||
|
>>> eolobj = RougailObjSpace('/usr/share/rougail/rougail.dtd')
|
||||||
|
>>> eolobj.create_or_populate_from_xml('rougail', ['/usr/share/rougail/dicos'])
|
||||||
|
>>> eolobj.space_visitor('/usr/share/rougail/funcs.py')
|
||||||
|
>>> tiramisu = eolobj.save()
|
||||||
|
|
||||||
|
The RougailObjSpace
|
||||||
|
|
||||||
|
- loads the XML into an internal RougailObjSpace representation
|
||||||
- visits/annotates the objects
|
- visits/annotates the objects
|
||||||
- dumps the object space as XML output into a single XML target
|
- dumps the object space as Tiramisu string
|
||||||
|
|
||||||
The visit/annotation stage is a complex step that corresponds to the Creole
|
The visit/annotation stage is a complex step that corresponds to the Rougail
|
||||||
procedures.
|
procedures.
|
||||||
|
|
||||||
For example: a variable is redefined and shall be moved to another family
|
|
||||||
means that a variable1 = Variable() object in the object space who lives in the family1 parent
|
|
||||||
has to be moved in family2. The visit procedure changes the varable1's object space's parent.
|
|
||||||
"""
|
"""
|
||||||
from lxml.etree import Element, SubElement # pylint: disable=E0611
|
|
||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .xmlreflector import XMLReflector
|
from .xmlreflector import XMLReflector
|
||||||
from .annotator import ERASED_ATTRIBUTES, SpaceAnnotator
|
from .annotator import SpaceAnnotator
|
||||||
from .tiramisureflector import TiramisuReflector
|
from .tiramisureflector import TiramisuReflector
|
||||||
from .utils import normalize_family
|
from .utils import normalize_family
|
||||||
from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError
|
from .error import OperationError, SpaceObjShallNotBeUpdated, DictConsistencyError
|
||||||
from .path import Path
|
from .path import Path
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
|
||||||
# CreoleObjSpace's elements like 'family' or 'follower', that shall be forced to the Redefinable type
|
# RougailObjSpace's elements like 'family' or 'follower', that shall be forced to the Redefinable type
|
||||||
FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables')
|
FORCE_REDEFINABLES = ('family', 'follower', 'service', 'disknod', 'variables')
|
||||||
# CreoleObjSpace's elements that shall be forced to the UnRedefinable type
|
# RougailObjSpace's elements that shall be forced to the UnRedefinable type
|
||||||
FORCE_UNREDEFINABLES = ('value',)
|
FORCE_UNREDEFINABLES = ('value',)
|
||||||
# CreoleObjSpace's elements that shall be set to the UnRedefinable type
|
# RougailObjSpace's elements that shall be set to the UnRedefinable type
|
||||||
UNREDEFINABLE = ('multi', 'type')
|
UNREDEFINABLE = ('multi', 'type')
|
||||||
|
|
||||||
CONVERT_PROPERTIES = {'auto_save': ['force_store_value'], 'auto_freeze': ['force_store_value', 'auto_freeze']}
|
|
||||||
|
|
||||||
RENAME_ATTIBUTES = {'description': 'doc'}
|
|
||||||
|
|
||||||
FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target')
|
FORCED_TEXT_ELTS_AS_NAME = ('choice', 'property', 'value', 'target')
|
||||||
|
|
||||||
CONVERT_EXPORT = {'Leadership': 'leader',
|
|
||||||
'Variable': 'variable',
|
|
||||||
'Value': 'value',
|
|
||||||
'Property': 'property',
|
|
||||||
'Choice': 'choice',
|
|
||||||
'Param': 'param',
|
|
||||||
'Check': 'check',
|
|
||||||
}
|
|
||||||
|
|
||||||
# _____________________________________________________________________________
|
# _____________________________________________________________________________
|
||||||
# special types definitions for the Object Space's internal representation
|
# special types definitions for the Object Space's internal representation
|
||||||
class RootCreoleObject:
|
class RootRougailObject:
|
||||||
def __init__(self, xmlfiles):
|
def __init__(self, xmlfiles):
|
||||||
if not isinstance(xmlfiles, list):
|
if not isinstance(xmlfiles, list):
|
||||||
xmlfiles = [xmlfiles]
|
xmlfiles = [xmlfiles]
|
||||||
self.xmlfiles = xmlfiles
|
self.xmlfiles = xmlfiles
|
||||||
|
|
||||||
|
|
||||||
class CreoleObjSpace:
|
class Atom(RootRougailObject):
|
||||||
"""DOM XML reflexion free internal representation of a Creole Dictionary
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Redefinable(RootRougailObject):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class UnRedefinable(RootRougailObject):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class RougailObjSpace:
|
||||||
|
"""DOM XML reflexion free internal representation of a Rougail Dictionary
|
||||||
"""
|
"""
|
||||||
choice = type('Choice', (RootCreoleObject,), dict())
|
choice = type('Choice', (RootRougailObject,), dict())
|
||||||
property_ = type('Property', (RootCreoleObject,), dict())
|
property_ = type('Property', (RootRougailObject,), dict())
|
||||||
# Creole ObjectSpace's Leadership variable class type
|
# Rougail ObjectSpace's Leadership variable class type
|
||||||
Leadership = type('Leadership', (RootCreoleObject,), dict())
|
Leadership = type('Leadership', (RootRougailObject,), dict())
|
||||||
"""
|
"""
|
||||||
This Atom type stands for singleton, that is
|
This Atom type stands for singleton, that is
|
||||||
an Object Space's atom object is present only once in the
|
an Object Space's atom object is present only once in the
|
||||||
object space's tree
|
object space's tree
|
||||||
"""
|
"""
|
||||||
Atom = type('Atom', (RootCreoleObject,), dict())
|
|
||||||
"A variable that can't be redefined"
|
|
||||||
Redefinable = type('Redefinable', (RootCreoleObject,), dict())
|
|
||||||
"A variable can be redefined"
|
|
||||||
UnRedefinable = type('UnRedefinable', (RootCreoleObject,), dict())
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, dtdfilename): # pylint: disable=R0912
|
def __init__(self, dtdfilename): # pylint: disable=R0912
|
||||||
@ -95,7 +89,6 @@ class CreoleObjSpace:
|
|||||||
self.xmlreflector = XMLReflector()
|
self.xmlreflector = XMLReflector()
|
||||||
self.xmlreflector.parse_dtd(dtdfilename)
|
self.xmlreflector.parse_dtd(dtdfilename)
|
||||||
self.redefine_variables = None
|
self.redefine_variables = None
|
||||||
self.fill_removed = None
|
|
||||||
self.check_removed = None
|
self.check_removed = None
|
||||||
self.condition_removed = None
|
self.condition_removed = None
|
||||||
|
|
||||||
@ -111,30 +104,30 @@ class CreoleObjSpace:
|
|||||||
"""Create Rougail ObjectSpace class types, it enables us to create objects like:
|
"""Create Rougail ObjectSpace class types, it enables us to create objects like:
|
||||||
File(), Variable(), Ip(), Family(), Constraints()... and so on.
|
File(), Variable(), Ip(), Family(), Constraints()... and so on.
|
||||||
|
|
||||||
Creole ObjectSpace is an object's reflexion of the XML elements"""
|
Rougail ObjectSpace is an object's reflexion of the XML elements"""
|
||||||
|
|
||||||
for dtd_elt in self.xmlreflector.dtd.iterelements():
|
for dtd_elt in self.xmlreflector.dtd.iterelements():
|
||||||
attrs = {}
|
attrs = {}
|
||||||
if dtd_elt.name in FORCE_REDEFINABLES:
|
if dtd_elt.name in FORCE_REDEFINABLES:
|
||||||
clstype = self.Redefinable
|
clstype = Redefinable
|
||||||
|
elif not dtd_elt.attributes() and dtd_elt.name not in FORCE_UNREDEFINABLES:
|
||||||
|
clstype = Atom
|
||||||
else:
|
else:
|
||||||
clstype = self.UnRedefinable
|
clstype = UnRedefinable
|
||||||
atomic = dtd_elt.name not in FORCE_UNREDEFINABLES and dtd_elt.name not in FORCE_REDEFINABLES
|
|
||||||
forced_text_elt = dtd_elt.type == 'mixed'
|
forced_text_elt = dtd_elt.type == 'mixed'
|
||||||
for dtd_attr in dtd_elt.iterattributes():
|
for dtd_attr in dtd_elt.iterattributes():
|
||||||
atomic = False
|
if set(dtd_attr.itervalues()) == {'True', 'False'}:
|
||||||
if set(dtd_attr.itervalues()) == set(['True', 'False']):
|
|
||||||
# it's a boolean
|
# it's a boolean
|
||||||
self.booleans_attributs.append(dtd_attr.name)
|
self.booleans_attributs.append(dtd_attr.name)
|
||||||
if dtd_attr.default_value:
|
if dtd_attr.default_value:
|
||||||
# set default value for this attribute
|
# set default value for this attribute
|
||||||
default_value = dtd_attr.default_value
|
default_value = dtd_attr.default_value
|
||||||
if dtd_attr.name in self.booleans_attributs:
|
if dtd_attr.name in self.booleans_attributs:
|
||||||
default_value = self.convert_boolean(dtd_attr.default_value)
|
default_value = self.convert_boolean(default_value)
|
||||||
attrs[dtd_attr.name] = default_value
|
attrs[dtd_attr.name] = default_value
|
||||||
if dtd_attr.name == 'redefine':
|
if dtd_attr.name == 'redefine':
|
||||||
# has a redefine attribute, so it's a Redefinable object
|
# has a redefine attribute, so it's a Redefinable object
|
||||||
clstype = self.Redefinable
|
clstype = Redefinable
|
||||||
if dtd_attr.name == 'name' and forced_text_elt:
|
if dtd_attr.name == 'name' and forced_text_elt:
|
||||||
# child.text should be transform has a "name" attribute
|
# child.text should be transform has a "name" attribute
|
||||||
self.forced_text_elts.add(dtd_elt.name)
|
self.forced_text_elts.add(dtd_elt.name)
|
||||||
@ -142,22 +135,19 @@ class CreoleObjSpace:
|
|||||||
|
|
||||||
if forced_text_elt is True:
|
if forced_text_elt is True:
|
||||||
self.forced_text_elts_as_name.add(dtd_elt.name)
|
self.forced_text_elts_as_name.add(dtd_elt.name)
|
||||||
if atomic:
|
|
||||||
# has any attribute so it's an Atomic object
|
|
||||||
clstype = self.Atom
|
|
||||||
|
|
||||||
# create ObjectSpace object
|
# create ObjectSpace object
|
||||||
setattr(self, dtd_elt.name, type(dtd_elt.name.capitalize(), (clstype,), attrs))
|
setattr(self, dtd_elt.name, type(dtd_elt.name.capitalize(), (clstype,), attrs))
|
||||||
|
|
||||||
def create_or_populate_from_xml(self,
|
def create_or_populate_from_xml(self,
|
||||||
namespace,
|
namespace,
|
||||||
xmlfolders):
|
xmlfolders,
|
||||||
|
):
|
||||||
"""Parses a bunch of XML files
|
"""Parses a bunch of XML files
|
||||||
populates the CreoleObjSpace
|
populates the RougailObjSpace
|
||||||
"""
|
"""
|
||||||
for xmlfile, document in self.xmlreflector.load_xml_from_folders(xmlfolders):
|
for xmlfile, document in self.xmlreflector.load_xml_from_folders(xmlfolders):
|
||||||
self.redefine_variables = []
|
self.redefine_variables = []
|
||||||
self.fill_removed = []
|
|
||||||
self.check_removed = []
|
self.check_removed = []
|
||||||
self.condition_removed = []
|
self.condition_removed = []
|
||||||
self.xml_parse_document(xmlfile,
|
self.xml_parse_document(xmlfile,
|
||||||
@ -172,46 +162,46 @@ class CreoleObjSpace:
|
|||||||
space,
|
space,
|
||||||
namespace,
|
namespace,
|
||||||
):
|
):
|
||||||
"""Parses a Creole XML file
|
"""Parses a Rougail XML file
|
||||||
populates the CreoleObjSpace
|
populates the RougailObjSpace
|
||||||
"""
|
"""
|
||||||
|
# var to check unique family name in a XML file
|
||||||
family_names = []
|
family_names = []
|
||||||
for child in document:
|
for child in document:
|
||||||
# this index enables us to reorder objects
|
# this index enables us to reorder objects
|
||||||
self.index += 1
|
|
||||||
# doesn't proceed the XML commentaries
|
|
||||||
if not isinstance(child.tag, str):
|
if not isinstance(child.tag, str):
|
||||||
|
# doesn't proceed the XML commentaries
|
||||||
continue
|
continue
|
||||||
if child.tag == 'family':
|
if child.tag == 'family':
|
||||||
if child.attrib['name'] in family_names:
|
if child.attrib['name'] in family_names:
|
||||||
raise DictConsistencyError(_(f'Family "{child.attrib["name"]}" is set several times in "{xmlfile}"'))
|
raise DictConsistencyError(_(f'Family "{child.attrib["name"]}" is set several times in "{xmlfile}"'))
|
||||||
family_names.append(child.attrib['name'])
|
family_names.append(child.attrib['name'])
|
||||||
if child.tag == 'variables':
|
if child.tag == 'variables':
|
||||||
|
# variables has no name, so force namespace name
|
||||||
child.attrib['name'] = namespace
|
child.attrib['name'] = namespace
|
||||||
if child.tag == 'value' and child.text == None:
|
if child.tag == 'value' and child.text is None:
|
||||||
# FIXME should not be here
|
|
||||||
continue
|
continue
|
||||||
# variable objects creation
|
# variable objects creation
|
||||||
try:
|
try:
|
||||||
variableobj = self.generate_variableobj(xmlfile,
|
variableobj = self.get_variableobj(xmlfile,
|
||||||
child,
|
child,
|
||||||
space,
|
space,
|
||||||
namespace,
|
namespace,
|
||||||
)
|
)
|
||||||
except SpaceObjShallNotBeUpdated:
|
except SpaceObjShallNotBeUpdated:
|
||||||
continue
|
continue
|
||||||
self.set_text_to_obj(child,
|
self.index += 1
|
||||||
|
self.set_text(child,
|
||||||
variableobj,
|
variableobj,
|
||||||
)
|
)
|
||||||
self.set_xml_attributes_to_obj(xmlfile,
|
self.set_attributes(xmlfile,
|
||||||
child,
|
child,
|
||||||
variableobj,
|
variableobj,
|
||||||
)
|
)
|
||||||
self.variableobj_tree_visitor(child,
|
self.remove(child,
|
||||||
variableobj,
|
variableobj,
|
||||||
namespace,
|
|
||||||
)
|
)
|
||||||
self.fill_variableobj_path_attribute(space,
|
self.set_path(space,
|
||||||
child,
|
child,
|
||||||
namespace,
|
namespace,
|
||||||
document,
|
document,
|
||||||
@ -220,6 +210,7 @@ class CreoleObjSpace:
|
|||||||
self.add_to_tree_structure(variableobj,
|
self.add_to_tree_structure(variableobj,
|
||||||
space,
|
space,
|
||||||
child,
|
child,
|
||||||
|
namespace,
|
||||||
)
|
)
|
||||||
if list(child) != []:
|
if list(child) != []:
|
||||||
self.xml_parse_document(xmlfile,
|
self.xml_parse_document(xmlfile,
|
||||||
@ -228,34 +219,32 @@ class CreoleObjSpace:
|
|||||||
namespace,
|
namespace,
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate_variableobj(self,
|
def get_variableobj(self,
|
||||||
xmlfile,
|
xmlfile: str,
|
||||||
child,
|
child: list,
|
||||||
space,
|
space,
|
||||||
namespace,
|
namespace,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
instanciates or creates Creole Object Subspace objects
|
instanciates or creates Rougail Object Subspace objects
|
||||||
"""
|
"""
|
||||||
variableobj = getattr(self, child.tag)(xmlfile)
|
obj = getattr(self, child.tag)
|
||||||
if isinstance(variableobj, self.Redefinable):
|
if Redefinable in obj.__mro__:
|
||||||
variableobj = self.create_or_update_redefinable_object(xmlfile,
|
return self.create_or_update_redefinable_object(xmlfile,
|
||||||
child.attrib,
|
child.attrib,
|
||||||
space,
|
space,
|
||||||
child,
|
child,
|
||||||
namespace,
|
namespace,
|
||||||
)
|
)
|
||||||
elif isinstance(variableobj, self.Atom) and child.tag in vars(space):
|
elif Atom in obj.__mro__:
|
||||||
# instanciates an object from the CreoleObjSpace's builtins types
|
if child.tag in vars(space):
|
||||||
# example : child.tag = constraints -> a self.Constraints() object is created
|
# Atom instance has to be a singleton here
|
||||||
# this Atom instance has to be a singleton here
|
|
||||||
# we do not re-create it, we reuse it
|
# we do not re-create it, we reuse it
|
||||||
variableobj = getattr(space, child.tag)
|
return getattr(space, child.tag)
|
||||||
self.create_tree_structure(space,
|
return obj(xmlfile)
|
||||||
child,
|
if child.tag not in vars(space):
|
||||||
variableobj,
|
setattr(space, child.tag, [])
|
||||||
)
|
return obj(xmlfile)
|
||||||
return variableobj
|
|
||||||
|
|
||||||
def create_or_update_redefinable_object(self,
|
def create_or_update_redefinable_object(self,
|
||||||
xmlfile,
|
xmlfile,
|
||||||
@ -264,57 +253,38 @@ class CreoleObjSpace:
|
|||||||
child,
|
child,
|
||||||
namespace,
|
namespace,
|
||||||
):
|
):
|
||||||
"""Creates or retrieves the space object that corresponds
|
|
||||||
to the `child` XML object
|
|
||||||
|
|
||||||
Two attributes of the `child` XML object are important:
|
|
||||||
|
|
||||||
- with the `redefine` boolean flag attribute we know whether
|
|
||||||
the corresponding space object shall be created or updated
|
|
||||||
|
|
||||||
- `True` means that the corresponding space object shall be updated
|
|
||||||
- `False` means that the corresponding space object shall be created
|
|
||||||
|
|
||||||
- with the `exists` boolean flag attribute we know whether
|
|
||||||
the corresponding space object shall be created
|
|
||||||
(or nothing -- that is the space object isn't modified)
|
|
||||||
|
|
||||||
- `True` means that the corresponding space object shall be created
|
|
||||||
- `False` means that the corresponding space object is not updated
|
|
||||||
|
|
||||||
In the special case `redefine` is True and `exists` is False,
|
|
||||||
we create the corresponding space object if it doesn't exist
|
|
||||||
and we update it if it exists.
|
|
||||||
|
|
||||||
:return: the corresponding space object of the `child` XML object
|
|
||||||
"""
|
|
||||||
if child.tag in self.forced_text_elts_as_name:
|
if child.tag in self.forced_text_elts_as_name:
|
||||||
name = child.text
|
name = child.text
|
||||||
else:
|
else:
|
||||||
name = subspace['name']
|
name = subspace['name']
|
||||||
existed_var = self.is_already_exists(name,
|
if child.tag == 'family':
|
||||||
|
name = normalize_family(name)
|
||||||
|
existed_var = self.get_existed_obj(name,
|
||||||
space,
|
space,
|
||||||
child,
|
child,
|
||||||
namespace,
|
namespace,
|
||||||
)
|
)
|
||||||
if existed_var:
|
if existed_var:
|
||||||
|
# if redefine is set to object, default value is False
|
||||||
|
# otherwise it's always a redefinable object
|
||||||
default_redefine = child.tag in FORCE_REDEFINABLES
|
default_redefine = child.tag in FORCE_REDEFINABLES
|
||||||
redefine = self.convert_boolean(subspace.get('redefine', default_redefine))
|
redefine = self.convert_boolean(subspace.get('redefine', default_redefine))
|
||||||
exists = self.convert_boolean(subspace.get('exists', True))
|
|
||||||
if redefine is True:
|
if redefine is True:
|
||||||
existed_var.xmlfiles.append(xmlfile)
|
existed_var.xmlfiles.append(xmlfile)
|
||||||
return self.translate_in_space(name,
|
return existed_var
|
||||||
space,
|
exists = self.convert_boolean(subspace.get('exists', True))
|
||||||
child,
|
if exists is False:
|
||||||
namespace,
|
|
||||||
)
|
|
||||||
elif exists is False:
|
|
||||||
raise SpaceObjShallNotBeUpdated()
|
raise SpaceObjShallNotBeUpdated()
|
||||||
xmlfiles = self.display_xmlfiles(existed_var.xmlfiles)
|
xmlfiles = self.display_xmlfiles(existed_var.xmlfiles)
|
||||||
raise DictConsistencyError(_(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", already defined in {xmlfiles}'))
|
raise DictConsistencyError(_(f'"{child.tag}" named "{name}" cannot be re-created in "{xmlfile}", already defined in {xmlfiles}'))
|
||||||
redefine = self.convert_boolean(subspace.get('redefine', False))
|
# if this object must only be modified if object already exists
|
||||||
exists = self.convert_boolean(subspace.get('exists', False))
|
exists = self.convert_boolean(subspace.get('exists', False))
|
||||||
if redefine is False or exists is True:
|
if exists is True:
|
||||||
|
raise SpaceObjShallNotBeUpdated()
|
||||||
|
redefine = self.convert_boolean(subspace.get('redefine', False))
|
||||||
|
if redefine is False:
|
||||||
|
if child.tag not in vars(space):
|
||||||
|
setattr(space, child.tag, {})
|
||||||
return getattr(self, child.tag)(xmlfile)
|
return getattr(self, child.tag)(xmlfile)
|
||||||
raise DictConsistencyError(_(f'Redefined object in "{xmlfile}": "{name}" does not exist yet'))
|
raise DictConsistencyError(_(f'Redefined object in "{xmlfile}": "{name}" does not exist yet'))
|
||||||
|
|
||||||
@ -323,35 +293,9 @@ class CreoleObjSpace:
|
|||||||
) -> str:
|
) -> str:
|
||||||
if len(xmlfiles) == 1:
|
if len(xmlfiles) == 1:
|
||||||
return '"' + xmlfiles[0] + '"'
|
return '"' + xmlfiles[0] + '"'
|
||||||
else:
|
|
||||||
return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"'
|
return '"' + '", "'.join(xmlfiles[:-1]) + '"' + ' and ' + '"' + xmlfiles[-1] + '"'
|
||||||
|
|
||||||
def create_tree_structure(self,
|
def get_existed_obj(self,
|
||||||
space,
|
|
||||||
child,
|
|
||||||
variableobj,
|
|
||||||
): # pylint: disable=R0201
|
|
||||||
"""
|
|
||||||
Builds the tree structure of the object space here
|
|
||||||
we set services attributes in order to be populated later on
|
|
||||||
for example::
|
|
||||||
|
|
||||||
space = Family()
|
|
||||||
space.variable = dict()
|
|
||||||
another example:
|
|
||||||
space = Variable()
|
|
||||||
space.value = list()
|
|
||||||
"""
|
|
||||||
if child.tag not in vars(space):
|
|
||||||
if isinstance(variableobj, self.Redefinable):
|
|
||||||
setattr(space, child.tag, dict())
|
|
||||||
elif isinstance(variableobj, self.UnRedefinable):
|
|
||||||
setattr(space, child.tag, [])
|
|
||||||
elif not isinstance(variableobj, self.Atom): # pragma: no cover
|
|
||||||
raise OperationError(_("Creole object {} "
|
|
||||||
"has a wrong type").format(type(variableobj)))
|
|
||||||
|
|
||||||
def is_already_exists(self,
|
|
||||||
name: str,
|
name: str,
|
||||||
space: str,
|
space: str,
|
||||||
child,
|
child,
|
||||||
@ -361,18 +305,20 @@ class CreoleObjSpace:
|
|||||||
if namespace != Config['variable_namespace']:
|
if namespace != Config['variable_namespace']:
|
||||||
name = space.path + '.' + name
|
name = space.path + '.' + name
|
||||||
if self.paths.path_is_defined(name):
|
if self.paths.path_is_defined(name):
|
||||||
|
old_family_name = self.paths.get_variable_family_name(name)
|
||||||
|
if namespace != Config['variable_namespace']:
|
||||||
|
old_family_name = namespace + '.' + old_family_name
|
||||||
|
if space.path != old_family_name:
|
||||||
|
xmlfiles = self.display_xmlfiles(space.xmlfiles)
|
||||||
|
raise DictConsistencyError(_(f'Variable was previously create in family "{old_family_name}", now it is in "{space.path}" in {xmlfiles}'))
|
||||||
return self.paths.get_variable_obj(name)
|
return self.paths.get_variable_obj(name)
|
||||||
return
|
return
|
||||||
if child.tag == 'family':
|
|
||||||
norm_name = normalize_family(name)
|
|
||||||
else:
|
|
||||||
norm_name = name
|
|
||||||
children = getattr(space, child.tag, {})
|
children = getattr(space, child.tag, {})
|
||||||
if norm_name in children:
|
if name in children:
|
||||||
return children[norm_name]
|
return children[name]
|
||||||
|
|
||||||
def convert_boolean(self, value): # pylint: disable=R0201
|
def convert_boolean(self, value): # pylint: disable=R0201
|
||||||
"""Boolean coercion. The Creole XML may contain srings like `True` or `False`
|
"""Boolean coercion. The Rougail XML may contain srings like `True` or `False`
|
||||||
"""
|
"""
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
return value
|
return value
|
||||||
@ -380,53 +326,59 @@ class CreoleObjSpace:
|
|||||||
return True
|
return True
|
||||||
elif value == 'False':
|
elif value == 'False':
|
||||||
return False
|
return False
|
||||||
else:
|
|
||||||
raise TypeError(_('{} is not True or False').format(value)) # pragma: no cover
|
raise TypeError(_('{} is not True or False').format(value)) # pragma: no cover
|
||||||
|
|
||||||
def translate_in_space(self,
|
def set_text(self,
|
||||||
name,
|
child,
|
||||||
family,
|
variableobj,
|
||||||
variable,
|
|
||||||
namespace,
|
|
||||||
):
|
):
|
||||||
if not isinstance(family, self.family): # pylint: disable=E1101
|
if child.text is None:
|
||||||
if variable.tag == 'family':
|
return
|
||||||
norm_name = normalize_family(name)
|
text = child.text.strip()
|
||||||
|
if not text:
|
||||||
|
return
|
||||||
|
if child.tag in self.forced_text_elts_as_name:
|
||||||
|
variableobj.name = text
|
||||||
else:
|
else:
|
||||||
norm_name = name
|
variableobj.text = text
|
||||||
return getattr(family, variable.tag)[norm_name]
|
|
||||||
if namespace == Config['variable_namespace']:
|
|
||||||
path = name
|
|
||||||
else:
|
|
||||||
path = family.path + '.' + name
|
|
||||||
old_family_name = self.paths.get_variable_family_name(path)
|
|
||||||
if normalize_family(family.name) == old_family_name:
|
|
||||||
return getattr(family, variable.tag)[name]
|
|
||||||
old_family = self.space.variables[Config['variable_namespace']].family[old_family_name] # pylint: disable=E1101
|
|
||||||
variable_obj = old_family.variable[name]
|
|
||||||
del old_family.variable[name]
|
|
||||||
if 'variable' not in vars(family):
|
|
||||||
family.variable = dict()
|
|
||||||
family.variable[name] = variable_obj
|
|
||||||
self.paths.add_variable(namespace,
|
|
||||||
name,
|
|
||||||
family.name,
|
|
||||||
False,
|
|
||||||
variable_obj,
|
|
||||||
)
|
|
||||||
return variable_obj
|
|
||||||
|
|
||||||
def remove_fill(self, name): # pylint: disable=C0111
|
def set_attributes(self,
|
||||||
if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'fill'):
|
xmlfile,
|
||||||
remove_fills= []
|
child,
|
||||||
for idx, fill in enumerate(self.space.constraints.fill): # pylint: disable=E1101
|
variableobj,
|
||||||
if hasattr(fill, 'target') and fill.target == name:
|
):
|
||||||
remove_fills.append(idx)
|
redefine = self.convert_boolean(child.attrib.get('redefine', False))
|
||||||
|
if redefine and child.tag == 'variable':
|
||||||
|
# delete old values
|
||||||
|
has_value = hasattr(variableobj, 'value')
|
||||||
|
if has_value and len(child) != 0:
|
||||||
|
del variableobj.value
|
||||||
|
for attr, val in child.attrib.items():
|
||||||
|
if redefine and attr in UNREDEFINABLE:
|
||||||
|
xmlfiles = self.display_xmlfiles(variableobj.xmlfiles[:-1])
|
||||||
|
raise DictConsistencyError(_(f'cannot redefine attribute "{attr}" for variable "{child.attrib["name"]}" in "{xmlfile}", already defined in {xmlfiles}'))
|
||||||
|
if attr in self.booleans_attributs:
|
||||||
|
val = self.convert_boolean(val)
|
||||||
|
if attr == 'name' and getattr(variableobj, 'name', None):
|
||||||
|
# do not redefine name
|
||||||
|
continue
|
||||||
|
setattr(variableobj, attr, val)
|
||||||
|
|
||||||
remove_fills = list(set(remove_fills))
|
def remove(self,
|
||||||
remove_fills.sort(reverse=True)
|
child,
|
||||||
for idx in remove_fills:
|
variableobj,
|
||||||
self.space.constraints.fill.pop(idx) # pylint: disable=E1101
|
):
|
||||||
|
"""Rougail object tree manipulations
|
||||||
|
"""
|
||||||
|
if child.tag == 'variable':
|
||||||
|
if child.attrib.get('remove_check', False):
|
||||||
|
self.remove_check(variableobj.name)
|
||||||
|
if child.attrib.get('remove_condition', False):
|
||||||
|
self.remove_condition(variableobj.name)
|
||||||
|
if child.attrib.get('remove_fill', False):
|
||||||
|
self.remove_fill(variableobj.name)
|
||||||
|
if child.tag == 'fill' and child.attrib['target'] in self.redefine_variables:
|
||||||
|
self.remove_fill(child.attrib['target'])
|
||||||
|
|
||||||
def remove_check(self, name): # pylint: disable=C0111
|
def remove_check(self, name): # pylint: disable=C0111
|
||||||
if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'check'):
|
if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'check'):
|
||||||
@ -441,100 +393,26 @@ class CreoleObjSpace:
|
|||||||
self.space.constraints.check.pop(idx) # pylint: disable=E1101
|
self.space.constraints.check.pop(idx) # pylint: disable=E1101
|
||||||
|
|
||||||
def remove_condition(self, name): # pylint: disable=C0111
|
def remove_condition(self, name): # pylint: disable=C0111
|
||||||
|
remove_conditions = []
|
||||||
for idx, condition in enumerate(self.space.constraints.condition): # pylint: disable=E1101
|
for idx, condition in enumerate(self.space.constraints.condition): # pylint: disable=E1101
|
||||||
remove_targets = []
|
if condition.source == name:
|
||||||
if hasattr(condition, 'target'):
|
remove_conditions.append(idx)
|
||||||
for target_idx, target in enumerate(condition.target):
|
for idx in remove_conditions:
|
||||||
if target.name == name:
|
del self.space.constraints.condition[idx]
|
||||||
remove_targets.append(target_idx)
|
|
||||||
remove_targets = list(set(remove_targets))
|
|
||||||
remove_targets.sort(reverse=True)
|
|
||||||
for idx in remove_targets:
|
|
||||||
del condition.target[idx]
|
|
||||||
|
|
||||||
def add_to_tree_structure(self,
|
def remove_fill(self, name): # pylint: disable=C0111
|
||||||
variableobj,
|
if hasattr(self.space, 'constraints') and hasattr(self.space.constraints, 'fill'):
|
||||||
space,
|
remove_fills= []
|
||||||
child,
|
for idx, fill in enumerate(self.space.constraints.fill): # pylint: disable=E1101
|
||||||
): # pylint: disable=R0201
|
if hasattr(fill, 'target') and fill.target == name:
|
||||||
if isinstance(variableobj, self.Redefinable):
|
remove_fills.append(idx)
|
||||||
name = variableobj.name
|
|
||||||
if child.tag == 'family':
|
|
||||||
name = normalize_family(name)
|
|
||||||
getattr(space, child.tag)[name] = variableobj
|
|
||||||
elif isinstance(variableobj, self.UnRedefinable):
|
|
||||||
getattr(space, child.tag).append(variableobj)
|
|
||||||
else:
|
|
||||||
setattr(space, child.tag, variableobj)
|
|
||||||
|
|
||||||
def set_text_to_obj(self,
|
remove_fills = list(set(remove_fills))
|
||||||
child,
|
remove_fills.sort(reverse=True)
|
||||||
variableobj,
|
for idx in remove_fills:
|
||||||
):
|
self.space.constraints.fill.pop(idx) # pylint: disable=E1101
|
||||||
if child.text is None:
|
|
||||||
text = None
|
|
||||||
else:
|
|
||||||
text = child.text.strip()
|
|
||||||
if text:
|
|
||||||
if child.tag in self.forced_text_elts_as_name:
|
|
||||||
variableobj.name = text
|
|
||||||
else:
|
|
||||||
variableobj.text = text
|
|
||||||
|
|
||||||
def set_xml_attributes_to_obj(self,
|
def set_path(self,
|
||||||
xmlfile,
|
|
||||||
child,
|
|
||||||
variableobj,
|
|
||||||
):
|
|
||||||
redefine = self.convert_boolean(child.attrib.get('redefine', False))
|
|
||||||
has_value = hasattr(variableobj, 'value')
|
|
||||||
if redefine is True and child.tag == 'variable' and has_value and len(child) != 0:
|
|
||||||
del variableobj.value
|
|
||||||
for attr, val in child.attrib.items():
|
|
||||||
if redefine and attr in UNREDEFINABLE:
|
|
||||||
# UNREDEFINABLE concerns only 'variable' node so we can fix name
|
|
||||||
# to child.attrib['name']
|
|
||||||
name = child.attrib['name']
|
|
||||||
xmlfiles = self.display_xmlfiles(variableobj.xmlfiles[:-1])
|
|
||||||
raise DictConsistencyError(_(f'cannot redefine attribute "{attr}" for variable "{name}" in "{xmlfile}", already defined in {xmlfiles}'))
|
|
||||||
if attr in self.booleans_attributs:
|
|
||||||
val = self.convert_boolean(val)
|
|
||||||
if not (attr == 'name' and getattr(variableobj, 'name', None) != None):
|
|
||||||
setattr(variableobj, attr, val)
|
|
||||||
keys = list(vars(variableobj).keys())
|
|
||||||
|
|
||||||
def variableobj_tree_visitor(self,
|
|
||||||
child,
|
|
||||||
variableobj,
|
|
||||||
namespace,
|
|
||||||
):
|
|
||||||
"""Creole object tree manipulations
|
|
||||||
"""
|
|
||||||
if child.tag == 'variable':
|
|
||||||
if child.attrib.get('remove_check', False):
|
|
||||||
self.remove_check(variableobj.name)
|
|
||||||
if child.attrib.get('remove_condition', False):
|
|
||||||
self.remove_condition(variableobj.name)
|
|
||||||
if child.attrib.get('remove_fill', False):
|
|
||||||
self.remove_fill(variableobj.name)
|
|
||||||
if child.tag == 'fill':
|
|
||||||
# if variable is a redefine in current dictionary
|
|
||||||
# XXX not working with variable not in variable and in leader/followers
|
|
||||||
variableobj.redefine = child.attrib['target'] in self.redefine_variables
|
|
||||||
if child.attrib['target'] in self.redefine_variables and child.attrib['target'] not in self.fill_removed:
|
|
||||||
self.remove_fill(child.attrib['target'])
|
|
||||||
self.fill_removed.append(child.attrib['target'])
|
|
||||||
if not hasattr(variableobj, 'index'):
|
|
||||||
variableobj.index = self.index
|
|
||||||
if child.tag == 'check' and child.attrib['target'] in self.redefine_variables and child.attrib['target'] not in self.check_removed:
|
|
||||||
self.remove_check(child.attrib['target'])
|
|
||||||
self.check_removed.append(child.attrib['target'])
|
|
||||||
if child.tag == 'condition' and child.attrib['source'] in self.redefine_variables and child.attrib['source'] not in self.condition_removed:
|
|
||||||
self.remove_condition(child.attrib['source'])
|
|
||||||
self.condition_removed.append(child.attrib['source'])
|
|
||||||
variableobj.namespace = namespace
|
|
||||||
|
|
||||||
def fill_variableobj_path_attribute(self,
|
|
||||||
space,
|
space,
|
||||||
child,
|
child,
|
||||||
namespace,
|
namespace,
|
||||||
@ -543,15 +421,15 @@ class CreoleObjSpace:
|
|||||||
): # pylint: disable=R0913
|
): # pylint: disable=R0913
|
||||||
"""Fill self.paths attributes
|
"""Fill self.paths attributes
|
||||||
"""
|
"""
|
||||||
if isinstance(space, self.help): # pylint: disable=E1101
|
|
||||||
return
|
|
||||||
if child.tag == 'variable':
|
if child.tag == 'variable':
|
||||||
family_name = normalize_family(document.attrib['name'])
|
family_name = document.attrib['name']
|
||||||
|
family_name = normalize_family(family_name)
|
||||||
self.paths.add_variable(namespace,
|
self.paths.add_variable(namespace,
|
||||||
child.attrib['name'],
|
child.attrib['name'],
|
||||||
family_name,
|
family_name,
|
||||||
document.attrib.get('dynamic') != None,
|
document.attrib.get('dynamic') != None,
|
||||||
variableobj)
|
variableobj,
|
||||||
|
)
|
||||||
if child.attrib.get('redefine', 'False') == 'True':
|
if child.attrib.get('redefine', 'False') == 'True':
|
||||||
if namespace == Config['variable_namespace']:
|
if namespace == Config['variable_namespace']:
|
||||||
self.redefine_variables.append(child.attrib['name'])
|
self.redefine_variables.append(child.attrib['name'])
|
||||||
@ -569,6 +447,25 @@ class CreoleObjSpace:
|
|||||||
)
|
)
|
||||||
variableobj.path = self.paths.get_family_path(family_name, namespace)
|
variableobj.path = self.paths.get_family_path(family_name, namespace)
|
||||||
|
|
||||||
|
def add_to_tree_structure(self,
|
||||||
|
variableobj,
|
||||||
|
space,
|
||||||
|
child,
|
||||||
|
namespace,
|
||||||
|
): # pylint: disable=R0201
|
||||||
|
if not hasattr(variableobj, 'index'):
|
||||||
|
variableobj.index = self.index
|
||||||
|
variableobj.namespace = namespace
|
||||||
|
if isinstance(variableobj, Redefinable):
|
||||||
|
name = variableobj.name
|
||||||
|
if child.tag == 'family':
|
||||||
|
name = normalize_family(name)
|
||||||
|
getattr(space, child.tag)[name] = variableobj
|
||||||
|
elif isinstance(variableobj, UnRedefinable):
|
||||||
|
getattr(space, child.tag).append(variableobj)
|
||||||
|
else:
|
||||||
|
setattr(space, child.tag, variableobj)
|
||||||
|
|
||||||
def space_visitor(self, eosfunc_file): # pylint: disable=C0111
|
def space_visitor(self, eosfunc_file): # pylint: disable=C0111
|
||||||
self.funcs_path = eosfunc_file
|
self.funcs_path = eosfunc_file
|
||||||
SpaceAnnotator(self, eosfunc_file)
|
SpaceAnnotator(self, eosfunc_file)
|
||||||
|
@ -38,10 +38,7 @@ class Path:
|
|||||||
name: str,
|
name: str,
|
||||||
current_namespace: str,
|
current_namespace: str,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
name = normalize_family(name,
|
#name = normalize_family(name)
|
||||||
check_name=False,
|
|
||||||
allow_dot=True,
|
|
||||||
)
|
|
||||||
if '.' not in name and current_namespace == Config['variable_namespace'] and name in self.full_paths_families:
|
if '.' not in name and current_namespace == Config['variable_namespace'] and name in self.full_paths_families:
|
||||||
name = self.full_paths_families[name]
|
name = self.full_paths_families[name]
|
||||||
if current_namespace is None: # pragma: no cover
|
if current_namespace is None: # pragma: no cover
|
||||||
|
@ -4,13 +4,13 @@ Gestion du mini-langage de template
|
|||||||
On travaille sur les fichiers cibles
|
On travaille sur les fichiers cibles
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
from shutil import copy
|
from shutil import copy
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
from os import listdir, makedirs
|
from os import listdir, makedirs, getcwd, chdir
|
||||||
from os.path import dirname, join, isfile
|
from os.path import dirname, join, isfile, abspath, normpath, relpath
|
||||||
|
|
||||||
from Cheetah.Template import Template as ChtTemplate
|
from Cheetah.Template import Template as ChtTemplate
|
||||||
from Cheetah.NameMapper import NotFound as CheetahNotFound
|
from Cheetah.NameMapper import NotFound as CheetahNotFound
|
||||||
@ -79,7 +79,8 @@ class CheetahTemplate(ChtTemplate):
|
|||||||
context,
|
context,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
destfilename,
|
destfilename,
|
||||||
variable):
|
variable,
|
||||||
|
):
|
||||||
"""Initialize Creole CheetahTemplate
|
"""Initialize Creole CheetahTemplate
|
||||||
"""
|
"""
|
||||||
extra_context = {'is_defined' : IsDefined(context),
|
extra_context = {'is_defined' : IsDefined(context),
|
||||||
@ -92,6 +93,24 @@ class CheetahTemplate(ChtTemplate):
|
|||||||
file=filename,
|
file=filename,
|
||||||
searchList=[context, eosfunc, extra_context])
|
searchList=[context, eosfunc, extra_context])
|
||||||
|
|
||||||
|
# FORK of Cheetah fonction, do not replace '\\' by '/'
|
||||||
|
def serverSidePath(self,
|
||||||
|
path=None,
|
||||||
|
normpath=normpath,
|
||||||
|
abspath=abspath
|
||||||
|
):
|
||||||
|
|
||||||
|
# strange...
|
||||||
|
if path is None and isinstance(self, str):
|
||||||
|
path = self
|
||||||
|
if path:
|
||||||
|
return normpath(abspath(path))
|
||||||
|
# return normpath(abspath(path.replace("\\", '/')))
|
||||||
|
elif hasattr(self, '_filePath') and self._filePath:
|
||||||
|
return normpath(abspath(self._filePath))
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class CreoleLeader:
|
class CreoleLeader:
|
||||||
def __init__(self, value, follower=None, index=None):
|
def __init__(self, value, follower=None, index=None):
|
||||||
@ -233,7 +252,7 @@ class CreoleTemplateEngine:
|
|||||||
self.distrib_dir = distrib_dir
|
self.distrib_dir = distrib_dir
|
||||||
eos = {}
|
eos = {}
|
||||||
if eosfunc_file is not None:
|
if eosfunc_file is not None:
|
||||||
eosfunc = imp.load_source('eosfunc', eosfunc_file)
|
eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module()
|
||||||
for func in dir(eosfunc):
|
for func in dir(eosfunc):
|
||||||
if not func.startswith('_'):
|
if not func.startswith('_'):
|
||||||
eos[func] = getattr(eosfunc, func)
|
eos[func] = getattr(eosfunc, func)
|
||||||
@ -287,37 +306,43 @@ class CreoleTemplateEngine:
|
|||||||
return CreoleExtra(families)
|
return CreoleExtra(families)
|
||||||
|
|
||||||
def patch_template(self,
|
def patch_template(self,
|
||||||
filename: str):
|
filename: str,
|
||||||
|
tmp_dir: str,
|
||||||
|
patch_dir: str,
|
||||||
|
) -> None:
|
||||||
"""Apply patch to a template
|
"""Apply patch to a template
|
||||||
"""
|
"""
|
||||||
patch_cmd = ['patch', '-d', self.tmp_dir, '-N', '-p1']
|
patch_cmd = ['patch', '-d', tmp_dir, '-N', '-p1']
|
||||||
patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch']
|
patch_no_debug = ['-s', '-r', '-', '--backup-if-mismatch']
|
||||||
|
|
||||||
# patches variante + locaux
|
patch_file = join(patch_dir, f'{filename}.patch')
|
||||||
for directory in [join(Config['patch_dir'], 'variante'), Config['patch_dir']]:
|
|
||||||
patch_file = join(directory, f'{filename}.patch')
|
|
||||||
if isfile(patch_file):
|
if isfile(patch_file):
|
||||||
log.info(_("Patching template '{filename}' with '{patch_file}'"))
|
log.info(_("Patching template '{filename}' with '{patch_file}'"))
|
||||||
ret = call(patch_cmd + patch_no_debug + ['-i', patch_file])
|
rel_patch_file = relpath(patch_file, tmp_dir)
|
||||||
|
ret = call(patch_cmd + patch_no_debug + ['-i', rel_patch_file])
|
||||||
if ret:
|
if ret:
|
||||||
patch_cmd_err = ' '.join(patch_cmd + ['-i', patch_file])
|
patch_cmd_err = ' '.join(patch_cmd + ['-i', rel_patch_file])
|
||||||
log.error(_(f"Error applying patch: '{patch_file}'\nTo reproduce and fix this error {patch_cmd_err}"))
|
log.error(_(f"Error applying patch: '{rel_patch_file}'\nTo reproduce and fix this error {patch_cmd_err}"))
|
||||||
copy(filename, self.tmp_dir)
|
copy(join(self.distrib_dir, filename), tmp_dir)
|
||||||
|
|
||||||
def prepare_template(self,
|
def prepare_template(self,
|
||||||
filename: str):
|
filename: str,
|
||||||
|
tmp_dir: str,
|
||||||
|
patch_dir: str,
|
||||||
|
) -> None:
|
||||||
"""Prepare template source file
|
"""Prepare template source file
|
||||||
"""
|
"""
|
||||||
log.info(_("Copy template: '{filename}' -> '{self.tmp_dir}'"))
|
log.info(_("Copy template: '{filename}' -> '{tmp_dir}'"))
|
||||||
copy(filename, self.tmp_dir)
|
copy(filename, tmp_dir)
|
||||||
self.patch_template(filename)
|
self.patch_template(filename, tmp_dir, patch_dir)
|
||||||
|
|
||||||
def process(self,
|
def process(self,
|
||||||
source: str,
|
source: str,
|
||||||
true_destfilename: str,
|
true_destfilename: str,
|
||||||
destfilename: str,
|
destfilename: str,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
variable: Any):
|
variable: Any,
|
||||||
|
):
|
||||||
"""Process a cheetah template
|
"""Process a cheetah template
|
||||||
"""
|
"""
|
||||||
# full path of the destination file
|
# full path of the destination file
|
||||||
@ -332,16 +357,19 @@ class CreoleTemplateEngine:
|
|||||||
data = str(cheetah_template)
|
data = str(cheetah_template)
|
||||||
except CheetahNotFound as err:
|
except CheetahNotFound as err:
|
||||||
varname = err.args[0][13:-1]
|
varname = err.args[0][13:-1]
|
||||||
raise TemplateError(_(f"Error: unknown variable used in template {destfilename} : {varname}"))
|
raise TemplateError(_(f"Error: unknown variable used in template {source} to {destfilename} : {varname}"))
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
raise TemplateError(_(f"Error while instantiating template {destfilename}: {err}"))
|
raise TemplateError(_(f"Error while instantiating template {source} to {destfilename}: {err}"))
|
||||||
|
|
||||||
with open(destfilename, 'w') as file_h:
|
with open(destfilename, 'w') as file_h:
|
||||||
file_h.write(data)
|
file_h.write(data)
|
||||||
|
|
||||||
def instance_file(self,
|
def instance_file(self,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
service_name: str) -> None:
|
service_name: str,
|
||||||
|
tmp_dir: str,
|
||||||
|
dest_dir: str,
|
||||||
|
) -> None:
|
||||||
"""Run templatisation on one file
|
"""Run templatisation on one file
|
||||||
"""
|
"""
|
||||||
log.info(_("Instantiating file '{filename}'"))
|
log.info(_("Instantiating file '{filename}'"))
|
||||||
@ -355,13 +383,13 @@ class CreoleTemplateEngine:
|
|||||||
if variable:
|
if variable:
|
||||||
variable = [variable]
|
variable = [variable]
|
||||||
for idx, filename in enumerate(filenames):
|
for idx, filename in enumerate(filenames):
|
||||||
destfilename = join(self.dest_dir, filename[1:])
|
destfilename = join(dest_dir, filename[1:])
|
||||||
makedirs(dirname(destfilename), exist_ok=True)
|
makedirs(dirname(destfilename), exist_ok=True)
|
||||||
if variable:
|
if variable:
|
||||||
var = variable[idx]
|
var = variable[idx]
|
||||||
else:
|
else:
|
||||||
var = None
|
var = None
|
||||||
source = join(self.tmp_dir, filevar['source'])
|
source = join(tmp_dir, filevar['source'])
|
||||||
if filevar['templating']:
|
if filevar['templating']:
|
||||||
self.process(source,
|
self.process(source,
|
||||||
filename,
|
filename,
|
||||||
@ -374,6 +402,11 @@ class CreoleTemplateEngine:
|
|||||||
async def instance_files(self) -> None:
|
async def instance_files(self) -> None:
|
||||||
"""Run templatisation on all files
|
"""Run templatisation on all files
|
||||||
"""
|
"""
|
||||||
|
ori_dir = getcwd()
|
||||||
|
tmp_dir = relpath(self.tmp_dir, self.distrib_dir)
|
||||||
|
dest_dir = relpath(self.dest_dir, self.distrib_dir)
|
||||||
|
patch_dir = relpath(Config['patch_dir'], self.distrib_dir)
|
||||||
|
chdir(self.distrib_dir)
|
||||||
for option in await self.config.option.list(type='all'):
|
for option in await self.config.option.list(type='all'):
|
||||||
namespace = await option.option.name()
|
namespace = await option.option.name()
|
||||||
if namespace == Config['variable_namespace']:
|
if namespace == Config['variable_namespace']:
|
||||||
@ -382,8 +415,8 @@ class CreoleTemplateEngine:
|
|||||||
families = await self.load_eole_variables(namespace,
|
families = await self.load_eole_variables(namespace,
|
||||||
option)
|
option)
|
||||||
self.rougail_variables_dict[namespace] = families
|
self.rougail_variables_dict[namespace] = families
|
||||||
for template in listdir(self.distrib_dir):
|
for template in listdir('.'):
|
||||||
self.prepare_template(join(self.distrib_dir, template))
|
self.prepare_template(template, tmp_dir, patch_dir)
|
||||||
for service_obj in await self.config.option('services').list('all'):
|
for service_obj in await self.config.option('services').list('all'):
|
||||||
service_name = await service_obj.option.doc()
|
service_name = await service_obj.option.doc()
|
||||||
for fills in await service_obj.list('all'):
|
for fills in await service_obj.list('all'):
|
||||||
@ -391,15 +424,17 @@ class CreoleTemplateEngine:
|
|||||||
for fill_obj in await fills.list('all'):
|
for fill_obj in await fills.list('all'):
|
||||||
fill = await fill_obj.value.dict()
|
fill = await fill_obj.value.dict()
|
||||||
filename = fill['source']
|
filename = fill['source']
|
||||||
distib_file = join(self.distrib_dir, filename)
|
if not isfile(filename):
|
||||||
if not isfile(distib_file):
|
raise FileNotFound(_(f"File {filename} does not exist."))
|
||||||
raise FileNotFound(_(f"File {distib_file} does not exist."))
|
|
||||||
if fill.get('activate', False):
|
if fill.get('activate', False):
|
||||||
self.instance_file(fill,
|
self.instance_file(fill,
|
||||||
service_name,
|
service_name,
|
||||||
|
tmp_dir,
|
||||||
|
dest_dir,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
log.debug(_("Instantiation of file '{filename}' disabled"))
|
log.debug(_("Instantiation of file '{filename}' disabled"))
|
||||||
|
chdir(ori_dir)
|
||||||
|
|
||||||
|
|
||||||
async def generate(config: Config,
|
async def generate(config: Config,
|
||||||
|
@ -9,5 +9,4 @@ class ConvertDynOptionDescription(DynOptionDescription):
|
|||||||
def convert_suffix_to_path(self, suffix):
|
def convert_suffix_to_path(self, suffix):
|
||||||
if not isinstance(suffix, str):
|
if not isinstance(suffix, str):
|
||||||
suffix = str(suffix)
|
suffix = str(suffix)
|
||||||
return normalize_family(suffix,
|
return normalize_family(suffix)
|
||||||
check_name=False)
|
|
||||||
|
@ -4,7 +4,7 @@ flattened XML specific
|
|||||||
from .config import Config
|
from .config import Config
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .error import LoaderError
|
from .error import LoaderError
|
||||||
from .annotator import ERASED_ATTRIBUTES
|
from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
|
||||||
|
|
||||||
|
|
||||||
FUNC_TO_DICT = ['valid_not_equal']
|
FUNC_TO_DICT = ['valid_not_equal']
|
||||||
@ -12,42 +12,16 @@ FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage']
|
|||||||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
||||||
|
|
||||||
|
|
||||||
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
|
||||||
'choice': dict(opttype="ChoiceOption"),
|
|
||||||
'string': dict(opttype="StrOption"),
|
|
||||||
'password': dict(opttype="PasswordOption"),
|
|
||||||
'mail': dict(opttype="EmailOption"),
|
|
||||||
'boolean': dict(opttype="BoolOption"),
|
|
||||||
'symlink': dict(opttype="SymLinkOption"),
|
|
||||||
'filename': dict(opttype="FilenameOption"),
|
|
||||||
'date': dict(opttype="DateOption"),
|
|
||||||
'unix_user': dict(opttype="UsernameOption"),
|
|
||||||
'ip': dict(opttype="IPOption", initkwargs={'allow_reserved': True}),
|
|
||||||
'local_ip': dict(opttype="IPOption", initkwargs={'private_only': True, 'warnings_only': True}),
|
|
||||||
'netmask': dict(opttype="NetmaskOption"),
|
|
||||||
'network': dict(opttype="NetworkOption"),
|
|
||||||
'broadcast': dict(opttype="BroadcastOption"),
|
|
||||||
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios', 'warnings_only': True}),
|
|
||||||
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname', 'allow_ip': False}),
|
|
||||||
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname', 'allow_ip': False}),
|
|
||||||
'web_address': dict(opttype="URLOption", initkwargs={'allow_ip': True, 'allow_without_dot': True}),
|
|
||||||
'port': dict(opttype="PortOption", initkwargs={'allow_private': True}),
|
|
||||||
'mac': dict(opttype="MACOption"),
|
|
||||||
'cidr': dict(opttype="IPOption", initkwargs={'cidr': True}),
|
|
||||||
'network_cidr': dict(opttype="NetworkOption", initkwargs={'cidr': True}),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class TiramisuReflector:
|
class TiramisuReflector:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
xmlroot,
|
xmlroot,
|
||||||
funcs_path,
|
funcs_path,
|
||||||
):
|
):
|
||||||
self.storage = ElementStorage()
|
self.storage = ElementStorage()
|
||||||
self.storage.text = ["import imp",
|
self.storage.text = ["from importlib.machinery import SourceFileLoader",
|
||||||
f"func = imp.load_source('func', '{funcs_path}')",
|
f"func = SourceFileLoader('func', '{funcs_path}').load_module()",
|
||||||
"for key, value in dict(locals()).items():",
|
"for key, value in dict(locals()).items():",
|
||||||
" if key != ['imp', 'func']:",
|
" if key != ['SourceFileLoader', 'func']:",
|
||||||
" setattr(func, key, value)",
|
" setattr(func, key, value)",
|
||||||
"try:",
|
"try:",
|
||||||
" from tiramisu3 import *",
|
" from tiramisu3 import *",
|
||||||
@ -344,6 +318,8 @@ class Variable(Common):
|
|||||||
value = value.split(',')
|
value = value.split(',')
|
||||||
if self.object_type == 'IntOption':
|
if self.object_type == 'IntOption':
|
||||||
value = [int(v) for v in value]
|
value = [int(v) for v in value]
|
||||||
|
elif self.object_type == 'FloatOption':
|
||||||
|
value = [float(v) for v in value]
|
||||||
self.informations[key] = value
|
self.informations[key] = value
|
||||||
else:
|
else:
|
||||||
self.attrib[key] = value
|
self.attrib[key] = value
|
||||||
@ -397,7 +373,7 @@ class Variable(Common):
|
|||||||
function = child.name
|
function = child.name
|
||||||
if hasattr(child, 'param'):
|
if hasattr(child, 'param'):
|
||||||
for param in child.param:
|
for param in child.param:
|
||||||
value = self.populate_param(param)
|
value = self.populate_param(function, param)
|
||||||
if not hasattr(param, 'name'):
|
if not hasattr(param, 'name'):
|
||||||
args.append(str(value))
|
args.append(str(value))
|
||||||
else:
|
else:
|
||||||
@ -411,6 +387,7 @@ class Variable(Common):
|
|||||||
return ret + ')'
|
return ret + ')'
|
||||||
|
|
||||||
def populate_param(self,
|
def populate_param(self,
|
||||||
|
function: str,
|
||||||
param,
|
param,
|
||||||
):
|
):
|
||||||
if param.type == 'string':
|
if param.type == 'string':
|
||||||
@ -420,7 +397,7 @@ class Variable(Common):
|
|||||||
elif param.type == 'variable':
|
elif param.type == 'variable':
|
||||||
value = {'option': param.text,
|
value = {'option': param.text,
|
||||||
'notraisepropertyerror': param.notraisepropertyerror,
|
'notraisepropertyerror': param.notraisepropertyerror,
|
||||||
'todict': param.text in FUNC_TO_DICT,
|
'todict': function in FUNC_TO_DICT,
|
||||||
}
|
}
|
||||||
if hasattr(param, 'suffix'):
|
if hasattr(param, 'suffix'):
|
||||||
value['suffix'] = param.suffix
|
value['suffix'] = param.suffix
|
||||||
@ -443,7 +420,7 @@ class Variable(Common):
|
|||||||
self.attrib['default'].append(value)
|
self.attrib['default'].append(value)
|
||||||
if not self.is_leader:
|
if not self.is_leader:
|
||||||
self.attrib['default_multi'] = value
|
self.attrib['default_multi'] = value
|
||||||
elif isinstance(value, int):
|
elif isinstance(value, (int, float)):
|
||||||
self.attrib['default'].append(value)
|
self.attrib['default'].append(value)
|
||||||
else:
|
else:
|
||||||
self.attrib['default'].append("'" + value + "'")
|
self.attrib['default'].append("'" + value + "'")
|
||||||
|
@ -1,23 +1,19 @@
|
|||||||
"""
|
"""
|
||||||
utilitaires créole
|
utilitaires créole
|
||||||
"""
|
"""
|
||||||
import unicodedata
|
from unicodedata import normalize, combining
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
|
|
||||||
|
|
||||||
def normalize_family(family_name: str,
|
def valid_name(name: str) -> None:
|
||||||
check_name: bool=True,
|
if '.' in name:
|
||||||
allow_dot: bool=False) -> str:
|
raise ValueError(_(f'"{name}" is a forbidden variable or family name, dot is not allowed'))
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_family(family_name: str) -> str:
|
||||||
"""replace space, accent, uppercase, ... by valid character
|
"""replace space, accent, uppercase, ... by valid character
|
||||||
"""
|
"""
|
||||||
family_name = family_name.replace('-', '_')
|
family_name = family_name.replace('-', '_').replace(' ', '_').replace('.', '_')
|
||||||
if not allow_dot:
|
nfkd_form = normalize('NFKD', family_name)
|
||||||
family_name = family_name.replace('.', '_')
|
family_name = ''.join([c for c in nfkd_form if not combining(c)])
|
||||||
family_name = family_name.replace(' ', '_')
|
return family_name.lower()
|
||||||
nfkd_form = unicodedata.normalize('NFKD', family_name)
|
|
||||||
family_name = ''.join([c for c in nfkd_form if not unicodedata.combining(c)])
|
|
||||||
family_name = family_name.lower()
|
|
||||||
if check_name and family_name == 'containers':
|
|
||||||
raise ValueError(_(f'"{family_name}" is a forbidden family name'))
|
|
||||||
return family_name
|
|
||||||
|
|
||||||
|
@ -1,161 +0,0 @@
|
|||||||
try:
|
|
||||||
import doctest
|
|
||||||
doctest.OutputChecker
|
|
||||||
except (AttributeError, ImportError): # Python < 2.4
|
|
||||||
import util.doctest24 as doctest
|
|
||||||
try:
|
|
||||||
import xml.etree.ElementTree as ET
|
|
||||||
except ImportError:
|
|
||||||
import elementtree.ElementTree as ET
|
|
||||||
from xml.parsers.expat import ExpatError as XMLParseError
|
|
||||||
|
|
||||||
RealOutputChecker = doctest.OutputChecker
|
|
||||||
|
|
||||||
|
|
||||||
def debug(*msg):
|
|
||||||
import sys
|
|
||||||
print >> sys.stderr, ' '.join(map(str, msg))
|
|
||||||
|
|
||||||
|
|
||||||
class HTMLOutputChecker(RealOutputChecker):
|
|
||||||
|
|
||||||
def check_output(self, want, got, optionflags):
|
|
||||||
normal = RealOutputChecker.check_output(self, want, got, optionflags)
|
|
||||||
if normal or not got:
|
|
||||||
return normal
|
|
||||||
try:
|
|
||||||
want_xml = make_xml(want)
|
|
||||||
except XMLParseError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
got_xml = make_xml(got)
|
|
||||||
except XMLParseError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if xml_compare(want_xml, got_xml):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def output_difference(self, example, got, optionflags):
|
|
||||||
actual = RealOutputChecker.output_difference(
|
|
||||||
self, example, got, optionflags)
|
|
||||||
want_xml = got_xml = None
|
|
||||||
try:
|
|
||||||
want_xml = make_xml(example.want)
|
|
||||||
want_norm = make_string(want_xml)
|
|
||||||
except XMLParseError as e:
|
|
||||||
if example.want.startswith('<'):
|
|
||||||
want_norm = '(bad XML: %s)' % e
|
|
||||||
# '<xml>%s</xml>' % example.want
|
|
||||||
else:
|
|
||||||
return actual
|
|
||||||
try:
|
|
||||||
got_xml = make_xml(got)
|
|
||||||
got_norm = make_string(got_xml)
|
|
||||||
except XMLParseError as e:
|
|
||||||
if example.want.startswith('<'):
|
|
||||||
got_norm = '(bad XML: %s)' % e
|
|
||||||
else:
|
|
||||||
return actual
|
|
||||||
s = '%s\nXML Wanted: %s\nXML Got : %s\n' % (
|
|
||||||
actual, want_norm, got_norm)
|
|
||||||
if got_xml and want_xml:
|
|
||||||
result = []
|
|
||||||
xml_compare(want_xml, got_xml, result.append)
|
|
||||||
s += 'Difference report:\n%s\n' % '\n'.join(result)
|
|
||||||
return s
|
|
||||||
|
|
||||||
|
|
||||||
def xml_sort(children):
|
|
||||||
tcl1 = {}
|
|
||||||
#idx = 0
|
|
||||||
|
|
||||||
for child in children:
|
|
||||||
if 'name' in child.attrib:
|
|
||||||
key = child.attrib['name']
|
|
||||||
else:
|
|
||||||
key = child.tag
|
|
||||||
if key not in tcl1:
|
|
||||||
tcl1[key] = []
|
|
||||||
tcl1[key].append(child)
|
|
||||||
cl1_keys = list(tcl1.keys())
|
|
||||||
cl1_keys.sort()
|
|
||||||
cl1 = []
|
|
||||||
for key in cl1_keys:
|
|
||||||
cl1.extend(tcl1[key])
|
|
||||||
return cl1
|
|
||||||
|
|
||||||
def xml_compare(x1, x2):
|
|
||||||
if x1.tag != x2.tag:
|
|
||||||
print ('Tags do not match: %s and %s' % (x1.tag, x2.tag))
|
|
||||||
return False
|
|
||||||
for name, value in x1.attrib.items():
|
|
||||||
if x2.attrib.get(name) != value:
|
|
||||||
print ('Attributes do not match: %s=%r, %s=%r'
|
|
||||||
% (name, value, name, x2.attrib.get(name)))
|
|
||||||
return False
|
|
||||||
for name in x2.attrib:
|
|
||||||
if name not in x1.attrib:
|
|
||||||
print ('x2 has an attribute x1 is missing: %s'
|
|
||||||
% name)
|
|
||||||
return False
|
|
||||||
if not text_compare(x1.text, x2.text):
|
|
||||||
print ('text: %r != %r' % (x1.text, x2.text))
|
|
||||||
return False
|
|
||||||
if not text_compare(x1.tail, x2.tail):
|
|
||||||
print ('tail: %r != %r' % (x1.tail, x2.tail))
|
|
||||||
return False
|
|
||||||
|
|
||||||
cl1 = xml_sort(x1.getchildren())
|
|
||||||
cl2 = xml_sort(x2.getchildren())
|
|
||||||
|
|
||||||
if len(cl1) != len(cl2):
|
|
||||||
cl1_tags = []
|
|
||||||
for c in cl1:
|
|
||||||
cl1_tags.append(c.tag)
|
|
||||||
cl2_tags = []
|
|
||||||
for c in cl2:
|
|
||||||
cl2_tags.append(c.tag)
|
|
||||||
print ('children length differs, %i != %i (%s != %s)'
|
|
||||||
% (len(cl1), len(cl2), cl1_tags, cl2_tags))
|
|
||||||
return False
|
|
||||||
i = 0
|
|
||||||
for c1, c2 in zip(cl1, cl2):
|
|
||||||
i += 1
|
|
||||||
if not xml_compare(c1, c2):
|
|
||||||
if 'name' in c1.attrib:
|
|
||||||
name = c1.attrib['name']
|
|
||||||
else:
|
|
||||||
name = i
|
|
||||||
print ('in tag "%s" with name "%s"'
|
|
||||||
% (c1.tag, name))
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def text_compare(t1, t2):
|
|
||||||
if not t1 and not t2:
|
|
||||||
return True
|
|
||||||
if t1 == '*' or t2 == '*':
|
|
||||||
return True
|
|
||||||
return (t1 or '').strip() == (t2 or '').strip()
|
|
||||||
|
|
||||||
|
|
||||||
def make_xml(s):
|
|
||||||
return ET.XML('<xml>%s</xml>' % s)
|
|
||||||
|
|
||||||
|
|
||||||
def make_string(xml):
|
|
||||||
if isinstance(xml, (str, unicode)):
|
|
||||||
xml = make_xml(xml)
|
|
||||||
s = ET.tostring(xml)
|
|
||||||
if s == '<xml />':
|
|
||||||
return ''
|
|
||||||
assert s.startswith('<xml>') and s.endswith('</xml>'), repr(s)
|
|
||||||
return s[5:-6]
|
|
||||||
|
|
||||||
|
|
||||||
def install():
|
|
||||||
doctest.OutputChecker = HTMLOutputChecker
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True">
|
||||||
@ -10,14 +9,7 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True" mode="expert">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True" mode="expert">
|
||||||
@ -12,14 +9,7 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_save="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_save="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_save="True" mode="expert">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_save="True" mode="expert">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<!-- this is a comment -->
|
<!-- this is a comment -->
|
||||||
@ -10,14 +7,7 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -12,14 +9,7 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,23 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name='général'>
|
<family name='général'>
|
||||||
<variable name='mode_conteneur_actif1' type='oui/non' description="No change" hidden="True">
|
<variable name='mode_conteneur_actif1' type='oui/non' description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -12,7 +9,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -20,9 +16,6 @@
|
|||||||
<param type="variable">mode_conteneur_actif1</param>
|
<param type="variable">mode_conteneur_actif1</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -12,16 +9,12 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="calc_val" target="mode_conteneur_actif">
|
<fill name="calc_val" target="mode_conteneur_actif">
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
20
tests/dictionaries/01base_file_include/00-base.xml
Normal file
20
tests/dictionaries/01base_file_include/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file name="/etc/file"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="oui/non" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": true}
|
1
tests/dictionaries/01base_file_include/result/etc/file
Normal file
1
tests/dictionaries/01base_file_include/result/etc/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
non
|
26
tests/dictionaries/01base_file_include/tiramisu/base.py
Normal file
26
tests/dictionaries/01base_file_include/tiramisu/base.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non'))
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_8 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||||
|
option_9 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||||
|
option_10 = StrOption(name='name', doc='name', multi=False, default='/etc/file')
|
||||||
|
option_11 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||||
|
option_12 = StrOption(name='source', doc='source', multi=False, default='file')
|
||||||
|
option_13 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||||
|
option_14 = BoolOption(name='activate', doc='activate', multi=False, default=True)
|
||||||
|
option_7 = OptionDescription(name='file', doc='file', children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||||
|
option_6 = OptionDescription(name='files', doc='files', children=[option_7])
|
||||||
|
option_5 = OptionDescription(name='test', doc='test', children=[option_6])
|
||||||
|
option_5.impl_set_information("manage", True)
|
||||||
|
option_4 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_5])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
1
tests/dictionaries/01base_file_include/tmpl/file
Normal file
1
tests/dictionaries/01base_file_include/tmpl/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
%include "incfile"
|
1
tests/dictionaries/01base_file_include/tmpl/incfile
Normal file
1
tests/dictionaries/01base_file_include/tmpl/incfile
Normal file
@ -0,0 +1 @@
|
|||||||
|
%%mode_conteneur_actif
|
20
tests/dictionaries/01base_file_patch/00-base.xml
Normal file
20
tests/dictionaries/01base_file_patch/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file name="/etc/file"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="oui/non" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
1
tests/dictionaries/01base_file_patch/makedict/base.json
Normal file
1
tests/dictionaries/01base_file_patch/makedict/base.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.mode_conteneur_actif": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": true}
|
5
tests/dictionaries/01base_file_patch/patches/file.patch
Normal file
5
tests/dictionaries/01base_file_patch/patches/file.patch
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
--- tmpl/file 2020-11-20 07:44:38.588472784 +0100
|
||||||
|
+++ dest/file 2020-11-20 07:44:54.588536011 +0100
|
||||||
|
@@ -1 +1 @@
|
||||||
|
-unpatched
|
||||||
|
+patched
|
1
tests/dictionaries/01base_file_patch/result/etc/file
Normal file
1
tests/dictionaries/01base_file_patch/result/etc/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
patched
|
26
tests/dictionaries/01base_file_patch/tiramisu/base.py
Normal file
26
tests/dictionaries/01base_file_patch/tiramisu/base.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non'))
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_8 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||||
|
option_9 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||||
|
option_10 = StrOption(name='name', doc='name', multi=False, default='/etc/file')
|
||||||
|
option_11 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||||
|
option_12 = StrOption(name='source', doc='source', multi=False, default='file')
|
||||||
|
option_13 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||||
|
option_14 = BoolOption(name='activate', doc='activate', multi=False, default=True)
|
||||||
|
option_7 = OptionDescription(name='file', doc='file', children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||||
|
option_6 = OptionDescription(name='files', doc='files', children=[option_7])
|
||||||
|
option_5 = OptionDescription(name='test', doc='test', children=[option_6])
|
||||||
|
option_5.impl_set_information("manage", True)
|
||||||
|
option_4 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_5])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
1
tests/dictionaries/01base_file_patch/tmpl/file
Normal file
1
tests/dictionaries/01base_file_patch/tmpl/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
unpatched
|
20
tests/dictionaries/01base_file_utfchar/00-base.xml
Normal file
20
tests/dictionaries/01base_file_utfchar/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service name="test">
|
||||||
|
<file name="/etc/systemd-makefs@dev-disk-by\\x2dpartlabel"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="oui/non" description="Description">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.mode_conteneur_actif": "non", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.group": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.mode": "0644", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.name": "/etc/systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.owner": "root", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.source": "systemd-makefs@dev-disk-by\\x2dpartlabel", "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.templating": true, "services.test.files.systemd_makefs@dev_disk_by\\x2dpartlabel.activate": true}
|
@ -0,0 +1 @@
|
|||||||
|
non
|
26
tests/dictionaries/01base_file_utfchar/tiramisu/base.py
Normal file
26
tests/dictionaries/01base_file_utfchar/tiramisu/base.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non'))
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_8 = StrOption(name='group', doc='group', multi=False, default='root')
|
||||||
|
option_9 = StrOption(name='mode', doc='mode', multi=False, default='0644')
|
||||||
|
option_10 = StrOption(name='name', doc='name', multi=False, default='/etc/systemd-makefs@dev-disk-by\\x2dpartlabel')
|
||||||
|
option_11 = StrOption(name='owner', doc='owner', multi=False, default='root')
|
||||||
|
option_12 = StrOption(name='source', doc='source', multi=False, default='systemd-makefs@dev-disk-by\\x2dpartlabel')
|
||||||
|
option_13 = BoolOption(name='templating', doc='templating', multi=False, default=True)
|
||||||
|
option_14 = BoolOption(name='activate', doc='activate', multi=False, default=True)
|
||||||
|
option_7 = OptionDescription(name='systemd_makefs@dev_disk_by\\x2dpartlabel', doc='systemd-makefs@dev-disk-by\\x2dpartlabel', children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14])
|
||||||
|
option_6 = OptionDescription(name='files', doc='files', children=[option_7])
|
||||||
|
option_5 = OptionDescription(name='test', doc='test', children=[option_6])
|
||||||
|
option_5.impl_set_information("manage", True)
|
||||||
|
option_4 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_5])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4])
|
@ -0,0 +1 @@
|
|||||||
|
%%mode_conteneur_actif
|
16
tests/dictionaries/01base_float/00-base.xml
Normal file
16
tests/dictionaries/01base_float/00-base.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="float" type="float" description="Description">
|
||||||
|
<value>0.527</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="float_multi" type="float" description="Description" multi="True">
|
||||||
|
<value>0.527</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators/>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
0
tests/dictionaries/01base_float/__init__.py
Normal file
0
tests/dictionaries/01base_float/__init__.py
Normal file
1
tests/dictionaries/01base_float/makedict/base.json
Normal file
1
tests/dictionaries/01base_float/makedict/base.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"rougail.general.float": 0.527, "rougail.general.float_multi": [0.527]}
|
15
tests/dictionaries/01base_float/tiramisu/base.py
Normal file
15
tests/dictionaries/01base_float/tiramisu/base.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = FloatOption(properties=frozenset({'mandatory', 'normal'}), name='float', doc='Description', multi=False, default=0.527)
|
||||||
|
option_4 = FloatOption(properties=frozenset({'mandatory', 'normal'}), name='float_multi', doc='Description', multi=True, default=[0.527], default_multi=0.527)
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
@ -1,22 +1,12 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="Redefine description" hidden="True" multi="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="Redefine description" hidden="True" multi="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True">
|
||||||
@ -15,7 +12,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -23,9 +19,6 @@
|
|||||||
<param type="variable">mode_conteneur_actif1</param>
|
<param type="variable">mode_conteneur_actif1</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_save="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_save="True">
|
||||||
@ -12,7 +9,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -20,9 +16,6 @@
|
|||||||
<param type="variable">mode_conteneur_actif1</param>
|
<param type="variable">mode_conteneur_actif1</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change"/>
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change"/>
|
||||||
@ -10,7 +7,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -18,9 +14,6 @@
|
|||||||
<param type="variable">mode_conteneur_actif1</param>
|
<param type="variable">mode_conteneur_actif1</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="Général">
|
<family name="Général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -12,7 +9,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -20,9 +16,6 @@
|
|||||||
<param type="variable">mode_conteneur_actif1</param>
|
<param type="variable">mode_conteneur_actif1</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general" mode="basic">
|
<family name="general" mode="basic">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" mandatory="True" mode="expert"/>
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" mandatory="True" mode="expert"/>
|
||||||
@ -10,7 +7,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -18,9 +14,6 @@
|
|||||||
<param type="variable">mode_conteneur_actif1</param>
|
<param type="variable">mode_conteneur_actif1</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="number" description="No change" hidden="True"/>
|
<variable name="mode_conteneur_actif" type="number" description="No change" hidden="True"/>
|
||||||
@ -10,7 +7,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -18,9 +14,6 @@
|
|||||||
<param type="number">3</param>
|
<param type="number">3</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -12,7 +9,6 @@
|
|||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -22,9 +18,6 @@
|
|||||||
<param type="variable" optional="True">mode_conteneur_actif3</param>
|
<param type="variable" optional="True">mode_conteneur_actif3</param>
|
||||||
</fill>
|
</fill>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -13,12 +10,6 @@
|
|||||||
<separator name="mode_conteneur_actif">Établissement</separator>
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
</separators>
|
</separators>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -13,12 +10,6 @@
|
|||||||
<separator name="mode_conteneur_actif">Établissement</separator>
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
</separators>
|
</separators>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
|
||||||
</constraints>
|
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -10,18 +7,13 @@
|
|||||||
</variable>
|
</variable>
|
||||||
<variable name="autosavevar" type="string" description="autosave variable" hidden="True" auto_save="True"/>
|
<variable name="autosavevar" type="string" description="autosave variable" hidden="True" auto_save="True"/>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="calc_val" target="autosavevar">
|
<fill name="calc_val" target="autosavevar">
|
||||||
<param>oui</param>
|
<param>oui</param>
|
||||||
</fill>
|
</fill>
|
||||||
|
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="oui/non" description="No change" hidden="True">
|
||||||
@ -10,7 +7,6 @@
|
|||||||
</variable>
|
</variable>
|
||||||
<variable name="autosavevar" type="string" description="autosave variable" auto_save="True"/>
|
<variable name="autosavevar" type="string" description="autosave variable" auto_save="True"/>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="calc_val" target="autosavevar">
|
<fill name="calc_val" target="autosavevar">
|
||||||
@ -20,11 +16,7 @@
|
|||||||
<param>oui</param>
|
<param>oui</param>
|
||||||
<target type="variable">autosavevar</target>
|
<target type="variable">autosavevar</target>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||||
@ -10,7 +7,6 @@
|
|||||||
</variable>
|
</variable>
|
||||||
<variable name="int" type="number" description="No change"/>
|
<variable name="int" type="number" description="No change"/>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -19,9 +15,6 @@
|
|||||||
<param name="maxi">100</param>
|
<param name="maxi">100</param>
|
||||||
</check>
|
</check>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||||
@ -10,15 +7,11 @@
|
|||||||
</variable>
|
</variable>
|
||||||
<variable name="int" type="number" description="No change"/>
|
<variable name="int" type="number" description="No change"/>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<check name="valid_lower" target="int"/>
|
<check name="valid_lower" target="int"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||||
@ -13,7 +10,6 @@
|
|||||||
</variable>
|
</variable>
|
||||||
<variable name="int" type="number" description="No change"/>
|
<variable name="int" type="number" description="No change"/>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -22,9 +18,6 @@
|
|||||||
<param name="maxi" type="variable">int2</param>
|
<param name="maxi" type="variable">int2</param>
|
||||||
</check>
|
</check>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail>
|
<rougail>
|
||||||
|
|
||||||
<services/>
|
|
||||||
|
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
<variable name="mode_conteneur_actif" type="string" description="No change">
|
||||||
@ -11,7 +8,6 @@
|
|||||||
<variable name="int" type="number" description="No change"/>
|
<variable name="int" type="number" description="No change"/>
|
||||||
<variable name="int2" type="number" description="No change"/>
|
<variable name="int2" type="number" description="No change"/>
|
||||||
</family>
|
</family>
|
||||||
<separators/>
|
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -21,11 +17,7 @@
|
|||||||
<check name="valid_differ" target="int">
|
<check name="valid_differ" target="int">
|
||||||
<param type="variable" optional="True">int3</param>
|
<param type="variable" optional="True">int3</param>
|
||||||
</check>
|
</check>
|
||||||
|
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
||||||
<help/>
|
|
||||||
|
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
-->
|
-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import imp
|
from importlib.machinery import SourceFileLoader
|
||||||
func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py')
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
for key, value in dict(locals()).items():
|
for key, value in dict(locals()).items():
|
||||||
if key != ['imp', 'func']:
|
if key != ['SourceFileLoader', 'func']:
|
||||||
setattr(func, key, value)
|
setattr(func, key, value)
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import *
|
from tiramisu3 import *
|
||||||
@ -10,7 +10,7 @@ except:
|
|||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='b')
|
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='b')
|
||||||
option_5 = IntOption(properties=frozenset({'normal'}), name='int2', doc='No change', multi=False)
|
option_5 = IntOption(properties=frozenset({'normal'}), name='int2', doc='No change', multi=False)
|
||||||
option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=False)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False)
|
option_4 = IntOption(properties=frozenset({'normal'}), validators=[Calculation(func.valid_not_equal, Params((ParamSelfOption(), ParamOption(option_5, notraisepropertyerror=False, todict=True)), kwargs={}), warnings_only=False)], name='int', doc='No change', multi=False)
|
||||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5])
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user