diff --git a/release/FoBiS-1.5.7/CONTRIBUTING.md b/release/FoBiS-1.5.7/CONTRIBUTING.md new file mode 100644 index 0000000..4456c60 --- /dev/null +++ b/release/FoBiS-1.5.7/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# How to contribute + +This project is open source, therefore, anyone interested to use, to develop or to contribute to it is welcome. + +The project must remain KISS (Keep It Simple and Stupid) thus a few guidelines for contributing are provided. + +## Issues Handling + +If you find issues (bugs or new features requests) you are kindly requested to highlight them on the GitHub repository. + ++ Make sure you have a [GitHub account](https://github.com/signup/free); ++ submit a ticket for your issue, assuming one does not already exist; + + clearly describe the issue including steps to reproduce when it is a bug; + + make sure you fill in the earliest version that you know has the issue. + +Alternatively, you can signal issues directly to the main developer at stefano.zaghi@gmail.com. + +## Collaborative Development + +If you like to directly contribute to the project you are welcome. To improve the collaborative development of the project you are kindly requested to respect the following guidelines. + ++ Fork the repository on GitHub; ++ create a topic branch from where you want to base your work; + + this is usually the master branch: + + only target release branches if you are certain your fix must be on that branch; + + to quickly create a topic branch based on master; `git branch fix/master/my_contribution master` then checkout the new branch with `git checkout fix/master/my_contribution`; please avoid working directly on the `master` branch; ++ check for unnecessary whitespace with `git diff --check` before committing; ++ make sure your commit messages are clear; ++ make sure you have properly tested for your changes. + +As long as possible, contributors are kindly requested to follow the current coding style of the project (two white spaces instead of tabs, no trailing white spaces, blank lines should not have any space). In general, it is strongly recommended to avoid Microsoft-Windows-like carriage-return symbols in order to not pollute the source files with unnecessary symbols. diff --git a/release/FoBiS-1.5.7/FoBiS.py b/release/FoBiS-1.5.7/FoBiS.py new file mode 100644 index 0000000..5438c0e --- /dev/null +++ b/release/FoBiS-1.5.7/FoBiS.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +"""Wrapper of FoBiS.py program extracted from fobis package""" +from fobis.fobis import main +if __name__ == '__main__': + main() diff --git a/release/FoBiS-1.5.7/FoBiS.py.egg-info/PKG-INFO b/release/FoBiS-1.5.7/FoBiS.py.egg-info/PKG-INFO new file mode 100644 index 0000000..b835aca --- /dev/null +++ b/release/FoBiS-1.5.7/FoBiS.py.egg-info/PKG-INFO @@ -0,0 +1,20 @@ +Metadata-Version: 1.1 +Name: FoBiS.py +Version: 1.5.7 +Summary: a Fortran Building System for poor men +Home-page: https://github.com/szaghi/FoBiS +Author: Stefano Zaghi +Author-email: stefano.zaghi@gmail.com +License: UNKNOWN +Description: FoBiS.py, a Fortran Building System for poor men, is a KISS tool for automatic building modern Fortran projects, it being able to automatically resolve inter-modules dependancy hierarchy. +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3) +Classifier: Environment :: Console +Classifier: Intended Audience :: End Users/Desktop +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Topic :: Text Processing diff --git a/release/FoBiS-1.5.7/FoBiS.py.egg-info/SOURCES.txt b/release/FoBiS-1.5.7/FoBiS.py.egg-info/SOURCES.txt new file mode 100644 index 0000000..b070315 --- /dev/null +++ b/release/FoBiS-1.5.7/FoBiS.py.egg-info/SOURCES.txt @@ -0,0 +1,23 @@ +CONTRIBUTING.md +FoBiS.py +LICENSE.gpl3.md +MANIFEST.in +README.md +setup.py +FoBiS.py.egg-info/PKG-INFO +FoBiS.py.egg-info/SOURCES.txt +FoBiS.py.egg-info/dependency_links.txt +FoBiS.py.egg-info/entry_points.txt +FoBiS.py.egg-info/requires.txt +FoBiS.py.egg-info/top_level.txt +fobis/Builder.py +fobis/Cleaner.py +fobis/Colors.py +fobis/Dependency.py +fobis/Fobos.py +fobis/ParsedFile.py +fobis/__init__.py +fobis/cli_parser.py +fobis/config.py +fobis/fobis.py +fobis/utils.py \ No newline at end of file diff --git a/release/FoBiS-1.5.7/FoBiS.py.egg-info/dependency_links.txt b/release/FoBiS-1.5.7/FoBiS.py.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/release/FoBiS-1.5.7/FoBiS.py.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/release/FoBiS-1.5.7/FoBiS.py.egg-info/entry_points.txt b/release/FoBiS-1.5.7/FoBiS.py.egg-info/entry_points.txt new file mode 100644 index 0000000..3e1605a --- /dev/null +++ b/release/FoBiS-1.5.7/FoBiS.py.egg-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] + + diff --git a/release/FoBiS-1.5.7/FoBiS.py.egg-info/requires.txt b/release/FoBiS-1.5.7/FoBiS.py.egg-info/requires.txt new file mode 100644 index 0000000..0694066 --- /dev/null +++ b/release/FoBiS-1.5.7/FoBiS.py.egg-info/requires.txt @@ -0,0 +1,9 @@ + +[FORD] +FORD>=1.1.0 + +[PreForM.py] +PreForM.py>=v1.1.1 + +[graphviz] +graphviz>=0.4.2 diff --git a/release/FoBiS-1.5.7/FoBiS.py.egg-info/top_level.txt b/release/FoBiS-1.5.7/FoBiS.py.egg-info/top_level.txt new file mode 100644 index 0000000..721253c --- /dev/null +++ b/release/FoBiS-1.5.7/FoBiS.py.egg-info/top_level.txt @@ -0,0 +1 @@ +fobis diff --git a/release/FoBiS-1.5.7/LICENSE.gpl3.md b/release/FoBiS-1.5.7/LICENSE.gpl3.md new file mode 100644 index 0000000..16d89e0 --- /dev/null +++ b/release/FoBiS-1.5.7/LICENSE.gpl3.md @@ -0,0 +1,596 @@ +GNU GENERAL PUBLIC LICENSE +========================== + +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. <> + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +## Preamble + +The GNU General Public License is a free, copyleft license for software and other +kinds of works. + +The licenses for most software and other practical works are designed to take away +your freedom to share and change the works. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change all versions of a +program--to make sure it remains free software for all its users. We, the Free +Software Foundation, use the GNU General Public License for most of our software; it +applies also to any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General +Public Licenses are designed to make sure that you have the freedom to distribute +copies of free software (and charge for them if you wish), that you receive source +code or can get it if you want it, that you can change the software or use pieces of +it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or +asking you to surrender the rights. Therefore, you have certain responsibilities if +you distribute copies of the software, or if you modify it: responsibilities to +respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, +you must pass on to the recipients the same freedoms that you received. You must make +sure that they, too, receive or can get the source code. And you must show them these +terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert +copyright on the software, and (2) offer you this License giving you legal permission +to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is +no warranty for this free software. For both users' and authors' sake, the GPL +requires that modified versions be marked as changed, so that their problems will not +be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of +the software inside them, although the manufacturer can do so. This is fundamentally +incompatible with the aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we have designed +this version of the GPL to prohibit the practice for those products. If such problems +arise substantially in other domains, we stand ready to extend this provision to +those domains in future versions of the GPL, as needed to protect the freedom of +users. + +Finally, every program is threatened constantly by software patents. States should +not allow patents to restrict development and use of software on general-purpose +computers, but in those that do, we wish to avoid the special danger that patents +applied to a free program could make it effectively proprietary. To prevent this, the +GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +## TERMS AND CONDITIONS + +### 0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this +License. Each licensee is addressed as “you”. “Licensees” and +“recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in +a fashion requiring copyright permission, other than the making of an exact copy. The +resulting work is called a “modified version” of the earlier work or a +work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on +the Program. + +To “propagate” a work means to do anything with it that, without +permission, would make you directly or secondarily liable for infringement under +applicable copyright law, except executing it on a computer or modifying a private +copy. Propagation includes copying, distribution (with or without modification), +making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through a computer +network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the +extent that it includes a convenient and prominently visible feature that (1) +displays an appropriate copyright notice, and (2) tells the user that there is no +warranty for the work (except to the extent that warranties are provided), that +licensees may convey the work under this License, and how to view a copy of this +License. If the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +### 1. Source Code. + +The “source code” for a work means the preferred form of the work for +making modifications to it. “Object code” means any non-source form of a +work. + +A “Standard Interface” means an interface that either is an official +standard defined by a recognized standards body, or, in the case of interfaces +specified for a particular programming language, one that is widely used among +developers working in that language. + +The “System Libraries” of an executable work include anything, other than +the work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only to +enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code form. +A “Major Component”, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on which +the executable work runs, or a compiler used to produce the work, or an object code +interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the +source code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. However, +it does not include the work's System Libraries, or general-purpose tools or +generally available free programs which are used unmodified in performing those +activities but which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for the work, and +the source code for shared libraries and dynamically linked subprograms that the work +is specifically designed to require, such as by intimate data communication or +control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +### 2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on the +Program, and are irrevocable provided the stated conditions are met. This License +explicitly affirms your unlimited permission to run the unmodified Program. The +output from running a covered work is covered by this License only if the output, +given its content, constitutes a covered work. This License acknowledges your rights +of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey covered +works to others for the sole purpose of having them make modifications exclusively +for you, or provide you with facilities for running those works, provided that you +comply with the terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for you must do so +exclusively on your behalf, under your direction and control, on terms that prohibit +them from making any copies of your copyrighted material outside their relationship +with you. + +Conveying under any other circumstances is permitted solely under the conditions +stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under any +applicable law fulfilling obligations under article 11 of the WIPO copyright treaty +adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention +of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of +technological measures to the extent such circumvention is effected by exercising +rights under this License with respect to the covered work, and you disclaim any +intention to limit operation or modification of the work as a means of enforcing, +against the work's users, your or third parties' legal rights to forbid circumvention +of technological measures. + +### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, in any +medium, provided that you conspicuously and appropriately publish on each copy an +appropriate copyright notice; keep intact all notices stating that this License and +any non-permissive terms added in accord with section 7 apply to the code; keep +intact all notices of the absence of any warranty; and give all recipients a copy of +this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer +support or warranty protection for a fee. + +### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it from +the Program, in the form of source code under the terms of section 4, provided that +you also meet all of these conditions: + +* **a)** The work must carry prominent notices stating that you modified it, and giving a +relevant date. +* **b)** The work must carry prominent notices stating that it is released under this +License and any conditions added under section 7. This requirement modifies the +requirement in section 4 to “keep intact all notices”. +* **c)** You must license the entire work, as a whole, under this License to anyone who +comes into possession of a copy. This License will therefore apply, along with any +applicable section 7 additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no permission to license the +work in any other way, but it does not invalidate such permission if you have +separately received it. +* **d)** If the work has interactive user interfaces, each must display Appropriate Legal +Notices; however, if the Program has interactive interfaces that do not display +Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are +not by their nature extensions of the covered work, and which are not combined with +it such as to form a larger program, in or on a volume of a storage or distribution +medium, is called an “aggregate” if the compilation and its resulting +copyright are not used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work in an aggregate +does not cause this License to apply to the other parts of the aggregate. + +### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 and +5, provided that you also convey the machine-readable Corresponding Source under the +terms of this License, in one of these ways: + +* **a)** Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by the Corresponding Source fixed on a +durable physical medium customarily used for software interchange. +* **b)** Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by a written offer, valid for at least +three years and valid for as long as you offer spare parts or customer support for +that product model, to give anyone who possesses the object code either (1) a copy of +the Corresponding Source for all the software in the product that is covered by this +License, on a durable physical medium customarily used for software interchange, for +a price no more than your reasonable cost of physically performing this conveying of +source, or (2) access to copy the Corresponding Source from a network server at no +charge. +* **c)** Convey individual copies of the object code with a copy of the written offer to +provide the Corresponding Source. This alternative is allowed only occasionally and +noncommercially, and only if you received the object code with such an offer, in +accord with subsection 6b. +* **d)** Convey the object code by offering access from a designated place (gratis or for +a charge), and offer equivalent access to the Corresponding Source in the same way +through the same place at no further charge. You need not require recipients to copy +the Corresponding Source along with the object code. If the place to copy the object +code is a network server, the Corresponding Source may be on a different server +(operated by you or a third party) that supports equivalent copying facilities, +provided you maintain clear directions next to the object code saying where to find +the Corresponding Source. Regardless of what server hosts the Corresponding Source, +you remain obligated to ensure that it is available for as long as needed to satisfy +these requirements. +* **e)** Convey the object code using peer-to-peer transmission, provided you inform +other peers where the object code and Corresponding Source of the work are being +offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. + +A “User Product” is either (1) a “consumer product”, which +means any tangible personal property which is normally used for personal, family, or +household purposes, or (2) anything designed or sold for incorporation into a +dwelling. In determining whether a product is a consumer product, doubtful cases +shall be resolved in favor of coverage. For a particular product received by a +particular user, “normally used” refers to a typical or common use of +that class of product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected to use, the +product. A product is a consumer product regardless of whether the product has +substantial commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, +procedures, authorization keys, or other information required to install and execute +modified versions of a covered work in that User Product from a modified version of +its Corresponding Source. The information must suffice to ensure that the continued +functioning of the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for +use in, a User Product, and the conveying occurs as part of a transaction in which +the right of possession and use of the User Product is transferred to the recipient +in perpetuity or for a fixed term (regardless of how the transaction is +characterized), the Corresponding Source conveyed under this section must be +accompanied by the Installation Information. But this requirement does not apply if +neither you nor any third party retains the ability to install modified object code +on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to +continue to provide support service, warranty, or updates for a work that has been +modified or installed by the recipient, or for the User Product in which it has been +modified or installed. Access to a network may be denied when the modification itself +materially and adversely affects the operation of the network or violates the rules +and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with +this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require no +special password or key for unpacking, reading or copying. + +### 7. Additional Terms. + +“Additional permissions” are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. Additional +permissions that are applicable to the entire Program shall be treated as though they +were included in this License, to the extent that they are valid under applicable +law. If additional permissions apply only to part of the Program, that part may be +used separately under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when you +modify the work.) You may place additional permissions on material, added by you to a +covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: + +* **a)** Disclaiming warranty or limiting liability differently from the terms of +sections 15 and 16 of this License; or +* **b)** Requiring preservation of specified reasonable legal notices or author +attributions in that material or in the Appropriate Legal Notices displayed by works +containing it; or +* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that +modified versions of such material be marked in reasonable ways as different from the +original version; or +* **d)** Limiting the use for publicity purposes of names of licensors or authors of the +material; or +* **e)** Declining to grant rights under trademark law for use of some trade names, +trademarks, or service marks; or +* **f)** Requiring indemnification of licensors and authors of that material by anyone +who conveys the material (or modified versions of it) with contractual assumptions of +liability to the recipient, for any liability that these contractual assumptions +directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further +restrictions” within the meaning of section 10. If the Program as you received +it, or any part of it, contains a notice stating that it is governed by this License +along with a term that is a further restriction, you may remove that term. If a +license document contains a further restriction but permits relicensing or conveying +under this License, you may add to a covered work material governed by the terms of +that license document, provided that the further restriction does not survive such +relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in +the relevant source files, a statement of the additional terms that apply to those +files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements apply +either way. + +### 8. Termination. + +You may not propagate or modify a covered work except as expressly provided under +this License. Any attempt otherwise to propagate or modify it is void, and will +automatically terminate your rights under this License (including any patent licenses +granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated (a) provisionally, unless and until the +copyright holder explicitly and finally terminates your license, and (b) permanently, +if the copyright holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently +if the copyright holder notifies you of the violation by some reasonable means, this +is the first time you have received notice of violation of this License (for any +work) from that copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of +parties who have received copies or rights from you under this License. If your +rights have been terminated and not permanently reinstated, you do not qualify to +receive new licenses for the same material under section 10. + +### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of the +Program. Ancillary propagation of a covered work occurring solely as a consequence of +using peer-to-peer transmission to receive a copy likewise does not require +acceptance. However, nothing other than this License grants you permission to +propagate or modify any covered work. These actions infringe copyright if you do not +accept this License. Therefore, by modifying or propagating a covered work, you +indicate your acceptance of this License to do so. + +### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a license +from the original licensors, to run, modify and propagate that work, subject to this +License. You are not responsible for enforcing compliance by third parties with this +License. + +An “entity transaction” is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an organization, or +merging organizations. If propagation of a covered work results from an entity +transaction, each party to that transaction who receives a copy of the work also +receives whatever licenses to the work the party's predecessor in interest had or +could give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if the predecessor +has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or +affirmed under this License. For example, you may not impose a license fee, royalty, +or other charge for exercise of rights granted under this License, and you may not +initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging +that any patent claim is infringed by making, using, selling, offering for sale, or +importing the Program or any portion of it. + +### 11. Patents. + +A “contributor” is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The work thus +licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, that +would be infringed by some manner, permitted by this License, of making, using, or +selling its contributor version, but do not include claims that would be infringed +only as a consequence of further modification of the contributor version. For +purposes of this definition, “control” includes the right to grant patent +sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license +under the contributor's essential patent claims, to make, use, sell, offer for sale, +import and otherwise run, modify and propagate the contents of its contributor +version. + +In the following three paragraphs, a “patent license” is any express +agreement or commitment, however denominated, not to enforce a patent (such as an +express permission to practice a patent or covenant not to sue for patent +infringement). To “grant” such a patent license to a party means to make +such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of charge +and under the terms of this License, through a publicly available network server or +other readily accessible means, then you must either (1) cause the Corresponding +Source to be so available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner consistent with +the requirements of this License, to extend the patent license to downstream +recipients. “Knowingly relying” means you have actual knowledge that, but +for the patent license, your conveying the covered work in a country, or your +recipient's use of the covered work in a country, would infringe one or more +identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a patent +license to some of the parties receiving the covered work authorizing them to use, +propagate, modify or convey a specific copy of the covered work, then the patent +license you grant is automatically extended to all recipients of the covered work and +works based on it. + +A patent license is “discriminatory” if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on the +non-exercise of one or more of the rights that are specifically granted under this +License. You may not convey a covered work if you are a party to an arrangement with +a third party that is in the business of distributing software, under which you make +payment to the third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties who would receive +the covered work from you, a discriminatory patent license (a) in connection with +copies of the covered work conveyed by you (or copies made from those copies), or (b) +primarily for and in connection with specific products or compilations that contain +the covered work, unless you entered into that arrangement, or that patent license +was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to you +under applicable patent law. + +### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) +that contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot convey a covered work so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not convey it at all. For example, if you +agree to terms that obligate you to collect a royalty for further conveying from +those to whom you convey the Program, the only way you could satisfy both those terms +and this License would be to refrain entirely from conveying the Program. + +### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link or +combine any covered work with a work licensed under version 3 of the GNU Affero +General Public License into a single combined work, and to convey the resulting work. +The terms of this License will continue to apply to the part which is the covered +work, but the special requirements of the GNU Affero General Public License, section +13, concerning interaction through a network will apply to the combination as such. + +### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in spirit +to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that +a certain numbered version of the GNU General Public License “or any later +version” applies to it, you have the option of following the terms and +conditions either of that numbered version or of any later version published by the +Free Software Foundation. If the Program does not specify a version number of the GNU +General Public License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU +General Public License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no +additional obligations are imposed on any author or copyright holder as a result of +your choosing to follow a later version. + +### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE +OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE +WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot be +given local legal effect according to their terms, reviewing courts shall apply local +law that most closely approximates an absolute waiver of all civil liability in +connection with the Program, unless a warranty or assumption of liability accompanies +a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +## How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to +the public, the best way to achieve this is to make it free software which everyone +can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them +to the start of each source file to most effectively state the exclusion of warranty; +and each file should have at least the “copyright” line and a pointer to +where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this +when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate parts of +the General Public License. Of course, your program's commands might be different; +for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to +sign a “copyright disclaimer” for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +<>. + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider it +more useful to permit linking proprietary applications with the library. If this is +what you want to do, use the GNU Lesser General Public License instead of this +License. But first, please read +<>. \ No newline at end of file diff --git a/release/FoBiS-1.5.7/MANIFEST.in b/release/FoBiS-1.5.7/MANIFEST.in new file mode 100644 index 0000000..efa752e --- /dev/null +++ b/release/FoBiS-1.5.7/MANIFEST.in @@ -0,0 +1 @@ +include *.md diff --git a/release/FoBiS-1.5.7/README.md b/release/FoBiS-1.5.7/README.md new file mode 100644 index 0000000..895c324 --- /dev/null +++ b/release/FoBiS-1.5.7/README.md @@ -0,0 +1,101 @@ + +# FoBiS.py [![Latest Version](https://pypip.in/version/FoBiS.py/badge.svg?style=flat)](https://pypi.python.org/pypi/FoBiS.py/) [![GitHub tag](https://img.shields.io/github/tag/szaghi/FoBiS.svg)]() + +[![License](https://pypip.in/license/FoBiS.py/badge.svg?style=flat)](https://pypi.python.org/pypi/FoBiS.py/) + +### FoBiS.py, Fortran Building System for poor men +A KISS tool for automatic building modern Fortran projects. + +### Status +[![Development Status](https://pypip.in/status/FoBiS.py/badge.svg?style=flat)](https://pypi.python.org/pypi/FoBiS.py/) +[![Build Status](https://travis-ci.org/szaghi/FoBiS.svg?branch=master)](https://travis-ci.org/szaghi/FoBiS) +[![Coverage Status](https://img.shields.io/coveralls/szaghi/FoBiS.svg)](https://coveralls.io/r/szaghi/FoBiS) +[![Code Health](https://landscape.io/github/szaghi/FoBiS/master/landscape.svg?style=flat)](https://landscape.io/github/szaghi/FoBiS/master) + +#### Issues +[![GitHub issues](https://img.shields.io/github/issues/szaghi/FoBiS.svg)]() +[![Ready in backlog](https://badge.waffle.io/szaghi/fobis.png?label=ready&title=Ready)](https://waffle.io/szaghi/fobis) +[![In Progress](https://badge.waffle.io/szaghi/fobis.png?label=in%20progress&title=In%20Progress)](https://waffle.io/szaghi/fobis) +[![Open bugs](https://badge.waffle.io/szaghi/fobis.png?label=bug&title=Open%20Bugs)](https://waffle.io/szaghi/fobis) + +#### Python support [![Supported Python versions](https://pypip.in/py_versions/FoBiS.py/badge.svg?style=flat)](https://pypi.python.org/pypi/FoBiS.py/) [![Download format](https://pypip.in/format/FoBiS.py/badge.svg?style=flat)](https://pypi.python.org/pypi/FoBiS.py/) + +## Why? +GNU Make, CMake, SCons & Co. are fantastic tools, even too much for a _poor-fortran-man_. + +However, the support for modern Fortran project is still poor: in particular, it is quite difficult (and boring) to track the inter-module-dependency hierarchy of project using many module files. + +Modern Fortran programs can take great advantage of using modules (e.g. encapsulation), however their compilations can quickly become a nightmare as the number of modules grows. As a consequence, an automatic build system able to track (on the fly) any changes on the inter-module-dependency hierarchy can save the life of a _poor-fortran-man_. + +### Why not use an auto-make-like tool? +There are a lot of alternatives for deal with inter-module-dependency hierarchy, but they can be viewed as a pre-processor for the actual building system (such as auto-make tools or even the Fortran compiler itself that, in most cases, can generate a dependency list of a processed file), thus they introduce another level of complexity... but a _poor-fortran-man_ always loves the KISS (Keep It Simple, Stupid) things! + +##### FoBiS.py is designed to do just one thing: build a modern Fortran program without boring you to specify a particular compilation hierarchy. + +### OK, what can FoBiS.py do? I am a _poor-fortran-man_, I do not understand you... +Let us consider the following project tree +```bash +└── src + ├── cumbersome.f90 + └── nested-1 + ├── first_dep.f90 + └── nested-2 + └── second_dep.inc +``` +The main program contained into `cumbersome.f90` depends on `first_dep.f90` via the use statement `use NesteD_1`, thus it actually depends on the module `nested_1`. This module depends on `second_dep.inc` via the include statement `include 'second_dep.inc'`. Note that the dependency files are stored in a *cumbersome* nested tree. Write a makefile for this very simple example could waste many minutes... when the modules number increases the time wasted blows up! + +It would be very nice to have a tool that automatically track the actual dependency-hierarchy and build the project on the fly, without the necessity to track the dependency-hierarchy changes. FoBiS.py just makes this... and few more things! + +Suppose your goal is to build some (all) of the main programs contained into the project tree. In this case FoBiS.py can save your life: just type +```bash +FoBiS.py build +``` +in the root of your project and FoBis.py will build all the main programs nested into the current root directory. Obviously, FoBiS.py will not (re-)compile unnecessary objects if they are up-to-date (like the "magic" of a makefile). + +FoBiS.py has many (ok... some) others interesting features: if I have convinced you, please read the following. + +Go to [Top](#top) + +## Main features ++ Automatic parsing of files for dependency-hierarchy creation in case of _use_ and _include_ statements; ++ automatic building of all _programs_ found into the root directory parsed or only a specific selected target; ++ avoid unnecessary re-compilation (algorithm based on file-timestamp value); ++ simple command line interface (CLI); ++ friendly support for external libraries linking; ++ Intel, GNU and g95 Fortran Compilers support; ++ custom compiler support; ++ configuration-files-free; ++ ... but also configuration-file driven building for complex buildings; ++ parallel compiling enabled by means of concurrent `multiprocessing` jobs; ++ advanced automatic (re-)building algorithms: + - automatic (re-)building when compiling flags change with respect the previous building; + - automatic (re-)building when linked library change; + - automatic building of projects upon which the actual project depends; ++ generation of GNU Make makefile with rules fully supporting dependency-hierarchy for _make-irreducible users_; ++ easy-extensible; ++ well integrate with a flexible pythonic pre-processor, [PreForM.py](https://github.com/szaghi/PreForM). + +Go to [Top](#top) + +## Documentation +FoBiS.py documentations are hosted on GitHub. The [wiki](https://github.com/szaghi/FoBiS/wiki) and the [README](https://github.com/szaghi/FoBiS) are the main documentation resources. Other sources of documentation are the examples. + +Here is a non-comprehensive list of the main topics + +| [Install](https://github.com/szaghi/FoBiS/wiki/Install) | [Usage](https://github.com/szaghi/FoBiS/wiki/Usage) | +|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------| +| [Manual Install](https://github.com/szaghi/FoBiS/wiki/Manual-Installation) | [Getting Started](https://github.com/szaghi/FoBiS/wiki/Getting-Started) | +| [PyPi Install](https://github.com/szaghi/FoBiS/wiki/PyPI-Installation%2C-the-Python-Package-Index) | [A Taste of FoBiS.py](https://github.com/szaghi/FoBiS/wiki/Taste) | +| | [fobos: the FoBiS.py makefile](https://github.com/szaghi/FoBiS/wiki/fobos) | +| | [FoBiS.py in action](https://github.com/szaghi/FoBiS/wiki/Projects-Using-FoBiS) | + +Go to [Top](#top) + +## Copyrights +FoBiS.py is an open source project, it is distributed under the [GPL v3](http://www.gnu.org/licenses/gpl-3.0.html) license. A copy of the license should be distributed within FoBiS.py. Anyone interested to use, develop or to contribute to FoBiS.py is welcome. Take a look at the [contributing guidelines](CONTRIBUTING.md) for starting to contribute to the project. + +Go to [Top](#top) + +## A screencast of a very cumbersome example + +![Screencast](examples/cumbersome_dependency_program_interdepent/cumbersome-cast.gif) diff --git a/release/FoBiS-1.5.7/dist/FoBiS.py-1.5.7.tar.gz b/release/FoBiS-1.5.7/dist/FoBiS.py-1.5.7.tar.gz new file mode 100644 index 0000000..c4ed485 Binary files /dev/null and b/release/FoBiS-1.5.7/dist/FoBiS.py-1.5.7.tar.gz differ diff --git a/release/FoBiS-1.5.7/fobis/Builder.py b/release/FoBiS-1.5.7/fobis/Builder.py new file mode 100644 index 0000000..9809909 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/Builder.py @@ -0,0 +1,552 @@ +#!/usr/bin/env python +""" +Builder.py, module definition of Builder class. +This is a class designed for controlling the building phase. +""" +try: + from multiprocessing import Pool + __parallel__ = True +except ImportError: + print("Module 'multiprocessing' not found: parallel compilation disabled") + __parallel__ = False +import operator +import os +from .utils import check_results, print_fake, syswork + + +class Builder(object): + """Builder is an object that handles the building system, its attributes and methods. + + Attributes + ---------- + s_compilers : dict + supported compilers data + """ + s_compilers = {'gnu': ['gfortran', 'mpif90', '-J ', ['-ftest-coverage -fprofile-arcs', '-fprofile-arcs']], + 'intel': ['ifort', 'mpif90', '-module ', ['-prof-gen=srcpos', '']], + 'g95': ['g95', 'mpif90', '-fmod=', ['', '']]} + + def __init__(self, cliargs, print_n=None, print_w=None): + """ + Parameters + ---------- + cliargs : argparse object + print_n : {None} + function for printing normal message + print_w : {None} + function for printing emphized warning message + + Attributes + ---------- + compiler : {"Intel"} + compiler used + fc : {""} + custom compiler statement + cflags : {""} + compilation flags + lflags : {""} + linking flags + preproc : {""} + preprocessor flags + coverage : {False} + activate code coverage flags + modsw : {""} + custom compiler switch for modules searching path + mpi : {False} + use MPI enabled version of compiler + build_dir : {"./"} + directory containing built files + obj_dir : {"./"} + directory containing compiled object files + mod_dir : {"./"} + directory containing .mod files + lib_dir : {None} + list of directories searched for libraries + dinc : {None} + list of directories for searching included files + libs : {None} + list of external libraries that are not into the path: must be passed with full paths + vlibs : {None} + list of external libraries that are not into the path and that are volatile (can changed thus triggering re-building): must be passed with full paths + ext_libs : {None} + list of external libraries that are into the path: are linked as '-llibrary.[a|so]' and searched into '-Ldir' + ext_vlibs : {None} + list of external libraries that are into the path and that are volatile (can changed thus triggering re-building): are linked as '-llibrary.[a|so]' and searched into '-Ldir' + preform : {False} + activate PreForM.py pre-processing + pfm_dir : {None} + directory containing sources processed by PreForm.py; by default are removed after used + pfm_ext : {None} + list of file extensions to be processed by PreForm.py; by default all files are preprocessed if PreForM.py is used + print_n : {None} + function for printing normal message + print_w : {None} + function for printing emphized warning message + jobs : {1} + concurrent compiling jobs + + Attributes + ---------- + """ + + if print_n is None: + self.print_n = print_fake + else: + self.print_n = print_n + + if print_w is None: + self.print_w = print_fake + else: + self.print_w = print_w + + self.compiler = cliargs.compiler + self.fcs = cliargs.fc + self.cflags = cliargs.cflags + self.lflags = cliargs.lflags + self.preproc = cliargs.preproc + self.coverage = cliargs.coverage + self.modsw = cliargs.modsw + self.mpi = cliargs.mpi + self.jobs = cliargs.jobs + self._set_compiler(cliargs=cliargs) + self._sanitize_dirs(build_dir=cliargs.build_dir, obj_dir=cliargs.obj_dir, mod_dir=cliargs.mod_dir, lib_dir=cliargs.lib_dir, dinc=cliargs.include) + self._sanitize_files(libs=cliargs.libs, vlibs=cliargs.vlibs, ext_libs=cliargs.ext_libs, ext_vlibs=cliargs.ext_vlibs) + self._set_preform(preform=cliargs.preform, pfm_dir=cliargs.pfm_dir, pfm_ext=cliargs.pfm_ext) + self.cmd_comp = self.fcs + ' ' + self.cflags + ' ' + self.modsw + self.mod_dir + ' ' + self.preproc + self.cmd_link = self.fcs + ' ' + self.lflags + ' ' + self.modsw + self.mod_dir + return + + def _set_compiler(self, cliargs): + """ + Method for setting compiler options. + + Parameters + ---------- + cliargs : argparse object + """ + if cliargs.compiler.lower() in Builder.s_compilers: + if cliargs.coverage: + self.cflags += " " + Builder.s_compilers[cliargs.compiler.lower()][3][0] + self.lflags += " " + Builder.s_compilers[cliargs.compiler.lower()][3][1] + self.modsw = Builder.s_compilers[cliargs.compiler.lower()][2] + if cliargs.mpi: + self.fcs = Builder.s_compilers[cliargs.compiler.lower()][1] + else: + self.fcs = Builder.s_compilers[cliargs.compiler.lower()][0] + # if self.modsw[-1] != '=': # check necessary for g95 CLI trapping error + # self.modsw += ' ' + return + + def _sanitize_dirs(self, build_dir, obj_dir, mod_dir, lib_dir, dinc): + """ + Method for sanitizing directory paths. + + Parameters + ---------- + build_dir : str + directory containing built files + obj_dir : str + directory containing compiled object files + mod_dir : str + directory containing .mod files + lib_dir : list + list of directories searched for libraries + dinc : list + list of directories for searching included files + """ + self.build_dir = os.path.normpath(build_dir) + os.sep + if not os.path.exists(self.build_dir): + os.makedirs(self.build_dir) + self.obj_dir = os.path.normpath(build_dir + obj_dir) + os.sep + if not os.path.exists(self.obj_dir): + os.makedirs(self.obj_dir) + self.mod_dir = os.path.normpath(build_dir + mod_dir) + os.sep + if not os.path.exists(self.mod_dir): + os.makedirs(self.mod_dir) + if lib_dir is None: + self.lib_dir = [] + else: + self.lib_dir = lib_dir + for directory in self.lib_dir: + directory = os.path.normpath(directory) + os.sep + if dinc is None: + self.dinc = [] + else: + self.dinc = dinc + for directory in self.dinc: + directory = os.path.normpath(directory) + os.sep + return + + def _sanitize_files(self, libs, vlibs, ext_libs, ext_vlibs): + """ + Method for sanitizing files paths. + + Parameters + ---------- + libs : list + list of external libraries that are not into the path: must be passed with full paths + vlibs : list + list of external libraries that are not into the path and that are volatile (can changed thus triggering re-building): must be passed with full paths + ext_libs : list + list of external libraries that are into the path: are linked as '-llibrary.[a|so]' and searched into '-Ldir' + ext_vlibs : list + list of external libraries that are into the path and that are volatile (can changed thus triggering re-building): are linked as '-llibrary.[a|so]' and searched into '-Ldir' + """ + if libs is None: + self.libs = [] + else: + self.libs = libs + for lib in self.libs: + lib = os.path.normpath(lib) + if vlibs is None: + self.vlibs = [] + else: + self.vlibs = vlibs + for lib in self.vlibs: + lib = os.path.normpath(lib) + if ext_libs is None: + self.ext_libs = [] + else: + self.ext_libs = ext_libs + for lib in self.ext_libs: + lib = os.path.normpath(lib) + if ext_vlibs is None: + self.ext_vlibs = [] + else: + self.ext_vlibs = ext_vlibs + for lib in self.ext_vlibs: + lib = os.path.normpath(lib) + return + + def _set_preform(self, preform, pfm_dir, pfm_ext): + """ + Method for safetely setting PreForM.py data. + + Parameters + ---------- + preform : bool + activate PreForM.py pre-processing + pfm_dir : str + directory containing sources processed by PreForm.py; by default are removed after used + pfm_ext : list + list of file extensions to be processed by PreForm.py; by default all files are preprocessed if PreForM.py is used + """ + self.preform = preform + if pfm_ext is None: + self.pfm_ext = [] + else: + self.pfm_ext = pfm_ext + self.pfm_dir = pfm_dir + if self.pfm_dir: + self.pfm_dir = self.build_dir + self.pfm_dir + self.pfm_dir = os.path.normpath(self.pfm_dir) + os.sep + if not os.path.exists(self.pfm_dir): + os.makedirs(self.pfm_dir) + if self.preform: + pfm_exist = False + for path in os.environ["PATH"].split(os.pathsep): + pfm_exist = os.path.exists(os.path.join(path, 'PreForM.py')) + if pfm_exist: + break + if not pfm_exist: + self.print_w('Error: PreForM.py is not in your PATH! You cannot use --preform or -pfm switches.') + return + + def _compile_preform(self, file_to_compile): + """ + Method for creating compile command with PreForM.py usage. + + Parameters + ---------- + file_to_compile : ParsedFile object + file to be compiled + + Returns + ------- + str + string containing the PreForM.py command + str + string containing the output file name of PreForM.py + str + string containing the command for removing/storing PreForM.py outputs + """ + preform_cmd = '' + preform_output = '' + preform_remove = '' + to_preform = False + if self.preform: + if len(self.pfm_ext) > 0: + if file_to_compile.extension in self.pfm_ext: + to_preform = True + else: + to_preform = True + if to_preform and self.pfm_dir: + pfm_dir = self.pfm_dir + preform_store = True + else: + pfm_dir = '' + preform_store = False + if to_preform: + preform_cmd = 'PreForM.py ' + file_to_compile.name + ' -o ' + pfm_dir + file_to_compile.basename + '.pfm.f90' + ' ; ' + preform_output = pfm_dir + file_to_compile.basename + '.pfm.f90' + if not preform_store: + preform_remove = ' ; rm -f ' + preform_output + return preform_cmd, preform_output, preform_remove + + def _compile_include(self): + """ + Method for creating compile command with inluded paths. + + Returns + ------- + str + string containing the include command + """ + include_cmd = '' + if len(self.dinc) > 0: + include_cmd = ''.join(['-I' + s + ' ' for s in self.dinc]) + return include_cmd + + def _compile_command(self, file_to_compile): + """ + Method for returning the OS command for compiling file_to_compile. + + Parameters + ---------- + file_to_compile : ParsedFile object + file to be compiled + + Returns + ------- + str + string containing the compile command + """ + preform_cmd, preform_output, preform_remove = self._compile_preform(file_to_compile) + include_cmd = self._compile_include() + + if preform_cmd != '': + comp_cmd = preform_cmd + self.cmd_comp + ' ' + include_cmd + preform_output + ' -o ' + self.obj_dir + file_to_compile.basename + '.o' + preform_remove + else: + comp_cmd = self.cmd_comp + ' ' + include_cmd + file_to_compile.name + ' -o ' + self.obj_dir + file_to_compile.basename + '.o' + return comp_cmd + + def _link_command(self, file_to_build, output=None, nomodlibs=None): + """ + Method for returning the OS command for linkng file_to_build. + + Parameters + ---------- + file_to_build : ParsedFile object + file to be built + output : str + output name + nomodlibs : {None} + list of old-Fortran style libraries objects + + Returns + ------- + str + string containing the link command + """ + if nomodlibs is not None: + objs = nomodlibs + file_to_build.obj_dependencies() + else: + objs = file_to_build.obj_dependencies() + if output: + exe = self.build_dir + output + else: + exe = self.build_dir + file_to_build.basename + link_cmd = self.cmd_link + " " + "".join([self.obj_dir + s + " " for s in objs]) + "".join([s + " " for s in self.libs]) + "".join([s + " " for s in self.vlibs]) + if len(self.ext_libs) > 0: + link_cmd += " " + "".join(["-l" + s + " " for s in self.ext_libs]) + if len(self.ext_vlibs) > 0: + link_cmd += " " + "".join(["-l" + s + " " for s in self.ext_vlibs]) + if len(self.lib_dir) > 0: + link_cmd += " " + "".join(["-L" + s + " " for s in self.lib_dir]) + link_cmd += " -o " + exe + return link_cmd, exe + + def _mklib_command(self, file_to_build, output=None, nomodlibs=None, mklib=None): + """ + Method for returning the OS command for linkng file_to_build as a library. + + Parameters + ---------- + file_to_build : ParsedFile object + file to be built + output : str + output name + nomodlibs : {None} + list of old-Fortran style libraries objects + mklib : {None} + bool for activate building library mode + + Returns + ------- + str + string containing the link command + """ + if nomodlibs is not None: + objs = nomodlibs + file_to_build.obj_dependencies(exclude_programs=True) + else: + objs = file_to_build.obj_dependencies(exclude_programs=True) + if output: + lib = self.build_dir + output + else: + if mklib.lower() == 'shared': + lib = self.build_dir + file_to_build.basename + '.so' + elif mklib.lower() == 'static': + lib = self.build_dir + file_to_build.basename + '.a' + if mklib.lower() == 'shared': + link_cmd = self.cmd_link + " " + "".join([self.obj_dir + s + " " for s in objs]) + "".join([s + " " for s in self.libs]) + "".join([s + " " for s in self.vlibs]) + " -o " + lib + elif mklib.lower() == 'static': + link_cmd = "ar -rcs " + lib + " " + "".join([self.obj_dir + s + " " for s in objs]) + "".join([s + " " for s in self.libs]) + "".join([s + " " for s in self.vlibs]) + " ; ranlib " + lib + return link_cmd, lib + + def _get_hierarchy(self, file_to_build): + """ + Method for creating a hierarchy of compiling commands accordingly to the dependencies order. + + Parameters + ---------- + file_to_build : ParsedFile + """ + order_max = max([p for p in file_to_build.pfile_dep_all if not p.include and p.to_compile], key=operator.attrgetter('order')).order + 1 + hierarchy = [[] for _ in range(order_max)] + for dep in file_to_build.pfile_dep_all: + if dep.to_compile and not dep.include: + hierarchy[dep.order].append([dep.name, self._compile_command(file_to_compile=dep)]) + dep.to_compile = False + hierarchy = [h for h in hierarchy if len(h) > 0] + return hierarchy + + def _compile(self, file_to_build, verbose=False, log=False): + """ + Method for actually compiling files. + + Parameters + ---------- + file_to_build : ParsedFile + verbose : {False} + bool for activate extreme verbose outputs + log : {False} + bool for activate errors log saving + """ + hierarchy = self._get_hierarchy(file_to_build) + for deps in reversed(hierarchy): + files_to_compile = '' + cmds = [] + for dep in deps: + files_to_compile = files_to_compile + " " + dep[0] + cmds.append(dep[1]) + if len(deps) > 1 and self.jobs > 1 and __parallel__: + jobs = min(len(deps), self.jobs) + self.print_n("Compiling" + files_to_compile + " using " + str(jobs) + " concurrent processes") + if verbose: + self.print_n("Executing: " + str(cmds)) + pool = Pool(processes=jobs) + results = pool.map(syswork, cmds) + pool.close() + pool.join() + else: + self.print_n("Compiling" + files_to_compile + " serially") + results = [] + for cmd in cmds: + if verbose: + self.print_n("Executing: " + str(cmd)) + result = syswork(cmd) + results.append(result) + if log: + check_results(results=results, log="building-errors.log", print_w=self.print_w) + else: + check_results(results=results, print_w=self.print_w) + return + + def build(self, file_to_build, output=None, nomodlibs=None, mklib=None, verbose=False, log=False): + """ + Method for building file. + + Parameters + ---------- + file_to_build : ParsedFile + output : str + output name + nomodlibs : {None} + list of old-Fortran style libraries objects + mklib : {None} + bool for activate building library mode + verbose : {False} + bool for activate extreme verbose outputs + log : {False} + bool for activate errors log saving + """ + self.print_n('Building ' + file_to_build.name) + # sort dependencies accordingly to indirect dependency + file_to_build.sort_dependencies() + # creating a hierarchy list of compiling commands accordingly to the order of all dependencies + if len([p for p in file_to_build.pfile_dep_all if not p.include and p.to_compile]) > 0: + self._compile(file_to_build=file_to_build, verbose=verbose, log=log) + else: + self.print_n('Nothing to compile, all objects are up-to-date') + if file_to_build.program: + link_cmd, exe = self._link_command(file_to_build=file_to_build, output=output, nomodlibs=nomodlibs) + self.print_n("Linking " + exe) + if verbose: + self.print_n("Executing: " + str(link_cmd)) + result = syswork(link_cmd) + if log: + check_results(results=[result], log="building-errors.log", print_w=self.print_w) + else: + check_results(results=[result], print_w=self.print_w) + self.print_n('Target ' + file_to_build.name + ' has been successfully built') + elif mklib: + link_cmd, lib = self._mklib_command(file_to_build=file_to_build, output=output, nomodlibs=nomodlibs, mklib=mklib) + self.print_n("Linking " + lib) + if verbose: + self.print_n("Executing: " + str(link_cmd)) + result = syswork(link_cmd) + if log: + check_results(results=[result], log="building-errors.log", print_w=self.print_w) + else: + check_results(results=[result], print_w=self.print_w) + self.print_n('Target ' + file_to_build.name + ' has been successfully built') + return + + def verbose(self, quiet=False): + """ + The method verbose returns a verbose message containing builder infos. + + Parameters + ---------- + quiet : {False} + flag for making less verbose outputs + """ + message = '' + if not quiet: + message = "Builder options" + "\n" + message += " Building directory: " + self.build_dir + "\n" + message += " Compiled-objects .o directory: " + self.obj_dir + "\n" + message += " Compiled-objects .mod directory: " + self.mod_dir + "\n" + if len(self.lib_dir) > 0: + message += " External libraries directories: " + "".join([s + " " for s in self.lib_dir]) + "\n" + if len(self.dinc) > 0: + message += " Included paths: " + "".join([s + " " for s in self.dinc]) + "\n" + if len(self.libs) > 0: + message += " Linked libraries with full path: " + "".join([s + " " for s in self.libs]) + "\n" + if len(self.vlibs) > 0: + message += " Linked volatile libraries with full path: " + "".join([s + " " for s in self.vlibs]) + "\n" + if len(self.ext_libs) > 0: + message += " Linked libraries in path: " + "".join([s + " " for s in self.ext_libs]) + "\n" + if len(self.ext_vlibs) > 0: + message += " Linked volatile libraries in path: " + "".join([s + " " for s in self.ext_vlibs]) + "\n" + message += " Compiler class: " + self.compiler + "\n" + message += " Compiler: " + self.fcs + "\n" + message += " Compiler module switch: " + self.modsw + "\n" + message += " Compilation flags: " + self.cflags + "\n" + message += " Linking flags: " + self.lflags + "\n" + message += " Preprocessing flags: " + self.preproc + "\n" + message += " Coverage instrumenting: " + str(self.coverage) + "\n" + message += " PreForM.py used: " + str(self.preform) + "\n" + message += " PreForM.py output directory: " + str(self.pfm_dir) + "\n" + message += " PreForM.py extensions processed: " + str(self.pfm_ext) + "\n" + return message diff --git a/release/FoBiS-1.5.7/fobis/Cleaner.py b/release/FoBiS-1.5.7/fobis/Cleaner.py new file mode 100644 index 0000000..385e160 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/Cleaner.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +""" +Cleaner.py, module definition of Cleaner class. +This is a class designed for controlling the cleaning phase. +""" +import os +from .utils import print_fake + + +class Cleaner(object): + """ + Cleaner is an object for cleaning current project. + """ + def __init__(self, cliargs, print_w=None): + """ + Parameters + ---------- + cliargs : argparse object + print_w : {None} + function for printing emphized warning message + + Attributes + ---------- + build_dir : str + directory containing built files + obj_dir : str + directory containing compiled object files + mod_dir : str + directory containing .mod files + target : str + target source to be built + output : str + name of the building output + mklib : str + flag for building a library instead of a program + print_w : function + function for printing emphized warning message + """ + + if print_w is None: + self.print_w = print_fake + else: + self.print_w = print_w + + self._sanitize_dirs(build_dir=cliargs.build_dir, obj_dir=cliargs.obj_dir, mod_dir=cliargs.mod_dir) + self._sanitize_files(target=cliargs.target, output=cliargs.output) + self.mklib = cliargs.mklib + return + + def _sanitize_dirs(self, build_dir, obj_dir, mod_dir): + """ + Method for sanitizing directory paths. + + Parameters + ---------- + build_dir : str + directory containing built files + obj_dir : str + directory containing compiled object files + mod_dir : str + directory containing .mod files + """ + self.build_dir = os.path.normpath(build_dir) + os.sep + self.obj_dir = os.path.normpath(build_dir + obj_dir) + os.sep + self.mod_dir = os.path.normpath(build_dir + mod_dir) + os.sep + return + + def _sanitize_files(self, target, output): + """ + Method for sanitizing files paths. + + Parameters + target : {None} + target source to be built + output : {None} + name of the building output + ---------- + """ + if target: + self.target = os.path.normpath(target) + else: + self.target = target + if output: + self.output = os.path.normpath(output) + else: + self.output = output + return + + def clean_mod(self): + """ + Method for cleaning compiled mod files. + """ + if os.path.exists(self.mod_dir): + self.print_w('Removing all *.mod files into "' + self.mod_dir + '"') + for root, _, files in os.walk(self.mod_dir): + for filename in files: + if os.path.splitext(os.path.basename(filename))[1] == '.mod': + os.remove(os.path.join(root, filename)) + + def clean_obj(self): + """ + Method for cleaning compiled objects files. + """ + if os.path.exists(self.obj_dir): + self.print_w('Removing all *.o files into "' + self.obj_dir + '"') + for root, _, files in os.walk(self.obj_dir): + for filename in files: + if os.path.splitext(os.path.basename(filename))[1] == '.o': + os.remove(os.path.join(root, filename)) + + def clean_target(self): + """ + Function clean_target clean compiled targets. + """ + if self.target: + if self.output: + exe = self.output + else: + if self.mklib: + if self.mklib.lower() == 'static': + exe = os.path.splitext(os.path.basename(self.target))[0] + '.a' + elif self.mklib.lower() == 'shared': + exe = os.path.splitext(os.path.basename(self.target))[0] + '.so' + else: + exe = os.path.splitext(os.path.basename(self.target))[0] + if os.path.exists(self.build_dir + exe): + self.print_w('Removing ' + self.build_dir + exe) + os.remove(self.build_dir + exe) + if os.path.exists('build_' + os.path.splitext(os.path.basename(self.target))[0] + '.log'): + self.print_w('Removing build_' + os.path.splitext(os.path.basename(self.target))[0] + '.log') + os.remove('build_' + os.path.splitext(os.path.basename(self.target))[0] + '.log') + if os.path.exists('dependency_graph_' + os.path.splitext(os.path.basename(self.target))[0] + '.svg'): + self.print_w('Removing dependency_graph_' + os.path.splitext(os.path.basename(self.target))[0] + '.svg') + os.remove('dependency_graph_' + os.path.splitext(os.path.basename(self.target))[0] + '.svg') + if os.path.exists('dependency_graph_' + os.path.splitext(os.path.basename(self.target))[0]): + self.print_w('Removing dependency_graph_' + os.path.splitext(os.path.basename(self.target))[0]) + os.remove('dependency_graph_' + os.path.splitext(os.path.basename(self.target))[0]) + if os.path.exists(self.build_dir + '.cflags.heritage'): + os.remove(self.build_dir + '.cflags.heritage') diff --git a/release/FoBiS-1.5.7/fobis/Colors.py b/release/FoBiS-1.5.7/fobis/Colors.py new file mode 100644 index 0000000..837d629 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/Colors.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +""" +Colors.py, module definition of Colors class. +This is a class aimed at coloring prints. +""" + + +class Colors(object): + """ + Colors is an object that handles colors of shell prints, its attributes and methods. + """ + def __init__(self, + red='\033[1;31m', + bld='\033[1m'): + self.red = red + self.bld = bld + self.end = '\033[0m' + + def enable(self): + """Method for enabling colors.""" + self.red = '\033[1;31m' + self.bld = '\033[1m' + self.end = '\033[0m' + + def disable(self): + """Method for disabling colors.""" + self.red = '' + self.bld = '' + self.end = '' + + def print_b(self, string): + """ + Method for printing string with bold color. + + Parameters + ---------- + string : str + string to be printed + """ + print(self.bld + string + self.end) + return + + def print_r(self, string): + """ + Method for printing string with red color. + + Parameters + ---------- + string : str + string to be printed + """ + print(self.red + string + self.end) + return diff --git a/release/FoBiS-1.5.7/fobis/Dependency.py b/release/FoBiS-1.5.7/fobis/Dependency.py new file mode 100644 index 0000000..ce0be1f --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/Dependency.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +""" +Dependency.py, module definition of Dependency class. + +This is a class designed for handling file dependency. +""" +import os + + +class Dependency(object): + + """Dependency is an object that handles a single file dependency, its attributes and methods.""" + + def __init__(self, dtype="", name="", dfile=""): + """ + Parameters + ---------- + dtype : {""} + type of dependency: "module" or "include" type + name : {""} + name of dependency: module name for "use" type or file name for include type + file : {""} + file name containing module in the case of "use" type + + Attributes + ---------- + """ + self.type = dtype + self.name = name + self.file = dfile + + def __str__(self): + string = [] + string.append('\n Type: ' + str(self.type)) + string.append('\n Name: ' + str(self.name)) + string.append('\n File: ' + str(self.file)) + return ''.join(string) + + def printf(self): + """Method for printing dependency data.""" + print(self) + return + + def exist(self): + """Method for checking the existance of a dependency file.""" + return os.path.exists(self.file) diff --git a/release/FoBiS-1.5.7/fobis/Fobos.py b/release/FoBiS-1.5.7/fobis/Fobos.py new file mode 100644 index 0000000..924bb52 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/Fobos.py @@ -0,0 +1,360 @@ +#!/usr/bin/env python +""" +fobos.py, module definition of fobos class. +This is a class aimed at fobos file handling. +""" +try: + import ConfigParser as configparser +except ImportError: + import configparser +from copy import deepcopy +import os +import re +import sys +from .utils import check_results, print_fake, syswork + + +class Fobos(object): + """ + Fobos is an object that handles fobos file, its attributes and methods. + """ + def __init__(self, cliargs, print_n=None, print_w=None): + """ + Parameters + ---------- + cliargs : argparse object + print_n : {None} + function for printing normal message + print_w : {None} + function for printing emphized warning message + """ + if print_n is None: + self.print_n = print_fake + else: + self.print_n = print_n + + if print_w is None: + self.print_w = print_fake + else: + self.print_w = print_w + + self.fobos = None + self.mode = None + self.local_variables = {} + if cliargs.fobos: + filename = cliargs.fobos + else: + filename = 'fobos' + if os.path.exists(filename): + self.fobos = configparser.ConfigParser() + if not cliargs.fobos_case_insensitive: + self.fobos.optionxform = str # case sensitive + self.fobos.read(filename) + self._set_cliargs(cliargs=cliargs) + return + + def _check_mode(self, mode): + """ + Function for checking the presence of the selected mode into the set defined inside the fobos. + + Parameters + ---------- + mode : str + name of the selcted mode + """ + if self.fobos: + if self.fobos.has_option('modes', 'modes'): + if mode in self.fobos.get('modes', 'modes'): + self.mode = mode + else: + self.print_w('Error: the mode "' + mode + '" is not defined into the fobos file.') + self.modes_list() + sys.exit(1) + else: + self.print_w('Error: fobos file has not "modes" section.') + sys.exit(1) + return + + def _set_mode(self, mode=None): + """ + Function for setting the selected mode. + + Parameters + ---------- + mode : {None} + selected mode + """ + if self.fobos: + if mode: + self._check_mode(mode=mode) + else: + if self.fobos.has_option('modes', 'modes'): + self.mode = self.fobos.get('modes', 'modes').split()[0] # first mode selected + else: + if self.fobos.has_section('default'): + self.mode = 'default' + else: + self.print_w('Error: fobos file has not "modes" section neither "default" one') + sys.exit(1) + return + + def _check_template(self): + """ + Function for checking the correct use of "template" sections. + """ + if self.fobos: + for mode in self.fobos.sections(): + if self.fobos.has_option(mode, 'template'): + if self.fobos.has_section(self.fobos.get(mode, 'template')): + for item in self.fobos.items(self.fobos.get(mode, 'template')): + self.fobos.set(mode, item[0], item[1]) + else: + self.print_w('Error: mode "' + mode + '" uses as template the mode "' + self.fobos.get(mode, 'template') + '" that is NOT defined') + sys.exit(1) + return + + def _get_local_variables(self): + """ + Method for getting the definition of local variables defined into any sections (modes). + """ + if self.fobos: + for section in self.fobos.sections(): + for item in self.fobos.items(section): + if item[0].startswith('$'): + self.local_variables[item[0]] = item[1] + return + + def _substitute_local_variables(self): + """ + Method for substituting the definition of local variables defined into any sections (modes). + """ + if self.fobos: + if self.mode: + for item in self.fobos.items(self.mode): + item_val = item[1] + for key, value in self.local_variables.items(): + item_val = re.sub(r"\s*" + re.escape(key) + r"\s*", " " + value + " ", item_val) + self.fobos.set(self.mode, item[0], item_val) + return + + def _check_local_variables(self): + """ + Method for getting and substituting the definition of local variables defined into any sections (modes). + """ + if self.fobos: + self._get_local_variables() + if len(self.local_variables) > 0: + self._substitute_local_variables() + return + + def _set_cliargs_attributes(self, cliargs, cliargs_dict): + """ + Method for setting attribute of cliargs. + + Parameters + ---------- + cliargs : argparse object + cliargs_dict : argparse object attributes dictionary + """ + if self.mode: + for item in self.fobos.items(self.mode): + if item[0] in cliargs_dict: + if isinstance(cliargs_dict[item[0]], bool): + setattr(cliargs, item[0], self.fobos.getboolean(self.mode, item[0])) + elif isinstance(cliargs_dict[item[0]], int): + setattr(cliargs, item[0], int(item[1])) + elif isinstance(cliargs_dict[item[0]], list): + setattr(cliargs, item[0], item[1].split()) + else: + setattr(cliargs, item[0], item[1]) + return + + @staticmethod + def _check_cliargs_cflags(cliargs, cliargs_dict): + """ + Method for setting attribute of cliargs. + + Parameters + ---------- + cliargs : argparse object + cliargs_dict : argparse object attributes dictionary + """ + for item in cliargs_dict: + if item in ['cflags', 'lflags', 'preproc']: + val_cli = cliargs_dict[item] + val_fobos = getattr(cliargs, item) + if item == 'cflags': + if val_cli == '-c': + match = re.search(r'(-c\s+|-c$)', val_fobos) + if match: + val_cli = '' # avoid multiple -c flags + if val_fobos and val_cli: + setattr(cliargs, item, val_fobos + ' ' + val_cli) + return + + def _set_cliargs(self, cliargs): + """ + Function for setting cliargs from fobos settings. + + Parameters + ---------- + cliargs : argparse object + """ + if self.fobos: + cliargs_dict = deepcopy(cliargs.__dict__) + if cliargs.which != 'rule': + self._set_mode(mode=cliargs.mode) + self._check_template() + self._check_local_variables() + self._set_cliargs_attributes(cliargs=cliargs, cliargs_dict=cliargs_dict) + self._check_cliargs_cflags(cliargs=cliargs, cliargs_dict=cliargs_dict) + return + + def get(self, option, mode=None, toprint=True): + """ + Method for getting options defined into the fobos file. + + Parameters + ---------- + option : str + option name + mode : {None} + eventual mode name + toprint : {True} + return of the value: if toprint==False the value is return otherwise is printed to stdout + """ + value = '' + if self.fobos: + self._set_mode(mode=mode) + if self.fobos.has_option(self.mode, option): + value = self.fobos.get(self.mode, option) + if toprint: + self.print_w(value) + return + else: + return value + + def get_output_name(self, mode=None, toprint=True): + """ + Method for building the output name accordingly to the fobos options. + + Parameters + ---------- + mode : {None} + eventual mode name + toprint : {True} + return of the value: if toprint==False the value is return otherwise is printed to stdout + """ + output = '' + build_dir = self.get(option='build_dir', mode=mode, toprint=False) + mklib = self.get(option='mklib', mode=mode, toprint=False) + if self.fobos: + self._set_mode(mode=mode) + if self.fobos.has_option(self.mode, 'output'): + output = self.fobos.get(self.mode, 'output') + output = os.path.normpath(build_dir + os.sep + output) + elif self.fobos.has_option(self.mode, 'target'): + output = self.fobos.get(self.mode, 'target') + output = os.path.splitext(os.path.basename(output))[0] + if mklib.lower() == 'shared': + output = output + '.so' + elif mklib.lower() == 'static': + output = output + '.a' + output = os.path.normpath(build_dir + os.sep + output) + # else: + # self.print_w('Error: fobos does not define neither an output not a target, output name cannot be inferred!') + if toprint: + self.print_w(output) + return + else: + return output + + def modes_list(self): + """ + Function for listing defined modes. + + Parameters + ---------- + cliargs : argparse object + """ + if self.fobos: + self.print_n('The fobos file defines the following modes:') + if self.fobos.has_option('modes', 'modes'): + modes = self.fobos.get('modes', 'modes').split() + for mode in modes: + if self.fobos.has_section(mode): + if self.fobos.has_option(mode, 'help'): + helpmsg = self.fobos.get(mode, 'help') + else: + helpmsg = '' + self.print_n(' - "' + mode + '" ' + helpmsg) + else: + self.print_w('Error: no modes are defined into the fobos file!') + sys.exit(1) + sys.exit(0) + return + + def rules_list(self, quiet=False): + """ + Function for listing defined rules. + + Parameters + ---------- + quiet : {False} + less verbose outputs than default + """ + if self.fobos: + self.print_n('The fobos file defines the following rules:') + for rule in self.fobos.sections(): + if rule.startswith('rule-'): + if self.fobos.has_option(rule, 'help'): + helpmsg = self.fobos.get(rule, 'help') + else: + helpmsg = '' + self.print_n(' - "' + rule.split('rule-')[1] + '" ' + helpmsg) + if self.fobos.has_option(rule, 'quiet'): + quiet = self.fobos.getboolean(rule, 'quiet') + for rul in self.fobos.options(rule): + if rul.startswith('rule'): + if not quiet: + self.print_n(' Command => ' + self.fobos.get(rule, rul)) + sys.exit(0) + return + + def rule_execute(self, rule, quiet=False, log=False): + """ + Function for executing selected rule. + + Parameters + ---------- + rule : str + rule name + quiet : {False} + less verbose outputs than default + log : {False} + bool for activate errors log saving + """ + if self.fobos: + self.print_n('Executing rule "' + rule + '"') + rule_name = 'rule-' + rule + if self.fobos.has_section(rule_name): + results = [] + if self.fobos.has_option(rule_name, 'quiet'): + quiet = self.fobos.getboolean(rule_name, 'quiet') + if self.fobos.has_option(rule_name, 'log'): + log = self.fobos.getboolean(rule_name, 'log') + for rul in self.fobos.options(rule_name): + if rul.startswith('rule'): + if not quiet: + self.print_n(' Command => ' + self.fobos.get(rule_name, rul)) + result = syswork(self.fobos.get(rule_name, rul)) + results.append(result) + if log: + check_results(results=results, log='rules_errors.log', print_w=self.print_w) + else: + check_results(results=results, print_w=self.print_w) + else: + self.print_w('Error: the rule "' + rule + '" is not defined into the fobos file. Defined rules are:') + self.rules_list(quiet=quiet) + sys.exit(1) + return diff --git a/release/FoBiS-1.5.7/fobis/ParsedFile.py b/release/FoBiS-1.5.7/fobis/ParsedFile.py new file mode 100644 index 0000000..66d04f0 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/ParsedFile.py @@ -0,0 +1,429 @@ +#!/usr/bin/env python +""" +ParsedFile.py, module definition of Dependency class. +This is a class designed for handling a single parsed file. +""" +try: + import graphviz as gvz + import functools + __graph__ = functools.partial(gvz.Graph, format='svg') + __digraph__ = functools.partial(gvz.Digraph, format='svg') + __styles__ = {'graph': {'fontsize': '16', + 'fontcolor': 'black', + 'bgcolor': 'white', + 'rankdir': 'BT'}, + 'nodes': {'fontname': 'Helvetica', + 'shape': 'box', + 'fontcolor': 'black', + 'color': 'black', + 'style': 'filled, rounded', + 'fillcolor': 'white'}, + 'edges': {'style': 'dashed', + 'color': 'black', + 'arrowhead': 'open', + 'fontname': 'Courier', + 'fontsize': '12', + 'fontcolor': 'black'}} + __graphviz__ = True + + def add_nodes(graph, nodes): + """ + Auxiliary function for adding nodes to the dependency graph. + + Parameters + ---------- + graph : __graph__ object + nodes : nodes to be added to the graph + """ + for node in nodes: + if isinstance(node, tuple): + graph.node(node[0], **node[1]) + else: + graph.node(node) + return graph + + def add_edges(graph, edges): + """ + Auxiliary function for adding edges to the dependency graph. + + Parameters + ---------- + graph : __graph__ object + edges : nodes to be added to the graph + """ + for edge in edges: + if isinstance(edge[0], tuple): + graph.edge(*edge[0], **edge[1]) + else: + graph.edge(*edge) + return graph + + def apply_styles(graph): + """ + Auxiliary function for adding styles to the dependency graph. + + Parameters + ---------- + graph : __graph__ object + """ + graph.graph_attr.update(('graph' in __styles__ and __styles__['graph']) or {}) + graph.node_attr.update(('nodes' in __styles__ and __styles__['nodes']) or {}) + graph.edge_attr.update(('edges' in __styles__ and __styles__['edges']) or {}) + return graph +except ImportError: + __graphviz__ = False +import operator +import os +import re +import sys +from .Dependency import Dependency +from .utils import traverse_recursive +from .utils import unique_seq +# definition of regular expressions +__str_apex__ = r"('|" + r'")' +__str_kw_include__ = r"[Ii][Nn][Cc][Ll][Uu][Dd][Ee]" +__str_kw_intrinsic__ = r"[Ii][Nn][Tt][Rr][Ii][Nn][Ss][Ii][Cc]" +__str_kw_iso_fortran_env__ = r"[Ii][Ss][Oo]_[Ff][Oo][Rr][Tt][Rr][Aa][Nn]_[Ee][Nn][Vv]" +__str_kw_iso_c_binding__ = r"[Ii][Ss][Oo]_[Cc]_[Bb][Ii][Nn][Dd][Ii][Nn][Gg]" +__str_kw_ieee_exceptions__ = r"[Ii][Ee][Ee][Ee]_[Ee][Xx][Cc][Ee][Pp][Tt][Ii][Oo][Nn][Ss]" +__str_kw_ieee_arithmetic__ = r"[Ii][Ee][Ee][Ee]_[Aa][Rr][Ii][Tt][Hh][Mm][Ee][Tt][Ii][Cc]" +__str_kw_ieee_features__ = r"[Ii][Ee][Ee][Ee]_[Ff][Ee][Aa][Tt][Uu][Rr][Ee][Ss]" +__str_kw_module__ = r"[Mm][Oo][Dd][Uu][Ll][Ee]" +__str_kw_program__ = r"[Pp][Rr][Oo][Gg][Rr][Aa][Mm]" +__str_kw_use__ = r"[Uu][Ss][Ee]" +__str_kw_mpifh__ = r"[Mm][Pp][Ii][Ff]\.[Hh]" +__str_name__ = r"(?P[a-zA-Z][a-zA-Z0-9_]*)" +__str_eol__ = r"(?P\s*!.*|\s*)?$" +# __str_f95_mod_rename__ = r"(\s*,\s*[a-zA-Z][a-zA-Z0-9_]*\s*=>\s*[a-zA-Z][a-zA-Z0-9_]*)*" +# __str_f95_mod_only__ = r"(\s*,\s*[Oo][Nn][Ll][Yy]\s*:\s*([a-zA-Z][a-zA-Z0-9_]*\s*=>\s*[a-zA-Z][a-zA-Z0-9_]*|[a-zA-Z][a-zA-Z0-9_]*))*" +__str_use_mod__ = (r"^(\s*)" + # eventual initial white spaces + __str_kw_use__ + # keyword "use" + r"(\s*,\s*.*\s*::)*" + # eventual module nature + r"(\s+)" + # 1 or more white spaces + __str_name__ + # construct name + r"(?P(.*))") +__str_use_mod_intrinsic__ = (r"^(\s*)" + # eventual initial white spaces + __str_kw_use__ + # keyword "use" + r"\s*,\s*" + __str_kw_intrinsic__ + r"\s*::.*" + # keyword intrinsic + r"(?P(.*))") +__str_use_mod_iso_fortran_env__ = (r"^(\s*)" + # eventual initial white spaces + __str_kw_use__ + # keyword "use" + r"\s+" + __str_kw_iso_fortran_env__ + # keyword intrinsic module iso_fortran_env + r"(?P(.*))") +__str_use_mod_iso_c_binding__ = (r"^(\s*)" + # eventual initial white spaces + __str_kw_use__ + # keyword "use" + r"\s+" + __str_kw_iso_c_binding__ + # keyword intrinsic module iso_c_binding + r"(?P(.*))") +__str_use_mod_ieee_exceptions__ = (r"^(\s*)" + # eventual initial white spaces + __str_kw_use__ + # keyword "use" + r"\s+" + __str_kw_ieee_exceptions__ + # keyword intrinsic module ieee_exceptions + r"(?P(.*))") +__str_use_mod_ieee_arithmetic__ = (r"^(\s*)" + # eventual initial white spaces + __str_kw_use__ + # keyword "use" + r"\s+" + __str_kw_ieee_arithmetic__ + # keyword intrinsic module ieee_arithmetic + r"(?P(.*))") +__str_use_mod_ieee_features__ = (r"^(\s*)" + # eventual initial white spaces + __str_kw_use__ + # keyword "use" + r"\s+" + __str_kw_ieee_features__ + # keyword intrinsic module ieee_features + r"(?P(.*))") +__str_include__ = (r"^(\s*|\#)" + # eventual initial white spaces or "#" character + __str_kw_include__ + # keyword "include" + r"(\s+)" + # 1 or more white spaces + __str_apex__ + # character "'" or '"' + r"(\s*)" + # eventaul white spaces + r"(?P.*)" + # name of included file + r"(\s*)" + # eventaul white spaces + __str_apex__ + # character "'" or '"' + __str_eol__) # eventual eol white space and or comment +__str_module__ = (r"^(\s*)" + # eventual initial white spaces + r"(?P" + __str_kw_module__ + r")" + # keyword "module" + r"(\s+)" + # 1 or more white spaces + __str_name__ + # construct name + __str_eol__) # eventual eol white space and or comment +__str_program__ = (r"^(\s*)" + # eventual initial white spaces + r"(?P" + __str_kw_program__ + r")" + # keyword "program" + r"(\s+)" + # 1 or more white spaces + __str_name__ + # construct name + __str_eol__) # eventual eol white space and or comment +__str_mpifh__ = (r"(.*)" + __str_kw_mpifh__ + r"(.*)") +__regex_use_mod__ = re.compile(__str_use_mod__) +__regex_include__ = re.compile(__str_include__) +__regex_program__ = re.compile(__str_program__) +__regex_module__ = re.compile(__str_module__) +__regex_use_mod_intrinsic__ = re.compile(__str_use_mod_intrinsic__) +__regex_use_mod_iso_fortran_env__ = re.compile(__str_use_mod_iso_fortran_env__) +__regex_use_mod_iso_c_binding__ = re.compile(__str_use_mod_iso_c_binding__) +__regex_use_mod_ieee_exceptions__ = re.compile(__str_use_mod_ieee_exceptions__) +__regex_use_mod_ieee_arithmetic__ = re.compile(__str_use_mod_ieee_arithmetic__) +__regex_use_mod_ieee_features__ = re.compile(__str_use_mod_ieee_features__) +__regex_use_intrinsic_modules__ = [__regex_use_mod_intrinsic__, + __regex_use_mod_iso_fortran_env__, + __regex_use_mod_iso_c_binding__, + __regex_use_mod_ieee_exceptions__, + __regex_use_mod_ieee_arithmetic__, + __regex_use_mod_ieee_features__] +__regex_mpifh__ = re.compile(__str_mpifh__) + + +class ParsedFile(object): + """ParsedFile is an object that handles a single parsed file, its attributes and methods.""" + def __init__(self, name, program=False, module=False, include=False, nomodlib=False, to_compile=False, output=None): + """ + Parameters + ---------- + name : str + file name + program : {False} + flag for tagging program file + module : {False} + flag for tagging module file + include : {False} + flag for tagging include file + nomodlib : {False} + flag for tagging library of procedures without an enclosing module (old Fortran style) + to_compile : {False} + flag for tagging file to be compiled + output : {None} + string of output file name + + Attributes + ---------- + name : str + file name + program : bool + flag for tagging program file + module : bool + flag for tagging module file + include : bool + flag for tagging include file + nomodlib : bool + flag for tagging library of procedures without an enclosing module (old Fortran style) + to_compile : bool + flag for tagging file to be compiled + output : str + string of output file name + basename : str + basename of file name + extension : str + extension of file name + timestamp : str + timestamp of file + order : + pfile_dep : list + list of parsed file dependencies + """ + self.name = name + self.program = program + self.module = module + self.include = include + self.nomodlib = nomodlib + self.to_compile = to_compile + self.output = output + self.basename = os.path.splitext(os.path.basename(self.name))[0] + self.extension = os.path.splitext(os.path.basename(self.name))[1] + self.timestamp = os.path.getmtime(self.name) + self.order = 0 + self.pfile_dep = None + self.pfile_dep_all = None + self.module_names = None + self.dependencies = None + return + + def sort_dependencies(self): + """ + Method for sorting dependencies. + """ + for dep in self.pfile_dep_all: + for other_dep in self.pfile_dep_all: + if other_dep != dep: + if dep in other_dep.pfile_dep_all: + dep.order += 1 + self.pfile_dep_all.sort(key=operator.attrgetter('order'), reverse=True) + return + + def parse(self, inc): + """ + The method parse parses the file creating its the dependencies list and the list of modules names that self eventually contains. + + Parameters + ---------- + inc : list + list of extensions of included files + """ + self.module_names = [] + self.dependencies = [] + ffile = open(self.name, "r") + for line in ffile: + matching = re.match(__regex_program__, line) + if matching: + self.program = True + matching = re.match(__regex_module__, line) + if matching: + self.module = True + self.module_names.append(matching.group('name')) + matching = re.match(__regex_use_mod__, line) + if matching: + if not any(re.match(regex, line) for regex in __regex_use_intrinsic_modules__): + if matching.group('name').lower() != 'mpi' and matching.group('name').lower() != 'omp_lib': + dep = Dependency(dtype="module", name=matching.group('name')) + self.dependencies.append(dep) + matching = re.match(__regex_include__, line) + if matching: + if not re.match(__regex_mpifh__, line): + dep = Dependency(dtype="include", name=matching.group('name')) + self.dependencies.append(dep) + ffile.close() + if not self.program and not self.module: + if os.path.splitext(os.path.basename(self.name))[1] not in inc: + self.nomodlib = True + + def save_build_log(self, builder): + """ + The method save_build_log save a log file containing information about the building options used. + + Parameters + ---------- + builder : Builder object + builder used for building self + """ + with open("build_" + self.basename + ".log", "w") as log_file: + log_file.writelines("Hierarchical dependencies list of: " + self.name + "\n") + for dep in self.pfile_dep: + log_file.writelines(" " + dep.name + "\n") + log_file.writelines(dep.str_dependencies(pref=" ")) + log_file.writelines("Complete ordered dependencies list of: " + self.name + "\n") + for dep in self.pfile_dep_all: + log_file.writelines(" " + dep.name + "\n") + log_file.writelines(builder.verbose()) + return + + def save_dep_graph(self): + """ + Method for saving dependency graph. + """ + if __graphviz__: + depgraph = __digraph__() + depgraph = add_nodes(depgraph, [self.name]) + depgraph.graph_attr['label'] = 'Dependencies graph of ' + self.name + for dep in self.pfile_dep: + depgraph = add_nodes(depgraph, [dep.name]) + depgraph = add_edges(depgraph, [(self.name, dep.name)]) + for subdep in dep.str_dependencies().split("\n"): + if subdep != '': + depgraph = add_nodes(depgraph, [subdep]) + depgraph = add_edges(depgraph, [(dep.name, subdep)]) + depgraph = apply_styles(depgraph) + depgraph.render("dependency_graph_" + self.basename) + else: + print("Module 'graphviz' not found: saving of dependency graph disabled") + return + + def save_makefile(self, makefile, builder): + """ + The method save_makefile save a minimal makefile for building the file by means of GNU Make. + """ + if not self.include: + mk_file = open(makefile, "a") + file_dep = [self.name] + for dep in self.pfile_dep: + if dep.include: + file_dep.append(dep.name) + if (len(self.pfile_dep) - len(file_dep)) >= 0: + mk_file.writelines("$(DOBJ)" + self.basename.lower() + ".o:" + "".join([" " + f for f in file_dep]) + " \\" + "\n") + for dep in self.pfile_dep[:-1]: + if not dep.include: + mk_file.writelines("\t$(DOBJ)" + os.path.splitext(os.path.basename(dep.name))[0].lower() + ".o \\" + "\n") + if not self.pfile_dep[-1].include: + mk_file.writelines("\t$(DOBJ)" + os.path.splitext(os.path.basename(self.pfile_dep[-1].name))[0].lower() + ".o\n") + else: + mk_file.writelines("$(DOBJ)" + self.basename.lower() + ".o:" + "".join([" " + f for f in file_dep]) + "\n") + mk_file.writelines("\t@echo $(COTEXT)\n") + mk_file.writelines("\t@$(FC) $(OPTSC) $(PREPROC) " + ''.join(['-I' + i + ' ' for i in builder.dinc]) + " $< -o $@\n") + mk_file.writelines("\n") + mk_file.close() + return + + def str_dependencies(self, + pref=""): # prefixing string + """ + The method str_dependencies create a string containing the depencies files list. + """ + str_dep = "" + for dep in self.pfile_dep: + str_dep += pref + dep.name + "\n" + return str_dep + + def obj_dependencies(self, exclude_programs=False): + """ + The method obj_dependencies create a list containing the dependencies object files list. + + Parameters + ---------- + exclude_programs : {False} + flag for excluding programs obj from the list + """ + if exclude_programs: + return [p.basename + ".o" for p in self.pfile_dep_all if not p.include and not p.program] + else: + return [p.basename + ".o" for p in self.pfile_dep_all if not p.include] + + def check_compile(self, obj_dir, force_compile=False): + """ + The method check_compile checks if self must be compiled. + + Parameters + ---------- + obj_dir : str + directory where compiled objects are saved + force_compile : {False} + flag for forcing (re-)compiling of all dependency + """ + if not self.include: + # verifying if dependencies are up-to-date + for dep in self.pfile_dep_all: + if not dep.include: + if force_compile: + self.to_compile = True + else: + obj = obj_dir + dep.basename + ".o" + # verifying if dep is up-to-date + if os.path.exists(obj): + if os.path.getmtime(obj) < dep.timestamp: + # found a dependency object that is out-of-date, thus self (and dep) must be compiled + self.to_compile = True + else: + # compiled object of a dependency is absent, thus self must be compiled + self.to_compile = True + else: + # verifying if dep is newer than self + if not os.path.exists(dep.name): + print(" Attention: file " + dep.name + " does not exist, but it is a dependency of file " + self.name) + sys.exit(1) + else: + # comparing the include dependency with the self-compiled-object if exist + obj = obj_dir + self.basename + ".o" + # verifying if dep is up-to-date + if os.path.exists(obj): + if os.path.getmtime(obj) < os.path.getmtime(dep.name): + # found an include that is newer than self-compiled-object, thus self must be compiled + self.to_compile = True + # verifying if self is up-to-date + if not self.to_compile: + obj = obj_dir + self.basename + ".o" + if os.path.exists(obj): + if os.path.getmtime(obj) < self.timestamp: + # the compiled object is out-of-date, thus self must be compiled + self.to_compile = True + else: + # compiled object is absent, thus self must be compiled + self.to_compile = True + + def create_pfile_dep_all(self): + """ + The method create_pfile_dep_all create a complete list of all dependencies direct and indirect. + """ + self.pfile_dep_all = [] + for path in traverse_recursive(self): + self.pfile_dep_all.append(path[-1]) + self.pfile_dep_all = unique_seq(self.pfile_dep_all) + return diff --git a/release/FoBiS-1.5.7/fobis/__init__.py b/release/FoBiS-1.5.7/fobis/__init__.py new file mode 100644 index 0000000..31605aa --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/__init__.py @@ -0,0 +1 @@ +"""FoBiS.py main package""" diff --git a/release/FoBiS-1.5.7/fobis/cli_parser.py b/release/FoBiS-1.5.7/fobis/cli_parser.py new file mode 100644 index 0000000..49baf52 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/cli_parser.py @@ -0,0 +1,158 @@ +#!/usr/bin/env python +""" +CliParser.py, module definition of FoBiS.py CLI Parser object, an istance of argparse.ArgumentParser. +""" +import argparse + +__extensions_inc__ = [".inc", ".INC", ".h", ".H"] +__extensions_old__ = [".f", ".F", ".for", ".FOR", ".fpp", ".FPP", ".fortran", ".f77", ".F77"] +__extensions_modern__ = [".f90", ".F90", ".f95", ".F95", ".f03", ".F03", ".f08", ".F08", ".f2k", ".F2K"] +__extensions_parsed__ = __extensions_inc__ + __extensions_old__ + __extensions_modern__ + + +def _build_parser(clisubparsers): + """ + Function for constructing the build cli parser. + + Parameters + ---------- + clisubparsers : argparse subparser object + """ + buildparser = clisubparsers.add_parser('build', help='Build all programs found or a specific target') + buildparser.set_defaults(which='build') + buildparser_g_compiler = buildparser.add_argument_group('compiler') + buildparser_g_compiler.add_argument('-compiler', required=False, action='store', default='intel', type=str.lower, choices=('gnu', 'intel', 'g95', 'custom'), help='Compiler used (value is case insensitive, default intel)') + buildparser_g_compiler.add_argument('-fc', required=False, action='store', default='', help='Specify the Fortran compiler statement, necessary for custom compiler specification (-compiler Custom)') + buildparser_g_compiler.add_argument('-cflags', required=False, action='store', default='-c', help='Compile flags') + buildparser_g_compiler.add_argument('-lflags', required=False, action='store', default='', help='Link flags') + buildparser_g_compiler.add_argument('-p', '--preproc', required=False, action='store', default='', help='Preprocessor flags') + buildparser_g_compiler.add_argument('-coverage', required=False, action='store_true', default=False, help='Instrument the built code with coverage analysis tools [default False]') + buildparser_g_compiler.add_argument('-modsw', required=False, action='store', default='', help='Specify the switch for setting the module searching path, necessary for custom compiler specification (-compiler Custom)') + buildparser_g_compiler.add_argument('-mpi', required=False, action='store_true', default=False, help='Use MPI enabled version of compiler') + buildparser_g_compiler.add_argument('-mklib', required=False, action='store', default=None, choices=('static', 'shared'), help='Build library instead of program (use with -target switch)') + buildparser_g_compiler.add_argument('-ch', '--cflags_heritage', required=False, action='store_true', default=False, help='Store cflags as a heritage for the next build: if cflags change re-compile all') + buildparser_g_dirs = buildparser.add_argument_group('directories') + buildparser_g_dirs.add_argument('-s', '--src', required=False, action='store', default='./', help='Root-directory of source files [default: ./]') + buildparser_g_dirs.add_argument('-dbld', '--build_dir', required=False, action='store', default='./', help='Directory containing executable objects [default: ./]') + buildparser_g_dirs.add_argument('-dobj', '--obj_dir', required=False, action='store', default='./obj/', help='Directory containing compiled objects [default: ./obj/]') + buildparser_g_dirs.add_argument('-dmod', '--mod_dir', required=False, action='store', default='./mod/', help='Directory containing .mod files of compiled objects [default: ./mod/]') + buildparser_g_dirs.add_argument('-dlib', '--lib_dir', required=False, action='store', nargs='+', default=[], help='List of directories searched for libraries [default: None]') + buildparser_g_dirs.add_argument('-i', '--include', required=False, action='store', nargs='+', default=[], help='List of directories for searching included files') + buildparser_g_files = buildparser.add_argument_group('files') + buildparser_g_files.add_argument('-t', '--target', required=False, action='store', default=None, help='Specify a target file [default: all programs found]') + buildparser_g_files.add_argument('-o', '--output', required=False, action='store', default=None, help='Specify the output file name is used with -target switch [default: basename of target]') + buildparser_g_files.add_argument('-e', '--exclude', required=False, action='store', nargs='+', default=[], help='Exclude a list of files from the building process') + buildparser_g_files.add_argument('-libs', required=False, action='store', nargs='+', default=[], help='List of external libraries used that are not into the path: specify with full paths [default: None]') + buildparser_g_files.add_argument('-vlibs', required=False, action='store', nargs='+', default=[], help='List of external libraries used that are not into the path and that are volatile (can change thus triggering re-building): specify with full paths [default: None]') + buildparser_g_files.add_argument('-ext_libs', required=False, action='store', nargs='+', default=[], help='List of external libraries used that are into compiler path [default: None]') + buildparser_g_files.add_argument('-ext_vlibs', required=False, action='store', nargs='+', default=[], help='List of external libraries used that are into compiler path and that are volatile (can change thus triggering re-building) [default: None]') + buildparser_g_files.add_argument('-dependon', required=False, action='store', nargs='+', default=[], help='List of interdependent external fobos file (and mode) for interdependent building [default: None]') + buildparser_g_files.add_argument('-inc', required=False, action='store', nargs='+', default=__extensions_inc__, help='List of extensions for include files [default: ' + str(__extensions_inc__) + ']') + buildparser_g_files.add_argument('-extensions', required=False, action='store', nargs='+', default=__extensions_parsed__, help='List of extensions of parsed files [default: ' + str(__extensions_parsed__) + ']') + buildparser_g_fobos = buildparser.add_argument_group('fobos') + buildparser_g_fobos.add_argument('-f', '--fobos', required=False, action='store', default=None, help='Specify a "fobos" file named differently from "fobos"') + buildparser_g_fobos.add_argument('-fci', '--fobos_case_insensitive', required=False, action='store_true', default=False, help='Assume fobos inputs as case insensitive [defaul: False, case sensitive]') + buildparser_g_fobos.add_argument('-mode', required=False, action='store', default=None, help='Select a mode defined into a fobos file') + buildparser_g_fobos.add_argument('-lmodes', required=False, action='store_true', default=False, help='List the modes defined into a fobos file') + buildparser_g_preform = buildparser.add_argument_group('PreForM.py') + buildparser_g_preform.add_argument('-pfm', '--preform', required=False, action='store_true', default=False, help='Use PreForM.py pre-processor for pre-processing sources file') + buildparser_g_preform.add_argument('-dpfm', '--pfm_dir', required=False, action='store', default=None, help='Directory containing the sources processed with PreForM.py [default: none, the processed files are removed after used]') + buildparser_g_preform.add_argument('-epfm', '--pfm_ext', required=False, action='store', nargs='+', default=[], help='List of custom-defined file extensions to be preprocessed by PreForM.py [default: none, all files are preprocessed if PreForM.py is used]') + buildparser_g_fancy = buildparser.add_argument_group('fancy') + buildparser_g_fancy.add_argument('-force_compile', required=False, action='store_true', default=False, help='Force to (re-)compile all [default: False]') + buildparser_g_fancy.add_argument('-colors', required=False, action='store_true', default=False, help='Activate colors in shell prints [default: no colors]') + buildparser_g_fancy.add_argument('-l', '--log', required=False, action='store_true', default=False, help='Activate the creation of a log file [default: no log file]') + buildparser_g_fancy.add_argument('-graph', required=False, action='store_true', default=False, help='Generate a dependencies graph by means of graphviz [default false]') + buildparser_g_fancy.add_argument('-q', '--quiet', required=False, action='store_true', default=False, help='Less verbose than default [default false]') + buildparser_g_fancy.add_argument('-verbose', required=False, action='store_true', default=False, help='Extremely verbose outputs for debugging FoBiS.py [default false]') + buildparser_g_fancy.add_argument('-j', '--jobs', required=False, action='store', default=1, type=int, help='Specify the number of concurrent jobs used for compiling dependencies [default 1]') + buildparser_g_fancy.add_argument('-m', '--makefile', required=False, action='store', default=None, help='Generate a GNU Makefile for building the project', metavar='MAKEFILE_name') + return + + +def _clean_parser(clisubparsers): + """ + Function for constructing the clean cli parser. + + Parameters + ---------- + clisubparsers : argparse subparser object + """ + cleanparser = clisubparsers.add_parser('clean', help='Clean project: remove all OBJs and MODs files... use carefully') + cleanparser.set_defaults(which='clean') + cleanparser_g_compiler = cleanparser.add_argument_group('compiler') + cleanparser_g_compiler.add_argument('-only_obj', required=False, action='store_true', default=False, help='Clean only compiled objects and not also built targets') + cleanparser_g_compiler.add_argument('-only_target', required=False, action='store_true', default=False, help='Clean only built targets and not also compiled objects') + cleanparser_g_compiler.add_argument('-mklib', required=False, action='store', default=None, help='Build library instead of program (use with -target switch); usage: -mklib static or -mklib shared') + cleanparser_g_compiler.add_argument('-ch', '--cflags_heritage', required=False, action='store_true', default=False, help='Store cflags as a heritage for the next build: if cflags change re-compile all') + cleanparser_g_compiler.add_argument('-coverage', required=False, action='store_true', default=False, help='Clean files used for performing coverage analysis [default False]') + cleanparser_g_dirs = cleanparser.add_argument_group('directories') + cleanparser_g_dirs.add_argument('-dobj', '--obj_dir', required=False, action='store', default='./obj/', help='Directory containing compiled objects [default: ./obj/]') + cleanparser_g_dirs.add_argument('-dmod', '--mod_dir', required=False, action='store', default='./mod/', help='Directory containing .mod files of compiled objects [default: ./mod/]') + cleanparser_g_dirs.add_argument('-dbld', '--build_dir', required=False, action='store', default='./', help='Directory containing executable objects [default: ./]') + cleanparser_g_files = cleanparser.add_argument_group('files') + cleanparser_g_files.add_argument('-t', '--target', required=False, action='store', default=None, help='Specify a target file [default: all programs found]') + cleanparser_g_files.add_argument('-o', '--output', required=False, action='store', default=None, help='Specify the output file name is used with -target switch [default: basename of target]') + cleanparser_g_files.add_argument('-extensions', required=False, action='store', nargs='+', default=__extensions_parsed__, help='List of extensions of parsed files [default: ' + str(__extensions_parsed__) + ']') + cleanparser_g_fobos = cleanparser.add_argument_group('fobos') + cleanparser_g_fobos.add_argument('-f', '--fobos', required=False, action='store', default=None, help='Specify a "fobos" file named differently from "fobos"') + cleanparser_g_fobos.add_argument('-fci', '--fobos_case_insensitive', required=False, action='store_true', default=False, help='Assume fobos inputs as case insensitive [defaul: False, case sensitive]') + cleanparser_g_fobos.add_argument('-mode', required=False, action='store', default=None, help='Select a mode defined into a fobos file') + cleanparser_g_fobos.add_argument('-lmodes', required=False, action='store_true', default=False, help='List the modes defined into a fobos file') + cleanparser_g_fancy = cleanparser.add_argument_group('fancy') + cleanparser_g_fancy.add_argument('-colors', required=False, action='store_true', default=False, help='Activate colors in shell prints [default: no colors]') + cleanparser_g_fancy.add_argument('-q', '--quiet', required=False, action='store_true', default=False, help='Less verbose than default [default false]') + cleanparser_g_fancy.add_argument('-verbose', required=False, action='store_true', default=False, help='Extremely verbose outputs for debugging FoBiS.py [default false]') + return + + +def _rule_parser(clisubparsers): + """ + Function for constructing the rule cli parser. + + Parameters + ---------- + clisubparsers : argparse subparser object + """ + rulexparser = clisubparsers.add_parser('rule', help='Execute rules defined into a fobos file') + rulexparser.set_defaults(which='rule') + rulexparser_g_fobos = rulexparser.add_argument_group('fobos file') + rulexparser_g_fobos.add_argument('-f', '--fobos', required=False, action='store', default=None, help='Specify a "fobos" file named differently from "fobos"') + rulexparser_g_fobos.add_argument('-mode', required=False, action='store', default=None, help='Select a mode defined into a fobos file') + rulexparser_g_fobos.add_argument('-fci', '--fobos_case_insensitive', required=False, action='store_true', default=False, help='Assume fobos inputs as case insensitive [defaul: False, case sensitive]') + rulexparser_g_rules = rulexparser.add_argument_group('rules') + rulexparser_g_rules.add_argument('-ex', '--execute', required=False, action='store', default=None, help='Specify a rule (defined into fobos file) to be executed', metavar='RULE') + rulexparser_g_rules.add_argument('-ls', '--list', required=False, action='store_true', default=False, help='List the rules defined into a fobos file') + rulexparser_g_intrinsic = rulexparser.add_argument_group('intrinsic rules') + rulexparser_g_intrinsic.add_argument('-get', required=False, action='store', default=None, help='Intrinsic rule for getting options defined into fobos, e.g. -get build_dir') + rulexparser_g_intrinsic.add_argument('-get_output_name', required=False, action='store_true', default=False, help='Intrinsic rule for getting the final output name accordingly to options defined into fobos') + rulexparser_g_intrinsic.add_argument('-ford', required=False, action='store', default=None, help='Intrinsic rule for building documentation by means of Ford tool', metavar='project-file.md') + rulexparser_g_intrinsic.add_argument('-coverage', required=False, action='store', default=False, help='Intrinsic rule for performing coverage analysis', choices=('gnu', 'intel')) + rulexparser_g_fancy = rulexparser.add_argument_group('fancy') + rulexparser_g_fancy.add_argument('-q', '--quiet', required=False, action='store_true', default=False, help='Less verbose than default [default false]') + rulexparser_g_fancy.add_argument('-verbose', required=False, action='store_true', default=False, help='Extremely verbose outputs for debugging FoBiS.py [default false]') + rulexparser_g_fancy.add_argument('-colors', required=False, action='store_true', default=False, help='Activate colors in shell prints [default: no colors]') + return + + +def cli_parser(appname, description, version): + """ + Function for creating the FoBiS.py Command Line Interface. + + Parameters + ---------- + appname : str + name of the main application + description : str + description of the application + version : str + current application version + """ + cliparser = argparse.ArgumentParser(prog=appname, description=description) + cliparser.add_argument('-v', '--version', action='version', help='Show version', version='%(prog)s ' + version) + clisubparsers = cliparser.add_subparsers(title='Commands', description='Valid commands') + + _build_parser(clisubparsers) + _clean_parser(clisubparsers) + _rule_parser(clisubparsers) + return cliparser diff --git a/release/FoBiS-1.5.7/fobis/config.py b/release/FoBiS-1.5.7/fobis/config.py new file mode 100644 index 0000000..4e2e47c --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/config.py @@ -0,0 +1,504 @@ +#!/usr/bin/env python +""" +config.py, module definition of FoBiS.py configuration. +""" +import hashlib +import os +import re +import sys +from .Builder import Builder +from .Cleaner import Cleaner +from .Colors import Colors +from .Fobos import Fobos +from .ParsedFile import ParsedFile +from .cli_parser import cli_parser +from .utils import syswork +from .utils import dependency_hiearchy +from .utils import remove_other_main + +__appname__ = "FoBiS.py" +__version__ = "1.5.7" +__author__ = "Stefano Zaghi" +__author_email__ = "stefano.zaghi@gmail.com" +__license__ = "GNU General Public License v3 (GPLv3)" +__url__ = "https://github.com/szaghi/FoBiS" +__description__ = "a Fortran Building System for poor men" +__long_description__ = "FoBiS.py, a Fortran Building System for poor men, is a KISS tool for automatic building modern Fortran projects, it being able to automatically resolve inter-modules dependancy hierarchy." + + +class FoBiSConfig(object): + """ + Object handling FoBiS.py configuration + """ + def __init__(self): + """ + Attributes + ---------- + cliargs : {None} + CLI arguments, argparse object + fobos : {None} + Fobos object, the FoBiS.py makefile + colors : {Colors} + Colors object + """ + self.cliargs = None + self.fobos = None + self.colors = Colors() + return + + def _update_colors(self): + """ + Method for updating colors settings. + """ + if not self.cliargs.colors: + self.colors.disable() + else: + self.colors.enable() + return + + def _print_b(self, string): + """ + Method for printing string with bold color. + + Parameters + ---------- + string : str + string to be printed + """ + self.colors.print_b(string) + return + + def _print_r(self, string): + """ + Method for printing string with red color. + + Parameters + ---------- + string : str + string to be printed + """ + self.colors.print_r(string) + return + + def _update_extensions(self): + """Method for updating files extensions""" + if self.cliargs.which == 'build': + for inc in self.cliargs.inc: + if inc not in self.cliargs.extensions: + self.cliargs.extensions.append(inc) + if self.cliargs.which == 'build': + if len(self.cliargs.pfm_ext) > 0: + self.cliargs.extensions += self.cliargs.pfm_ext + return + + def _sanitize_paths(self): + """ + Method for sanitizing paths. + """ + if self.cliargs.which == 'clean' or self.cliargs.which == 'build': + self.cliargs.build_dir = os.path.normpath(self.cliargs.build_dir) + os.sep + self.cliargs.mod_dir = os.path.normpath(self.cliargs.mod_dir) + os.sep + self.cliargs.obj_dir = os.path.normpath(self.cliargs.obj_dir) + os.sep + if self.cliargs.which == 'build': + self.cliargs.src = os.path.normpath(self.cliargs.src) + os.sep + return + + def _check_cflags_heritage(self): + """ + Method for checking the heritage of cflags: if a file named '.cflags.heritage' is found into the root dir FoBiS.py is runned that file + is sourced and compared with the actual cflags and in case they differ the project is forced to be recompiled. The actual cflags are saved, + in any case, into that file. + """ + if self.cliargs.which == 'build': + if self.cliargs.cflags_heritage: + if os.path.exists(self.cliargs.build_dir + '.cflags.heritage'): + cflags_old = open(self.cliargs.build_dir + '.cflags.heritage').read() + if self.cliargs.cflags != cflags_old: + self.cliargs.force_compile = True + self._print_r("The present cflags are different from the heritages one: forcing to (re-)compile all") + with open(self.cliargs.build_dir + '.cflags.heritage', 'w') as chf: + chf.writelines(self.cliargs.cflags) + return + + def _postinit(self): + """ + Method for post-initialization update of config attributes, after CLI and fobos parsing. + """ + self._update_colors() + self._update_extensions() + self._sanitize_paths() + self._check_cflags_heritage() + self._check_vlibs_md5sum() + self._check_ext_vlibs_md5sum() + self._check_interdependent_fobos() + return + + @staticmethod + def _check_md5sum(filename, hashfile): + """ + Function for checking the md5sum hash of a file, compares with an eventual hashfile into which the hash is finally saved. + + Parameters + ---------- + filename : str + file name (with path) of file to be hashed + hashfile : str + file eventually present containing the hash and into which the hash is finally saved + + Returns + ------- + 2 bools containing the previously existance of the hashfile and the result of hashes comparison + """ + md5sum = hashlib.md5(open(filename, 'rb').read()).hexdigest() + hashexist = os.path.exists(hashfile) + comparison = False + if hashexist: + md5sum_old = open(hashfile).read() + comparison = md5sum == md5sum_old + with open(hashfile, 'w') as md5: + md5.writelines(md5sum) + return hashexist, comparison + + def _check_vlibs_md5sum(self): + """ + Method for checking if the md5sum of volatile libraries has changed and, in case, a re-build is triggered. + """ + if self.cliargs.which == 'build': + if len(self.cliargs.vlibs) > 0: + for lib in self.cliargs.vlibs: + if not os.path.exists(lib): + self._print_r("The volatile library " + lib + " is not found!") + # sys.exit(1) + hashfile, comparison = self._check_md5sum(filename=lib, hashfile=self.cliargs.build_dir + '.' + os.path.basename(lib) + '.md5') + if hashfile: + self.cliargs.force_compile = (not comparison) or self.cliargs.force_compile + if not comparison: + self._print_r("The volatile library " + lib + " is changed with respect the last building: forcing to (re-)compile all") + return + + def _check_ext_vlibs_md5sum(self): + """ + Method for checking if the md5sum of volatile external libraries has changed and, in case, a re-build is triggered. + """ + if self.cliargs.which == 'build': + if len(self.cliargs.ext_vlibs) > 0: + for lib in self.cliargs.ext_vlibs: + lib_found = False + if len(self.cliargs.lib_dir) > 0: + for dirp in self.cliargs.lib_dir: + libpath = os.path.join(dirp, 'lib' + lib + '.a') + lib_found = os.path.exists(libpath) + if lib_found: + break + libpath = os.path.join(dirp, 'lib' + lib + '.so') + lib_found = os.path.exists(libpath) + if lib_found: + break + else: + libpath = 'lib' + lib + '.a' + lib_found = os.path.exists(libpath) + if not lib_found: + libpath = 'lib' + lib + '.so' + lib_found = os.path.exists(libpath) + if not lib_found: + self._print_r("The volatile library " + lib + " is not found!") + # sys.exit(1) + hashfile, comparison = self._check_md5sum(filename=libpath, hashfile=self.cliargs.build_dir + '.' + os.path.basename(libpath) + '.md5') + if hashfile: + self.cliargs.force_compile = (not comparison) or self.cliargs.force_compile + if not comparison: + self._print_r("The volatile library " + lib + " is changed with respect the last building: forcing to (re-)compile all") + return + + def _add_include_paths(self, add_paths): + """ + Method for adding include files search paths + + Parameters + ---------- + add_paths : list + added paths, each element has 3 elements: path[0] libraries search path, path[1] include files search path, path[2] the library + """ + self._print_r("Include files search paths (include):") + for path in add_paths: + if self.cliargs.include: + self.cliargs.include.append(path[1]) + else: + self.cliargs.include = [path[1]] + self._print_r("- " + path[1]) + return + + def _add_lib_dir_paths(self, add_paths): + """ + Method for adding libraries search paths + + Parameters + ---------- + add_paths : list + added paths, each element has 3 elements: path[0] libraries search path, path[1] include files search path, path[2] the library + """ + self._print_r("Libraries search paths (lib_dir):") + for path in add_paths: + if path[2][1].lower() == 'indirect': + if self.cliargs.lib_dir: + self.cliargs.lib_dir.append(path[0]) + else: + self.cliargs.lib_dir = [path[0]] + self._print_r("- " + path[0]) + return + + def _add_ext_libs_paths(self, add_paths): + """ + Method for adding libraries paths + + Parameters + ---------- + add_paths : list + added paths, each element has 3 elements: path[0] libraries search path, path[1] include files search path, path[2] the library + """ + self._print_r("Libraries paths:") + for path in add_paths: + if path[2][1].lower() == 'indirect': + lib = re.sub(r"^lib", '', os.path.basename(path[2][0])) + lib = re.sub(r"\.a$", '', lib) + lib = re.sub(r"\.so$", '', lib) + if self.cliargs.ext_libs: + self.cliargs.ext_libs.append(lib) + else: + self.cliargs.ext_libs = [lib] + self._print_r("- (ext_libs) " + lib) + else: + if self.cliargs.libs: + self.cliargs.libs.append(path[2][0]) + else: + self.cliargs.libs = [path[2][0]] + self._print_r("- (libs) " + path[2][0]) + return + + def _add_auxiliary_paths(self, add_paths): + """ + Method for adding auxiliary paths to default searched ones. + + Parameters + ---------- + add_paths : list + added paths, each element has 3 elements: path[0] libraries search path, path[1] include files search path, path[2] the library + """ + self._print_r("The following auxiliary paths have been added") + self._add_include_paths(add_paths=add_paths) + self._add_lib_dir_paths(add_paths=add_paths) + self._add_ext_libs_paths(add_paths=add_paths) + return + + def _check_interdependent_fobos(self): + """ + Method for checking interdependency project by its fobos. + """ + if self.cliargs.which == 'build' and not self.cliargs.lmodes: + if len(self.cliargs.dependon) > 0: + add_paths = [] + for dependon in self.cliargs.dependon: + fobos_path = os.path.dirname(dependon) + fobos_file = os.path.basename(dependon) + mode = '' + linking = '' + matching = re.match(r"^.*\(\((?P.*)\)\).*$", fobos_file) + if matching: + linking = matching.group('link') + fobos_file = re.sub(r"\(\(.*\)\)", '', fobos_file) + if ":" in fobos_file: + mode = os.path.basename(fobos_file).split(":")[1] + fobos_file = os.path.basename(fobos_file).split(":")[0] + old_pwd = os.getcwd() + os.chdir(old_pwd + os.sep + fobos_path) + if mode != '': + self._print_b("Building dependency " + fobos_file + " into " + fobos_path + " with mode " + mode) + result = syswork("FoBiS.py build -f " + fobos_file + " -mode " + mode) + dbld = syswork("FoBiS.py rule -f " + fobos_file + " -mode " + mode + " -get build_dir") + dmod = syswork("FoBiS.py rule -f " + fobos_file + " -mode " + mode + " -get mod_dir") + output = syswork("FoBiS.py rule -f " + fobos_file + " -mode " + mode + " -get_output_name") + else: + self._print_b("Building dependency " + fobos_file + " into " + fobos_path + " with default mode") + result = syswork("FoBiS.py build -f " + fobos_file) + dbld = syswork("FoBiS.py rule -f " + fobos_file + " -get build_dir") + dmod = syswork("FoBiS.py rule -f " + fobos_file + " -get mod_dir") + output = syswork("FoBiS.py rule -f " + fobos_file + " -get_output_name") + os.chdir(old_pwd) + print(result[1]) + if result[0] != 0: + sys.exit(result[0]) + add_paths.append([os.path.normpath(fobos_path + os.sep + dbld[1].strip('\n')) + os.sep, + os.path.normpath(fobos_path + os.sep + dbld[1].strip('\n') + os.sep + dmod[1].strip('\n')) + os.sep, + [os.path.normpath(fobos_path + os.sep + output[1].strip('\n')), linking]]) + self._add_auxiliary_paths(add_paths) + return + + def _get_parsed_files_list(self): + """ + Function for creating the list of parsed files + + Returns + ------- + list + list of ParsedFile objects + """ + pfiles = [] + # parsing files loop + for root, _, files in os.walk(self.cliargs.src): + for filename in files: + if any(os.path.splitext(os.path.basename(filename))[1] == ext for ext in self.cliargs.extensions): + if os.path.basename(filename) not in [os.path.basename(exc) for exc in self.cliargs.exclude]: + filen = os.path.join(root, filename) + pfile = ParsedFile(name=filen) + pfile.parse(inc=self.cliargs.inc) + pfiles.append(pfile) + return pfiles + + def _coverage(self): + """ + Method for running coverage analysis. + """ + cmd = '' + if self.cliargs.coverage.lower() == 'intel': + cmd = 'profmerge -a ; codecov -spi pgopti.spi -dpi pgopti.dpi' + elif self.cliargs.coverage.lower() == 'gnu': + cmd = 'gcovr -r .' + return cmd + + def _build(self): + """ + Method for running FoBiS.py in building mode. + """ + builder = Builder(cliargs=self.cliargs, print_n=self._print_b, print_w=self._print_r) + pfiles = self._get_parsed_files_list() + # building dependencies hierarchy + dependency_hiearchy(builder=builder, pfiles=pfiles, print_w=self._print_r, force_compile=self.cliargs.force_compile) + # compiling independent files that are libraries of procedures not contained into a module (old Fortran style) + nomodlibs = [] + for pfile in pfiles: + if pfile.nomodlib: + builder.build(file_to_build=pfile, verbose=self.cliargs.verbose, log=self.cliargs.log) + nomodlibs.append(pfile.basename + ".o") + # building target or all programs found + for pfile in pfiles: + if self.cliargs.target: + if os.path.basename(self.cliargs.target) == os.path.basename(pfile.name): + self._print_b(builder.verbose(quiet=self.cliargs.quiet)) + if pfile.program: + remove_other_main(builder=builder, pfiles=pfiles, mysefl=pfile) + builder.build(file_to_build=pfile, output=self.cliargs.output, nomodlibs=nomodlibs, mklib=self.cliargs.mklib, verbose=self.cliargs.verbose, log=self.cliargs.log) + if self.cliargs.log: + pfile.save_build_log(builder=builder) + if self.cliargs.graph: + pfile.save_dep_graph() + else: + if pfile.program: + self._print_b(builder.verbose(quiet=self.cliargs.quiet)) + remove_other_main(builder=builder, pfiles=pfiles, mysefl=pfile) + builder.build(file_to_build=pfile, output=self.cliargs.output, nomodlibs=nomodlibs, verbose=self.cliargs.verbose, log=self.cliargs.log) + if self.cliargs.log: + pfile.save_build_log(builder=builder) + if self.cliargs.graph: + pfile.save_dep_graph() + return + + def _clean(self): + """ + Method for running FoBiS.py in cleaning mode. + """ + cleaner = Cleaner(cliargs=self.cliargs, print_w=self._print_r) + if not self.cliargs.only_obj and not self.cliargs.only_target: + cleaner.clean_mod() + cleaner.clean_obj() + cleaner.clean_target() + if self.cliargs.only_obj: + cleaner.clean_mod() + cleaner.clean_obj() + if self.cliargs.only_target: + cleaner.clean_target() + return + + def _get_cli(self, fake_args=None): + """ + Method for parsing CLI arguments. + + Parameters + ---------- + fake_args : {None} + list containing fake CLAs for using without CLI + """ + cliparser = cli_parser(appname=__appname__, description=__description__, version=__version__) + if fake_args: + self.cliargs = cliparser.parse_args(fake_args) + else: + self.cliargs = cliparser.parse_args() + self.fobos = Fobos(cliargs=self.cliargs, print_n=self._print_b, print_w=self._print_r) + self._postinit() + return + + def _reset(self): + """ + Method for restoring default (init) values. + """ + self.__init__() + return + + def printf(self): + """ + Method for returing a pretty formatted printable string of config settings. + """ + string = ["FoBiS.py settings\n"] + options = vars(self.cliargs) + for key, value in options.items(): + string.append(str(key) + ": " + str(value)) + return "".join([s + "\n" for s in string]) + + def run_fobis(self, fake_args=None): + """ + Method for finnaly running FoBiS.py accordingly to the user configuration. + + Parameters + ---------- + fake_args : {None} + list containing fake CLAs for using without CLI + """ + self._reset() + self._get_cli(fake_args=fake_args) + if self.cliargs.which == 'rule': + if self.cliargs.list: + self.fobos.rules_list(quiet=self.cliargs.quiet) + elif self.cliargs.execute: + self.fobos.rule_execute(rule=self.cliargs.execute, quiet=self.cliargs.quiet) + elif self.cliargs.get: + self.fobos.get(option=self.cliargs.get, mode=self.cliargs.mode) + elif self.cliargs.get_output_name: + self.fobos.get_output_name(mode=self.cliargs.mode) + elif self.cliargs.ford: + result = syswork("ford " + self.cliargs.ford) + if result[0] != 0: + self._print_r(result[1]) + else: + self._print_b(result[1]) + elif self.cliargs.coverage: + result = syswork(self._coverage()) + if result[0] != 0: + self._print_r(result[1]) + else: + self._print_b(result[1]) + else: + if self.cliargs.lmodes: + self.fobos.modes_list() + sys.exit(0) + + if self.cliargs.which == 'clean': + self._clean() + if self.cliargs.which == 'build': + self._build() + return + + +# global variables +__initialized__ = False +if not __initialized__: + __config__ = FoBiSConfig() + __initialized__ = True diff --git a/release/FoBiS-1.5.7/fobis/fobis.py b/release/FoBiS-1.5.7/fobis/fobis.py new file mode 100644 index 0000000..3f05e40 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/fobis.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +""" +FoBiS.py, Fortran Building System for poor men +""" +# modules loading +import sys +from .config import __config__ + + +def main(): + """ + Main function. + """ + __config__.run_fobis() + sys.exit(0) + +if __name__ == '__main__': + main() diff --git a/release/FoBiS-1.5.7/fobis/utils.py b/release/FoBiS-1.5.7/fobis/utils.py new file mode 100644 index 0000000..79c1cf6 --- /dev/null +++ b/release/FoBiS-1.5.7/fobis/utils.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python +""" +utils.py, module definition of FoBiS.py util functions. +""" +import os +import subprocess +import sys + + +def print_fake(input_obj): + """Renaming print.""" + print(input_obj) + return + + +def syswork(cmd): + """ + Function for executing system command 'cmd': for compiling and linking files. + """ + error = 0 + try: + output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as err: + error = err.returncode + output = err.output + return [error, str(output.decode("utf-8"))] + + +def traverse_recursive(parsed_file, path=list()): + """ + The function traverse_recursive performs a yield-recursive traversing of pfile direct dependencies. + """ + path.append(parsed_file) + yield path + for dep in parsed_file.pfile_dep: + if dep != parsed_file: + for path in traverse_recursive(dep, path): + yield path + if path: + path.pop() + + +def unique_seq(seq): + """ + The function unique_seq returns the input sequence removing duplicated elements but peserving the original order. + """ + seen = set() + seen_add = seen.add + return [x for x in seq if x not in seen and not seen_add(x)] + + +def module_is_in(pfiles, module): + """ + Function finding the parsed file containing the desidered module. + + Parameters + ---------- + pfiles : list + list of parsed files + module : str + module name + + Returns + ------- + file_name : str + name of file containing the module + number : int + number of file containing the module + """ + file_name = "" + number = -1 + for fnum, parsed_file in enumerate(pfiles): + if parsed_file.module: + for module_name in parsed_file.module_names: + if module_name.lower() == module.lower(): + file_name = parsed_file.name + number = fnum + break + return file_name, number + + +def include_is_in(pfiles, include): + """ + Function finding the parsed file containing the desidered include-file. + + Parameters + ---------- + pfiles : list + list of parsed files + include : str + include-file name + + Returns + ------- + file_name : str + name of file containing the include-file + number : int + number of file containing the include-file + """ + file_name = "" + number = -1 + for fnum, parsed_file in enumerate(pfiles): + if os.path.basename(parsed_file.name) == include: + file_name = parsed_file.name + number = fnum + break + return file_name, number + + +def dependency_hiearchy(builder, pfiles, print_w=None, force_compile=False): + """ + The function dependency_hiearchy builds parsed files hierarchy. + + Paramters + --------- + builder : Builder object + pfiles : list + list of ParsedFile objects + print_w : function + function for printing emphized warning message + force_compile : {False} + flag for forcing (re-)compiling of all dependency + """ + if print_w is None: + print_wm = print_fake + else: + print_wm = print_w + + # direct dependencies list used after for building indirect (complete) dependencies list + for parsed_file in pfiles: + parsed_file.pfile_dep = [] + for dep in parsed_file.dependencies: + if dep.type == "module": + dep.file, fnum = module_is_in(pfiles=pfiles, module=dep.name) + if fnum > -1: + if not pfiles[fnum] in parsed_file.pfile_dep: + parsed_file.pfile_dep.append(pfiles[fnum]) + else: + # there is no source containg the searched module, try to find it into a precompiled mod file into eventually included paths + for dinc in builder.dinc: + for _, _, files in os.walk(dinc): + for filename in files: + if os.path.splitext(os.path.basename(filename))[0].lower() == dep.name.lower() and os.path.splitext(os.path.basename(filename))[1].lower() == '.mod': + fnum = 0 + break + if fnum == 0: + break + if fnum == 0: + break + if fnum != 0: + print_wm("Attention: the file '" + parsed_file.name + "' depends on '" + dep.name + "' that is unreachable") + # sys.exit(1) + if dep.type == "include": + dep.file, fnum = include_is_in(pfiles=pfiles, include=dep.name) + if fnum > -1: + if not pfiles[fnum] in parsed_file.pfile_dep: + pfiles[fnum].program = False + pfiles[fnum].module = False + pfiles[fnum].nomodlib = False + pfiles[fnum].include = True + parsed_file.pfile_dep.append(pfiles[fnum]) + if not os.path.dirname(pfiles[fnum].name) in builder.dinc: + builder.dinc.append(os.path.dirname(pfiles[fnum].name)) + else: + print_wm("Attention: the file '" + parsed_file.name + "' depends on '" + dep.name + "' that is unreachable") + # sys.exit(1) + # indirect dependency list + for parsed_file in pfiles: + parsed_file.create_pfile_dep_all() + # using the just created hiearchy for checking which files must be (re-)compiled + for parsed_file in pfiles: + parsed_file.check_compile(obj_dir=builder.obj_dir, force_compile=force_compile) + + +def remove_other_main(builder, pfiles, mysefl): + """ + The function remove_other_main removes all compiled objects of other program than the current target under building. + """ + for parsed_file in pfiles: + if parsed_file.program and parsed_file.name != mysefl.name: + if os.path.exists(builder.obj_dir + parsed_file.basename + ".o"): + os.remove(builder.obj_dir + parsed_file.basename + ".o") + + +def check_results(results, log=None, print_w=None): + """ + Method for checking the result of system commands exectution. + + Parameters + ---------- + results : list + list of exectuions results + log : {False} + bool for activate errors log saving + print_w : {None} + function for printing emphized warning message + """ + if print_w is None: + print_wm = print_fake + else: + print_wm = print_w + + if not all(v[0] == 0 for v in results): + for result in results: + if result[0] != 0: + sys.stderr.write(result[1]) + if log: + with open(log, 'a') as logerror: + logerror.writelines(result[1]) + sys.exit(1) + if not all(v[1] == '' for v in results): + for result in results: + if result[1] != '': + print_wm(result[1]) + return diff --git a/release/FoBiS-1.5.7/scripts/FoBiS.py b/release/FoBiS-1.5.7/scripts/FoBiS.py new file mode 100755 index 0000000..5438c0e --- /dev/null +++ b/release/FoBiS-1.5.7/scripts/FoBiS.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +"""Wrapper of FoBiS.py program extracted from fobis package""" +from fobis.fobis import main +if __name__ == '__main__': + main() diff --git a/release/FoBiS-1.5.7/scripts/setup.py b/release/FoBiS-1.5.7/scripts/setup.py new file mode 100755 index 0000000..4118cac --- /dev/null +++ b/release/FoBiS-1.5.7/scripts/setup.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +"""Setup script for install FoBiS.py""" +# import pypandoc +import re +from setuptools import setup +__source__ = open('fobis/config.py').read() +__license__ = re.search(r'^__license__\s*=\s*"(.*)"', __source__, re.M).group(1) + +if __name__ == '__main__': + setup(name = re.search(r'^__appname__\s*=\s*"(.*)"', __source__, re.M).group(1), + version = re.search(r'^__version__\s*=\s*"(.*)"', __source__, re.M).group(1), + description = re.search(r'^__description__\s*=\s*"(.*)"', __source__, re.M).group(1), + long_description = re.search(r'^__long_description__\s*=\s*"(.*)"', __source__, re.M).group(1), + # long_description = pypandoc.convert('README.md', 'rst'), + author = re.search(r'^__author__\s*=\s*"(.*)"', __source__, re.M).group(1), + author_email = re.search(r'^__author_email__\s*=\s*"(.*)"', __source__, re.M).group(1), + url = re.search(r'^__url__\s*=\s*"(.*)"', __source__, re.M).group(1), + scripts = ['FoBiS.py'], + packages = ['fobis'], + py_modules = [], + classifiers = ['Development Status :: 5 - Production/Stable', + 'License :: OSI Approved :: '+__license__, + 'Environment :: Console', + 'Intended Audience :: End Users/Desktop', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Topic :: Text Processing'], + entry_points = { 'console_scripts': [] }, + extras_require = { 'PreForM.py': ["PreForM.py>=v1.1.1"], + 'FORD': ["FORD>=1.1.0"], + 'graphviz': ["graphviz>=0.4.2"]}) + # install_requires = [ "multiprocessing" ]) diff --git a/release/FoBiS-1.5.7/setup.py b/release/FoBiS-1.5.7/setup.py new file mode 100755 index 0000000..4118cac --- /dev/null +++ b/release/FoBiS-1.5.7/setup.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +"""Setup script for install FoBiS.py""" +# import pypandoc +import re +from setuptools import setup +__source__ = open('fobis/config.py').read() +__license__ = re.search(r'^__license__\s*=\s*"(.*)"', __source__, re.M).group(1) + +if __name__ == '__main__': + setup(name = re.search(r'^__appname__\s*=\s*"(.*)"', __source__, re.M).group(1), + version = re.search(r'^__version__\s*=\s*"(.*)"', __source__, re.M).group(1), + description = re.search(r'^__description__\s*=\s*"(.*)"', __source__, re.M).group(1), + long_description = re.search(r'^__long_description__\s*=\s*"(.*)"', __source__, re.M).group(1), + # long_description = pypandoc.convert('README.md', 'rst'), + author = re.search(r'^__author__\s*=\s*"(.*)"', __source__, re.M).group(1), + author_email = re.search(r'^__author_email__\s*=\s*"(.*)"', __source__, re.M).group(1), + url = re.search(r'^__url__\s*=\s*"(.*)"', __source__, re.M).group(1), + scripts = ['FoBiS.py'], + packages = ['fobis'], + py_modules = [], + classifiers = ['Development Status :: 5 - Production/Stable', + 'License :: OSI Approved :: '+__license__, + 'Environment :: Console', + 'Intended Audience :: End Users/Desktop', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Topic :: Text Processing'], + entry_points = { 'console_scripts': [] }, + extras_require = { 'PreForM.py': ["PreForM.py>=v1.1.1"], + 'FORD': ["FORD>=1.1.0"], + 'graphviz': ["graphviz>=0.4.2"]}) + # install_requires = [ "multiprocessing" ]) diff --git a/release/reports-FoBiS-1.5.7/coverage b/release/reports-FoBiS-1.5.7/coverage new file mode 100644 index 0000000..57fc3e5 --- /dev/null +++ b/release/reports-FoBiS-1.5.7/coverage @@ -0,0 +1,14 @@ +Name Stmts Miss Cover Missing +------------------------------------------------ +fobis 0 0 100% +fobis.Builder 266 40 85% 9-11, 93, 98, 129-130, 133, 159, 167, 173, 196, 202, 208, 214, 236, 244, 252, 282, 293, 354, 358, 392, 396-399, 402-403, 443-450, 490, 506, 511 +fobis.Cleaner 63 13 79% 41, 82, 86, 119-125, 133-134, 136-137 +fobis.Colors 20 0 100% +fobis.Dependency 18 8 56% 33-37, 41-42, 46 +fobis.Fobos 206 85 59% 8-9, 32, 37, 47, 65-76, 89, 97-98, 112-113, 192, 226-235, 248-270, 280-295, 306-322, 345, 353, 357-359 +fobis.ParsedFile 210 62 70% 38-43, 54-59, 69-74, 304-319, 325-344, 386, 391-393, 400-401, 407-409, 412-419 +fobis.cli_parser 112 0 100% +fobis.config 311 86 72% 88, 115-118, 156-157, 170, 174-176, 193-202, 204, 208-210, 227, 243-247, 262-269, 272, 307-308, 321-325, 329, 361-366, 393-402, 415-416, 418, 434, 450-454, 469, 472-487, 490-491 +fobis.utils 110 8 93% 12-13, 125, 151, 165, 181-182, 199 +------------------------------------------------ +TOTAL 1316 302 77% diff --git a/release/reports-FoBiS-1.5.7/coverage.json b/release/reports-FoBiS-1.5.7/coverage.json new file mode 100644 index 0000000..aaee568 --- /dev/null +++ b/release/reports-FoBiS-1.5.7/coverage.json @@ -0,0 +1,1719 @@ +{ + "module_names": [ + { + "coverage": 100, + "lines": [ + 2, + 5, + 7, + 8, + 9, + 10, + 13, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 73, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 109, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 138, + 151, + 152, + 153, + 155, + 156, + 157, + 158 + ], + "lines_not_covered": [], + "module": "fobis.cli_parser", + "sum_lines": 112, + "sum_lines_not_covered": 0 + }, + { + "coverage": 84, + "lines": [ + 2, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 17, + 25, + 29, + 92, + 93, + 95, + 97, + 98, + 100, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 119, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 135, + 138, + 140, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 169, + 170, + 171, + 172, + 173, + 175, + 176, + 177, + 178, + 180, + 195, + 196, + 198, + 199, + 200, + 201, + 202, + 204, + 205, + 206, + 207, + 208, + 210, + 211, + 212, + 213, + 214, + 216, + 217, + 218, + 219, + 221, + 234, + 235, + 236, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 255, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 282, + 283, + 284, + 285, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 296, + 305, + 306, + 307, + 308, + 310, + 324, + 325, + 327, + 328, + 330, + 331, + 333, + 351, + 352, + 354, + 355, + 356, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 369, + 389, + 390, + 392, + 393, + 394, + 396, + 397, + 398, + 399, + 400, + 401, + 402, + 403, + 404, + 406, + 414, + 415, + 416, + 417, + 418, + 419, + 420, + 421, + 423, + 435, + 436, + 437, + 438, + 439, + 440, + 441, + 442, + 443, + 444, + 445, + 446, + 447, + 448, + 449, + 450, + 452, + 453, + 454, + 455, + 456, + 457, + 458, + 459, + 460, + 462, + 463, + 465, + 483, + 485, + 487, + 488, + 490, + 491, + 492, + 493, + 494, + 495, + 496, + 497, + 498, + 500, + 501, + 502, + 503, + 504, + 505, + 506, + 507, + 508, + 509, + 511, + 512, + 513, + 515, + 524, + 525, + 526, + 527, + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 552 + ], + "lines_not_covered": [ + 9, + 10, + 11, + 93, + 98, + 129, + 130, + 133, + 159, + 167, + 173, + 196, + 202, + 208, + 214, + 236, + 244, + 252, + 282, + 293, + 354, + 358, + 392, + 396, + 397, + 398, + 399, + 402, + 403, + 443, + 444, + 445, + 446, + 447, + 448, + 449, + 450, + 490, + 506, + 511 + ], + "module": "fobis.Builder", + "sum_lines": 266, + "sum_lines_not_covered": 40 + }, + { + "coverage": 72, + "lines": [ + 2, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 29, + 33, + 44, + 45, + 46, + 47, + 49, + 53, + 54, + 56, + 57, + 59, + 68, + 69, + 71, + 80, + 81, + 83, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 94, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 106, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 123, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 136, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 162, + 166, + 167, + 168, + 169, + 170, + 172, + 173, + 174, + 175, + 176, + 177, + 179, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 194, + 195, + 196, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 206, + 207, + 208, + 209, + 210, + 211, + 213, + 222, + 223, + 224, + 225, + 227, + 228, + 229, + 231, + 240, + 241, + 242, + 243, + 244, + 246, + 247, + 248, + 250, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 268, + 269, + 271, + 272, + 274, + 275, + 276, + 278, + 287, + 288, + 289, + 290, + 291, + 293, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 329, + 330, + 333, + 334, + 336, + 345, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 357, + 361, + 362, + 363, + 364, + 365, + 366, + 368, + 372, + 373, + 375, + 377, + 378, + 379, + 380, + 381, + 383, + 384, + 385, + 386, + 387, + 388, + 389, + 390, + 391, + 392, + 393, + 395, + 396, + 397, + 398, + 399, + 400, + 401, + 402, + 403, + 405, + 409, + 410, + 411, + 412, + 413, + 414, + 415, + 416, + 417, + 418, + 419, + 421, + 430, + 431, + 432, + 434, + 435, + 436, + 437, + 439, + 443, + 444, + 446, + 450, + 451, + 452, + 453, + 454, + 456, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + 481, + 482, + 483, + 484, + 485, + 487, + 489, + 490, + 491, + 493, + 494, + 495, + 496, + 497, + 501, + 502, + 503, + 504 + ], + "lines_not_covered": [ + 88, + 115, + 116, + 117, + 118, + 156, + 157, + 170, + 174, + 175, + 176, + 193, + 194, + 195, + 196, + 198, + 199, + 200, + 201, + 202, + 204, + 208, + 209, + 210, + 227, + 243, + 244, + 246, + 247, + 262, + 263, + 264, + 265, + 266, + 268, + 269, + 272, + 307, + 308, + 321, + 322, + 323, + 324, + 325, + 329, + 361, + 362, + 363, + 364, + 365, + 366, + 393, + 395, + 396, + 397, + 398, + 399, + 400, + 401, + 402, + 415, + 416, + 418, + 434, + 450, + 451, + 452, + 453, + 454, + 469, + 472, + 473, + 474, + 475, + 476, + 477, + 478, + 479, + 481, + 482, + 483, + 484, + 485, + 487, + 490, + 491 + ], + "module": "fobis.config", + "sum_lines": 311, + "sum_lines_not_covered": 86 + }, + { + "coverage": 100, + "lines": [ + 2, + 8, + 12, + 15, + 16, + 17, + 19, + 21, + 22, + 23, + 25, + 27, + 28, + 29, + 31, + 40, + 41, + 43, + 52, + 53 + ], + "lines_not_covered": [], + "module": "fobis.Colors", + "sum_lines": 20, + "sum_lines_not_covered": 0 + }, + { + "coverage": 100, + "lines": [], + "lines_not_covered": [], + "module": "fobis", + "sum_lines": 0, + "sum_lines_not_covered": 0 + }, + { + "coverage": 92, + "lines": [ + 2, + 5, + 6, + 7, + 10, + 12, + 13, + 16, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 29, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 43, + 47, + 48, + 49, + 52, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 82, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 110, + 124, + 125, + 127, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 140, + 141, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 165, + 168, + 169, + 171, + 172, + 175, + 179, + 180, + 181, + 182, + 185, + 198, + 199, + 201, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 212, + 213, + 214, + 215 + ], + "lines_not_covered": [ + 12, + 13, + 125, + 151, + 165, + 181, + 182, + 199 + ], + "module": "fobis.utils", + "sum_lines": 110, + "sum_lines_not_covered": 8 + }, + { + "coverage": 58, + "lines": [ + 2, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 17, + 21, + 31, + 32, + 34, + 36, + 37, + 39, + 41, + 42, + 43, + 44, + 45, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 56, + 65, + 66, + 67, + 68, + 70, + 71, + 72, + 74, + 75, + 76, + 78, + 87, + 88, + 89, + 91, + 92, + 94, + 95, + 97, + 98, + 99, + 101, + 105, + 106, + 107, + 108, + 109, + 110, + 112, + 113, + 114, + 116, + 120, + 121, + 122, + 123, + 124, + 125, + 127, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 140, + 144, + 145, + 146, + 147, + 148, + 150, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 169, + 170, + 172, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 192, + 193, + 195, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, + 211, + 213, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 235, + 237, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 266, + 267, + 268, + 270, + 272, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 289, + 290, + 292, + 293, + 294, + 295, + 297, + 306, + 307, + 308, + 309, + 310, + 311, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 324, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 355, + 357, + 358, + 359, + 360 + ], + "lines_not_covered": [ + 8, + 9, + 32, + 37, + 47, + 65, + 66, + 67, + 68, + 70, + 71, + 72, + 74, + 75, + 76, + 89, + 97, + 98, + 112, + 113, + 192, + 226, + 227, + 228, + 229, + 230, + 231, + 232, + 233, + 235, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 266, + 267, + 268, + 270, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 289, + 290, + 292, + 293, + 294, + 295, + 306, + 307, + 308, + 309, + 310, + 311, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 345, + 353, + 357, + 358, + 359 + ], + "module": "fobis.Fobos", + "sum_lines": 206, + "sum_lines_not_covered": 85 + }, + { + "coverage": 70, + "lines": [ + 2, + 6, + 7, + 8, + 9, + 10, + 11, + 27, + 29, + 38, + 39, + 40, + 42, + 43, + 45, + 54, + 55, + 56, + 58, + 59, + 61, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 99, + 105, + 109, + 113, + 117, + 121, + 125, + 129, + 138, + 143, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 165, + 168, + 170, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 223, + 224, + 225, + 226, + 227, + 228, + 229, + 230, + 232, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 244, + 253, + 254, + 255, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 280, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 300, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 318, + 319, + 321, + 325, + 326, + 327, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 339, + 340, + 341, + 342, + 343, + 344, + 346, + 351, + 352, + 353, + 354, + 356, + 365, + 366, + 368, + 370, + 381, + 383, + 384, + 385, + 386, + 388, + 390, + 391, + 393, + 396, + 399, + 400, + 401, + 404, + 406, + 407, + 409, + 411, + 412, + 413, + 414, + 416, + 419, + 421, + 425, + 426, + 427, + 428, + 429 + ], + "lines_not_covered": [ + 38, + 39, + 40, + 42, + 43, + 54, + 55, + 56, + 58, + 59, + 69, + 70, + 71, + 72, + 73, + 74, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 312, + 313, + 314, + 315, + 316, + 318, + 319, + 325, + 326, + 327, + 328, + 329, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 339, + 340, + 341, + 342, + 343, + 344, + 386, + 391, + 393, + 400, + 401, + 407, + 409, + 412, + 413, + 414, + 416, + 419 + ], + "module": "fobis.ParsedFile", + "sum_lines": 210, + "sum_lines_not_covered": 62 + }, + { + "coverage": 79, + "lines": [ + 2, + 6, + 7, + 10, + 14, + 40, + 41, + 43, + 45, + 46, + 47, + 48, + 50, + 63, + 64, + 65, + 66, + 68, + 79, + 80, + 82, + 83, + 84, + 86, + 87, + 89, + 93, + 94, + 95, + 96, + 97, + 98, + 100, + 104, + 105, + 106, + 107, + 108, + 109, + 111, + 115, + 116, + 117, + 119, + 120, + 121, + 122, + 123, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139 + ], + "lines_not_covered": [ + 41, + 82, + 86, + 119, + 120, + 121, + 122, + 123, + 125, + 133, + 134, + 136, + 137 + ], + "module": "fobis.Cleaner", + "sum_lines": 63, + "sum_lines_not_covered": 13 + }, + { + "coverage": 55, + "lines": [ + 2, + 7, + 10, + 14, + 28, + 29, + 30, + 32, + 33, + 34, + 35, + 36, + 37, + 39, + 41, + 42, + 44, + 46 + ], + "lines_not_covered": [ + 33, + 34, + 35, + 36, + 37, + 41, + 42, + 46 + ], + "module": "fobis.Dependency", + "sum_lines": 18, + "sum_lines_not_covered": 8 + } + ], + "overall_coverage": 77 +} \ No newline at end of file diff --git a/release/reports-FoBiS-1.5.7/flake8 b/release/reports-FoBiS-1.5.7/flake8 new file mode 100644 index 0000000..e69de29 diff --git a/release/reports-FoBiS-1.5.7/flake8.err b/release/reports-FoBiS-1.5.7/flake8.err new file mode 100644 index 0000000..e69de29 diff --git a/release/reports-FoBiS-1.5.7/frosted b/release/reports-FoBiS-1.5.7/frosted new file mode 100644 index 0000000..e69de29 diff --git a/release/reports-FoBiS-1.5.7/frosted.err b/release/reports-FoBiS-1.5.7/frosted.err new file mode 100644 index 0000000..e69de29 diff --git a/release/reports-FoBiS-1.5.7/pylint b/release/reports-FoBiS-1.5.7/pylint new file mode 100644 index 0000000..408f78d --- /dev/null +++ b/release/reports-FoBiS-1.5.7/pylint @@ -0,0 +1,176 @@ +************* Module fobis.config +R:456, 2: Too many branches (15/12) (too-many-branches) +************* Module fobis.Builder +R:140, 2: Too many branches (18/12) (too-many-branches) +R:180, 2: Too many branches (24/12) (too-many-branches) +R:221, 2: Too many branches (16/12) (too-many-branches) +R:255, 2: Too many branches (16/12) (too-many-branches) +R:333, 2: Too many branches (14/12) (too-many-branches) +R:369, 2: Too many branches (14/12) (too-many-branches) +R:423, 2: Too many branches (18/12) (too-many-branches) +R:465, 2: Too many branches (20/12) (too-many-branches) +R:515, 2: Too many branches (14/12) (too-many-branches) +R:179, 2: Too many branches (24/12) (too-many-branches) +R:250, 2: Too many branches (14/12) (too-many-branches) +R:293, 2: Too many branches (16/12) (too-many-branches) +R:368, 2: Too many branches (22/12) (too-many-branches) +R:456, 2: Too many branches (30/12) (too-many-branches) +************* Module fobis.utils +W: 29, 0: Dangerous default value list() (__builtin__.list) as argument (dangerous-default-value) +R:110, 0: Too many branches (22/12) (too-many-branches) +************* Module fobis.Fobos +F: 9, 2: Unable to import 'configparser' (import-error) +************* Module fobis.ParsedFile +W: 58, 8: Used * or ** magic (star-args) +R:170, 2: Too many arguments (8/7) (too-many-arguments) +R:370, 2: Too many branches (16/12) (too-many-branches) +W: 29, 0: Dangerous default value list() (__builtin__.list) as argument (dangerous-default-value) +R:110, 0: Too many branches (44/12) (too-many-branches) +R:185, 0: Too many branches (18/12) (too-many-branches) +F: 9, 2: Unable to import 'configparser' (import-error) +R: 21, 2: Too many branches (16/12) (too-many-branches) +R:150, 2: Too many branches (14/12) (too-many-branches) +R:237, 2: Too many branches (14/12) (too-many-branches) +R:272, 2: Too many branches (14/12) (too-many-branches) +R:297, 2: Too many branches (18/12) (too-many-branches) +R:324, 2: Too many branches (20/12) (too-many-branches) +W: 58, 8: Used * or ** magic (star-args) +R:170, 2: Too many arguments (8/7) (too-many-arguments) +R:244, 2: Too many branches (20/12) (too-many-branches) +R:321, 2: Too many branches (16/12) (too-many-branches) +R:370, 2: Too many branches (32/12) (too-many-branches) +************* Module fobis.Cleaner +R:111, 2: Too many branches (22/12) (too-many-branches) + + +Report +====== +2632 statements analysed. + +Statistics by type +------------------ + ++---------+-------+-----------+-----------+------------+---------+ +|type |number |old number |difference |%documented |%badname | ++=========+=======+===========+===========+============+=========+ +|module |22 |22 |= |100.00 |0.00 | ++---------+-------+-----------+-----------+------------+---------+ +|class |14 |14 |= |100.00 |0.00 | ++---------+-------+-----------+-----------+------------+---------+ +|method |156 |156 |= |100.00 |0.00 | ++---------+-------+-----------+-----------+------------+---------+ +|function |34 |34 |= |100.00 |0.00 | ++---------+-------+-----------+-----------+------------+---------+ + + + +External dependencies +--------------------- +:: + + argparse (fobis.cli_parser) + fobis + \-Builder (fobis.config) + \-Cleaner (fobis.config) + \-Colors (fobis.config) + \-Fobos (fobis.config) + \-ParsedFile (fobis.config) + \-cli_parser (fobis.config) + \-config (fobis.fobis) + \-fobis (FoBiS) + \-utils (fobis.Fobos,fobis.Cleaner,fobis.config,fobis.ParsedFile,fobis.Builder) + graphviz (fobis.ParsedFile) + + + +Raw metrics +----------- + ++----------+-------+------+---------+-----------+ +|type |number |% |previous |difference | ++==========+=======+======+=========+===========+ +|code |2785 |55.73 |2785 |= | ++----------+-------+------+---------+-----------+ +|docstring |1766 |35.34 |1766 |= | ++----------+-------+------+---------+-----------+ +|comment |35 |0.70 |35 |= | ++----------+-------+------+---------+-----------+ +|empty |411 |8.22 |411 |= | ++----------+-------+------+---------+-----------+ + + + +Duplication +----------- + ++-------------------------+-------+---------+-----------+ +| |now |previous |difference | ++=========================+=======+=========+===========+ +|nb duplicated lines |2454 |2454 |= | ++-------------------------+-------+---------+-----------+ +|percent duplicated lines |49.536 |49.536 |= | ++-------------------------+-------+---------+-----------+ + + + +Messages by category +-------------------- + ++-----------+-------+---------+-----------+ +|type |number |previous |difference | ++===========+=======+=========+===========+ +|convention |0 |0 |= | ++-----------+-------+---------+-----------+ +|refactor |31 |31 |= | ++-----------+-------+---------+-----------+ +|warning |4 |4 |= | ++-----------+-------+---------+-----------+ +|error |0 |0 |= | ++-----------+-------+---------+-----------+ + + + +% errors / warnings by module +----------------------------- + ++-----------------+------+--------+---------+-----------+ +|module |error |warning |refactor |convention | ++=================+======+========+=========+===========+ +|fobis.ParsedFile |0.00 |25.00 |12.90 |0.00 | ++-----------------+------+--------+---------+-----------+ +|fobis.utils |0.00 |25.00 |6.45 |0.00 | ++-----------------+------+--------+---------+-----------+ +|fobis.Builder |0.00 |0.00 |29.03 |0.00 | ++-----------------+------+--------+---------+-----------+ +|fobis.Fobos |0.00 |0.00 |19.35 |0.00 | ++-----------------+------+--------+---------+-----------+ +|fobis.config |0.00 |0.00 |16.13 |0.00 | ++-----------------+------+--------+---------+-----------+ +|fobis.Cleaner |0.00 |0.00 |3.23 |0.00 | ++-----------------+------+--------+---------+-----------+ + + + +Messages +-------- + ++------------------------+------------+ +|message id |occurrences | ++========================+============+ +|too-many-branches |29 | ++------------------------+------------+ +|too-many-arguments |2 | ++------------------------+------------+ +|star-args |2 | ++------------------------+------------+ +|import-error |2 | ++------------------------+------------+ +|dangerous-default-value |2 | ++------------------------+------------+ + + + +Global evaluation +----------------- +Your code has been rated at 9.87/10 (previous run: 9.87/10, +0.00) + diff --git a/release/reports-FoBiS-1.5.7/pylint.err b/release/reports-FoBiS-1.5.7/pylint.err new file mode 100644 index 0000000..e69de29 diff --git a/release/reports-FoBiS-1.5.7/unittest b/release/reports-FoBiS-1.5.7/unittest new file mode 100644 index 0000000..cee06c5 --- /dev/null +++ b/release/reports-FoBiS-1.5.7/unittest @@ -0,0 +1,5 @@ +. +---------------------------------------------------------------------- +Ran 1 test in 1.950s + +OK diff --git a/release/reports-FoBiS-1.5.7/unittest.json b/release/reports-FoBiS-1.5.7/unittest.json new file mode 100644 index 0000000..0afcb53 --- /dev/null +++ b/release/reports-FoBiS-1.5.7/unittest.json @@ -0,0 +1,5 @@ +{ + "errors": [], + "failures": [], + "tests-run": 1 +} \ No newline at end of file diff --git a/src/main/python/fobis/config.py b/src/main/python/fobis/config.py index 9586d8d..4e2e47c 100644 --- a/src/main/python/fobis/config.py +++ b/src/main/python/fobis/config.py @@ -17,7 +17,7 @@ from .utils import remove_other_main __appname__ = "FoBiS.py" -__version__ = "1.5.6" +__version__ = "1.5.7" __author__ = "Stefano Zaghi" __author_email__ = "stefano.zaghi@gmail.com" __license__ = "GNU General Public License v3 (GPLv3)" diff --git a/src/main/scripts/setup.py b/src/main/scripts/setup.py index d2d617b..4118cac 100755 --- a/src/main/scripts/setup.py +++ b/src/main/scripts/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """Setup script for install FoBiS.py""" -import pypandoc +# import pypandoc import re from setuptools import setup __source__ = open('fobis/config.py').read() @@ -10,8 +10,8 @@ setup(name = re.search(r'^__appname__\s*=\s*"(.*)"', __source__, re.M).group(1), version = re.search(r'^__version__\s*=\s*"(.*)"', __source__, re.M).group(1), description = re.search(r'^__description__\s*=\s*"(.*)"', __source__, re.M).group(1), - # long_description = re.search(r'^__long_description__\s*=\s*"(.*)"', __source__, re.M).group(1), - long_description = pypandoc.convert('README.md', 'rst'), + long_description = re.search(r'^__long_description__\s*=\s*"(.*)"', __source__, re.M).group(1), + # long_description = pypandoc.convert('README.md', 'rst'), author = re.search(r'^__author__\s*=\s*"(.*)"', __source__, re.M).group(1), author_email = re.search(r'^__author_email__\s*=\s*"(.*)"', __source__, re.M).group(1), url = re.search(r'^__url__\s*=\s*"(.*)"', __source__, re.M).group(1),