├── .gitignore ├── .travis.yml ├── LICENSE ├── NOTICE ├── README.rst ├── appveyor.yml ├── doc ├── Makefile ├── api.rst ├── cfg.py ├── conf.py ├── contributing.rst ├── environment.yml ├── faq │ └── index.rst ├── index.rst ├── install │ ├── anaconda.rst │ ├── docker.rst │ └── source.rst ├── make.bat ├── references.bib ├── thumbnails │ ├── EuroSciPy2017a.jpg │ ├── EuroSciPy2017b.jpg │ └── arXiv2017.jpg ├── user_guide.rst └── zreferences.rst ├── etc └── conda │ ├── autowig-toolchain │ ├── activate.bat │ ├── activate.sh │ ├── bld.bat │ ├── build.sh │ ├── deactivate.bat │ ├── deactivate.sh │ └── meta.yaml │ └── python-autowig │ ├── bld.bat │ ├── build.sh │ └── meta.yaml ├── readthedocs.yml ├── setup.py ├── src └── py │ └── autowig │ ├── __init__.py │ ├── _controller.py │ ├── _documenter.py │ ├── _feedback.py │ ├── _generator.py │ ├── _node_path.py │ ├── _node_rename.py │ ├── _parser.py │ ├── asg.py │ ├── boost_python_generator.py │ ├── comment_feedback.py │ ├── default_controller.py │ ├── doxygen2sphinx.py │ ├── edit_feedback.py │ ├── libclang_parser.py │ ├── plugin.py │ ├── pybind11_generator.py │ └── tools.py ├── test ├── test_basic.py ├── test_feedback.py └── test_subset.py └── travis.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints 2 | doc/_build 3 | doc/_static 4 | *.*~ 5 | *.swp 6 | *.so 7 | *.os 8 | *.py[cod] 9 | *.egg 10 | *.egg-info 11 | build 12 | .sconsign.dblite 13 | *.sublime-workspace -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | travis.yml -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, 2 | UMR AGAP CIRAD, EPI Virtual Plants Inria 3 | Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria 4 | 5 | This file is part of the AutoWIG project. More information can be 6 | found at 7 | 8 | http://autowig.rtfd.io 9 | 10 | The Apache Software Foundation (ASF) licenses this file to you under 11 | the Apache License, Version 2.0 (the "License"); you may not use this 12 | file except in compliance with the License. You should have received 13 | a copy of the Apache License, Version 2.0 along with this file; see 14 | the file LICENSE. If not, you may obtain a copy of the License at 15 | 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | 18 | Unless required by applicable law or agreed to in writing, software 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 21 | mplied. See the License for the specific language governing 22 | permissions and limitations under the License. 23 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 2 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 3 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 4 | .. .. 5 | .. This file is part of the AutoWIG project. More information can be .. 6 | .. found at .. 7 | .. .. 8 | .. http://autowig.rtfd.io .. 9 | .. .. 10 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 11 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 12 | .. file except in compliance with the License. You should have received .. 13 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 14 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 15 | .. .. 16 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 17 | .. .. 18 | .. Unless required by applicable law or agreed to in writing, software .. 19 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 20 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 21 | .. mplied. See the License for the specific language governing .. 22 | .. permissions and limitations under the License. .. 23 | 24 | **AutoWIG**: Automatic Wrapper and Interface Generator 25 | ###################################################### 26 | 27 | High-level programming languages, such as *Python* and *R*, are popular among scientists. 28 | They are concise, readable, lead to rapid development cycles, but suffer from performance drawback compared to compiled language. 29 | However, these languages allow to interface *C*, *C++* and *Fortran* code. 30 | In this way, most of the scientific packages incorporate compiled scientific libraries to both speed up the code and reuse legacy libraries. 31 | While several semi-automatic solutions and tools exist to wrap these compiled libraries, the process of wrapping a large library is cumbersome and time consuming. 32 | **AutoWIG** is a *Python* library that wraps automatically compiled libraries into high-level languages. 33 | Our approach consists in parsing *C++* code using the **LLVM**/**Clang** technologies and generating the wrappers using the **Mako** templating engine. 34 | Our approach is automatic, extensible, and applies to very complex *C++* libraries, composed of thousands of classes or incorporating modern meta-programming constructs. 35 | 36 | Citation 37 | ======== 38 | 39 | If you use AutoWIG in a scientific publication, we would appreciate citations: 40 | 41 | Fernique P, Pradal C. (2018) AutoWIG: automatic generation of python bindings for C++ libraries. PeerJ Computer Science 4:e149 https://doi.org/10.7717/peerj-cs.149 42 | 43 | Examples 44 | ========= 45 | 46 | Examples written in the article are available a dedicated `repository `_ 47 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | image: Visual Studio 2015 25 | 26 | platform: 27 | - x64 28 | 29 | environment: 30 | matrix: 31 | - CONDA_RECIPE: etc\conda\python-autowig 32 | 33 | install: 34 | - git clone https://github.com/StatisKit/appveyor-ci.git 35 | - cd appveyor-ci 36 | - call before_install.bat 37 | - call install.bat 38 | 39 | before_build: 40 | - call before_build.bat 41 | 42 | build_script: 43 | - call build_script.bat 44 | 45 | after_build: 46 | - call after_build.bat 47 | 48 | deploy: 49 | provider: Script 50 | on: 51 | branch: master 52 | 53 | before_deploy: 54 | - call before_deploy.bat 55 | 56 | deploy_script: 57 | - call deploy_script.bat 58 | 59 | after_deploy: 60 | - call after_deploy.bat 61 | 62 | on_success: 63 | - call on_success.bat 64 | 65 | on_failure: 66 | - call on_failure.bat 67 | 68 | on_finish: 69 | - call on_finish.bat 70 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | NBCONVERT = jupyter nbconvert 10 | NOTEBOOKS = $(shell for file in `find . -name "*.ipynb" -not -path '*/.ipynb_checkpoints/*'`;do echo $$file; done) 11 | 12 | # User-friendly check for sphinx-build 13 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 14 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 15 | endif 16 | 17 | # Internal variables. 18 | PAPEROPT_a4 = -D latex_paper_size=a4 19 | PAPEROPT_letter = -D latex_paper_size=letter 20 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | # the i18n builder cannot share the environment and doctrees with the others 22 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 23 | 24 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 25 | 26 | help: 27 | @echo "Please use \`make ' where is one of" 28 | @echo " html to make standalone HTML files" 29 | @echo " dirhtml to make HTML files named index.html in directories" 30 | @echo " singlehtml to make a single large HTML file" 31 | @echo " pickle to make pickle files" 32 | @echo " json to make JSON files" 33 | @echo " htmlhelp to make HTML files and a HTML help project" 34 | @echo " qthelp to make HTML files and a qthelp project" 35 | @echo " devhelp to make HTML files and a Devhelp project" 36 | @echo " epub to make an epub" 37 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 38 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 39 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 40 | @echo " text to make text files" 41 | @echo " man to make manual pages" 42 | @echo " texinfo to make Texinfo files" 43 | @echo " info to make Texinfo files and run them through makeinfo" 44 | @echo " gettext to make PO message catalogs" 45 | @echo " changes to make an overview of all changed/added/deprecated items" 46 | @echo " xml to make Docutils-native XML files" 47 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 48 | @echo " linkcheck to check all external links for integrity" 49 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 50 | 51 | clean: 52 | rm -rf $(BUILDDIR)/* 53 | 54 | html: 55 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 56 | @echo 57 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 58 | 59 | notebooks: 60 | for notebook in $(NOTEBOOKS); do \ 61 | $(NBCONVERT) $$notebook --to rst --execute; \ 62 | done 63 | @echo 64 | @echo "Build finished. The RST files are generated" 65 | 66 | dirhtml: 67 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 68 | @echo 69 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 70 | 71 | singlehtml: 72 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 73 | @echo 74 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 75 | 76 | pickle: 77 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 78 | @echo 79 | @echo "Build finished; now you can process the pickle files." 80 | 81 | json: 82 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 83 | @echo 84 | @echo "Build finished; now you can process the JSON files." 85 | 86 | htmlhelp: 87 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 88 | @echo 89 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 90 | ".hhp project file in $(BUILDDIR)/htmlhelp." 91 | 92 | qthelp: 93 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 94 | @echo 95 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 96 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 97 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MngIt.qhcp" 98 | @echo "To view the help file:" 99 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MngIt.qhc" 100 | 101 | devhelp: 102 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 103 | @echo 104 | @echo "Build finished." 105 | @echo "To view the help file:" 106 | @echo "# mkdir -p $$HOME/.local/share/devhelp/MngIt" 107 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MngIt" 108 | @echo "# devhelp" 109 | 110 | epub: 111 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 112 | @echo 113 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 114 | 115 | latex: 116 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 117 | @echo 118 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 119 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 120 | "(use \`make latexpdf' here to do that automatically)." 121 | 122 | latexpdf: 123 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 124 | @echo "Running LaTeX files through pdflatex..." 125 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 126 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 127 | 128 | latexpdfja: 129 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 130 | @echo "Running LaTeX files through platex and dvipdfmx..." 131 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 132 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 133 | 134 | text: 135 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 136 | @echo 137 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 138 | 139 | man: 140 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 141 | @echo 142 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 143 | 144 | texinfo: 145 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 146 | @echo 147 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 148 | @echo "Run \`make' in that directory to run these through makeinfo" \ 149 | "(use \`make info' here to do that automatically)." 150 | 151 | info: 152 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 153 | @echo "Running Texinfo files through makeinfo..." 154 | make -C $(BUILDDIR)/texinfo info 155 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 156 | 157 | gettext: 158 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 159 | @echo 160 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 161 | 162 | changes: 163 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 164 | @echo 165 | @echo "The overview file is in $(BUILDDIR)/changes." 166 | 167 | linkcheck: 168 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 169 | @echo 170 | @echo "Link check complete; look for any errors in the above output " \ 171 | "or in $(BUILDDIR)/linkcheck/output.txt." 172 | 173 | doctest: 174 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 175 | @echo "Testing of doctests in the sources finished, look at the " \ 176 | "results in $(BUILDDIR)/doctest/output.txt." 177 | 178 | xml: 179 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 180 | @echo 181 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 182 | 183 | pseudoxml: 184 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 185 | @echo 186 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 187 | -------------------------------------------------------------------------------- /doc/api.rst: -------------------------------------------------------------------------------- 1 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 2 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 3 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 4 | .. .. 5 | .. This file is part of the AutoWIG project. More information can be .. 6 | .. found at .. 7 | .. .. 8 | .. http://autowig.rtfd.io .. 9 | .. .. 10 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 11 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 12 | .. file except in compliance with the License. You should have received .. 13 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 14 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 15 | .. .. 16 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 17 | .. .. 18 | .. Unless required by applicable law or agreed to in writing, software .. 19 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 20 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 21 | .. mplied. See the License for the specific language governing .. 22 | .. permissions and limitations under the License. .. 23 | 24 | API 25 | === 26 | 27 | .. note:: 28 | 29 | The exact API of all functions and classes, as given by the docstrings. 30 | The API documents expected types and allowed features for all functions, and all parameters available for the algorithms. 31 | 32 | .. warning:: 33 | 34 | Section under construction. 35 | -------------------------------------------------------------------------------- /doc/cfg.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | c.NbConvertApp.notebooks = [#"examples/basic.ipynb", 25 | #"examples/subset.ipynb", 26 | "examples/template.ipynb"] 27 | 28 | c.ExecutePreprocessor.timeout = 600 -------------------------------------------------------------------------------- /doc/conf.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | # -*- coding: utf-8 -*- 25 | # 26 | # AutoWIG documentation build configuration file, created by 27 | # sphinx-quickstart on Wed Apr 27 08:29:50 2016. 28 | # 29 | # This file is execfile()d with the current directory set to its 30 | # containing dir. 31 | # 32 | # Note that not all possible configuration values are present in this 33 | # autogenerated file. 34 | # 35 | # All configuration values have a default; values that are commented out 36 | # serve to show the default. 37 | 38 | import sys 39 | import os 40 | 41 | # If extensions (or modules to document with autodoc) are in another directory, 42 | # add these directories to sys.path here. If the directory is relative to the 43 | # documentation root, use os.path.abspath to make it absolute, like shown here. 44 | #sys.path.insert(0, os.path.abspath('.')) 45 | 46 | # -- General configuration ------------------------------------------------ 47 | 48 | # If your documentation needs a minimal Sphinx version, state it here. 49 | #needs_sphinx = '1.0' 50 | 51 | # Add any Sphinx extension module names here, as strings. They can be 52 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 53 | # ones. 54 | extensions = [ 55 | 'sphinx.ext.autodoc', 56 | 'sphinx.ext.doctest', 57 | 'sphinx.ext.intersphinx', 58 | 'sphinx.ext.todo', 59 | 'sphinx.ext.coverage', 60 | 'sphinx.ext.mathjax', 61 | 'sphinx.ext.ifconfig', 62 | 'sphinx.ext.viewcode', 63 | 'nbsphinx', 64 | 'sphinxcontrib.bibtex', 65 | 'sphinx.ext.autosummary', 66 | 'IPython.sphinxext.ipython_console_highlighting' 67 | ] 68 | 69 | # Add any paths that contain templates here, relative to this directory. 70 | templates_path = ['_templates'] 71 | 72 | # The suffix of source filenames. 73 | source_suffix = '.rst' 74 | 75 | # The encoding of source files. 76 | #source_encoding = 'utf-8-sig' 77 | 78 | # The master toctree document. 79 | master_doc = 'index' 80 | 81 | # General information about the project. 82 | project = u'AutoWIG' 83 | copyright = u'2016, P. Fernique, C. Pradal' 84 | 85 | 86 | # The version info for the project you're documenting, acts as replacement for 87 | # |version| and |release|, also used in various other places throughout the 88 | # built documents. 89 | # 90 | # The short X.Y version. 91 | 92 | version = '0.1.0' 93 | # The full version, including alpha/beta/rc tags. 94 | release = '0.1' 95 | 96 | # The language for content autogenerated by Sphinx. Refer to documentation 97 | # for a list of supported languages. 98 | #language = None 99 | 100 | # There are two options for replacing |today|: either, you set today to some 101 | # non-false value, then it is used: 102 | #today = '' 103 | # Else, today_fmt is used as the format for a strftime call. 104 | #today_fmt = '%B %d, %Y' 105 | 106 | # List of patterns, relative to source directory, that match files and 107 | # directories to ignore when looking for source files. 108 | exclude_patterns = ['_build', '**.ipynb_checkpoints'] 109 | 110 | # The reST default role (used for this markup: `text`) to use for all 111 | # documents. 112 | #default_role = None 113 | 114 | # If true, '()' will be appended to :func: etc. cross-reference text. 115 | #add_function_parentheses = True 116 | 117 | # If true, the current module name will be prepended to all description 118 | # unit titles (such as .. function::). 119 | #add_module_names = True 120 | 121 | # If true, sectionauthor and moduleauthor directives will be shown in the 122 | # output. They are ignored by default. 123 | #show_authors = False 124 | 125 | # The name of the Pygments (syntax highlighting) style to use. 126 | pygments_style = 'sphinx' 127 | 128 | # A list of ignored prefixes for module index sorting. 129 | #modindex_common_prefix = [] 130 | 131 | # If true, keep warnings as "system message" paragraphs in the built documents. 132 | #keep_warnings = False 133 | 134 | 135 | # -- Options for HTML output ---------------------------------------------- 136 | 137 | import sphinx_rtd_theme 138 | 139 | # The theme to use for HTML and HTML Help pages. See the documentation for 140 | # a list of builtin themes. 141 | html_theme = "sphinx_rtd_theme" 142 | 143 | # Theme options are theme-specific and customize the look and feel of a theme 144 | # further. For a list of options available for each theme, see the 145 | # documentation. 146 | #html_theme_options = {} 147 | 148 | # Add any paths that contain custom themes here, relative to this directory. 149 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 150 | 151 | # The name for this set of Sphinx documents. If None, it defaults to 152 | # " v documentation". 153 | #html_title = None 154 | 155 | # A shorter title for the navigation bar. Default is the same as html_title. 156 | #html_short_title = None 157 | 158 | # The name of an image file (relative to this directory) to place at the top 159 | # of the sidebar. 160 | #html_logo = None 161 | 162 | # The name of an image file (within the static path) to use as favicon of the 163 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 164 | # pixels large. 165 | #html_favicon = None 166 | 167 | # Add any paths that contain custom static files (such as style sheets) here, 168 | # relative to this directory. They are copied after the builtin static files, 169 | # so a file named "default.css" will overwrite the builtin "default.css". 170 | html_static_path = ['_static'] 171 | 172 | # Add any extra paths that contain custom files (such as robots.txt or 173 | # .htaccess) here, relative to this directory. These files are copied 174 | # directly to the root of the documentation. 175 | #html_extra_path = [] 176 | 177 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 178 | # using the given strftime format. 179 | #html_last_updated_fmt = '%b %d, %Y' 180 | 181 | # If true, SmartyPants will be used to convert quotes and dashes to 182 | # typographically correct entities. 183 | #html_use_smartypants = True 184 | 185 | # Custom sidebar templates, maps document names to template names. 186 | #html_sidebars = {} 187 | 188 | # Additional templates that should be rendered to pages, maps page names to 189 | # template names. 190 | #html_additional_pages = {} 191 | 192 | # If false, no module index is generated. 193 | #html_domain_indices = True 194 | 195 | # If false, no index is generated. 196 | #html_use_index = True 197 | 198 | # If true, the index is split into individual pages for each letter. 199 | #html_split_index = False 200 | 201 | # If true, links to the reST sources are added to the pages. 202 | #html_show_sourcelink = True 203 | 204 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 205 | #html_show_sphinx = True 206 | 207 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 208 | #html_show_copyright = True 209 | 210 | # If true, an OpenSearch description file will be output, and all pages will 211 | # contain a tag referring to it. The value of this option must be the 212 | # base URL from which the finished HTML is served. 213 | #html_use_opensearch = '' 214 | 215 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 216 | #html_file_suffix = None 217 | 218 | # Output file base name for HTML help builder. 219 | htmlhelp_basename = 'AutoWIGdoc' 220 | 221 | 222 | # -- Options for LaTeX output --------------------------------------------- 223 | 224 | latex_elements = { 225 | # The paper size ('letterpaper' or 'a4paper'). 226 | #'papersize': 'letterpaper', 227 | 228 | # The font size ('10pt', '11pt' or '12pt'). 229 | #'pointsize': '10pt', 230 | 231 | # Additional stuff for the LaTeX preamble. 232 | #'preamble': '', 233 | } 234 | 235 | # Grouping the document tree into LaTeX files. List of tuples 236 | # (source start file, target name, title, 237 | # author, documentclass [howto, manual, or own class]). 238 | latex_documents = [ 239 | ('index', 'AutoWIG.tex', u'AutoWIG Documentation', 240 | u'P. Fernique, C. Pradal', 'manual'), 241 | ] 242 | 243 | # The name of an image file (relative to this directory) to place at the top of 244 | # the title page. 245 | #latex_logo = None 246 | 247 | # For "manual" documents, if this is true, then toplevel headings are parts, 248 | # not chapters. 249 | #latex_use_parts = False 250 | 251 | # If true, show page references after internal links. 252 | #latex_show_pagerefs = False 253 | 254 | # If true, show URL addresses after external links. 255 | #latex_show_urls = False 256 | 257 | # Documents to append as an appendix to all manuals. 258 | #latex_appendices = [] 259 | 260 | # If false, no module index is generated. 261 | #latex_domain_indices = True 262 | 263 | 264 | # -- Options for manual page output --------------------------------------- 265 | 266 | # One entry per manual page. List of tuples 267 | # (source start file, name, description, authors, manual section). 268 | man_pages = [ 269 | ('index', 'autowig', u'AutoWIG Documentation', 270 | [u'P. Fernique, C. Pradal'], 1) 271 | ] 272 | 273 | # If true, show URL addresses after external links. 274 | #man_show_urls = False 275 | 276 | 277 | # -- Options for Texinfo output ------------------------------------------- 278 | 279 | # Grouping the document tree into Texinfo files. List of tuples 280 | # (source start file, target name, title, author, 281 | # dir menu entry, description, category) 282 | texinfo_documents = [ 283 | ('index', 'AutoWIG', u'AutoWIG Documentation', 284 | u'P. Fernique, C. Pradal', 'AutoWIG', 'One line description of project.', 285 | 'Miscellaneous'), 286 | ] 287 | 288 | # Documents to append as an appendix to all manuals. 289 | #texinfo_appendices = [] 290 | 291 | # If false, no module index is generated. 292 | #texinfo_domain_indices = True 293 | 294 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 295 | #texinfo_show_urls = 'footnote' 296 | 297 | # If true, do not generate a @detailmenu in the "Top" node's menu. 298 | #texinfo_no_detailmenu = False 299 | 300 | 301 | # Example configuration for intersphinx: refer to the Python standard library. 302 | intersphinx_mapping = {'http://docs.python.org/': None} 303 | 304 | todo_include_todos = True 305 | 306 | blockdiag_fontpath = '/usr/share/fonts/truetype/ipafont/ipagp.ttf' 307 | 308 | numfig = True 309 | numfig_format = {'figure': 'Fig. %s', 'table': 'Tab. %s', 'code-block': 'Lst. %s'} 310 | 311 | nbsphinx_execute = 'never' 312 | nbsphinx_timeout = 60 313 | 314 | rst_epilog = """ 315 | 316 | """ 317 | -------------------------------------------------------------------------------- /doc/contributing.rst: -------------------------------------------------------------------------------- 1 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 2 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 3 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 4 | .. .. 5 | .. This file is part of the AutoWIG project. More information can be .. 6 | .. found at .. 7 | .. .. 8 | .. http://autowig.rtfd.io .. 9 | .. .. 10 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 11 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 12 | .. file except in compliance with the License. You should have received .. 13 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 14 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 15 | .. .. 16 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 17 | .. .. 18 | .. Unless required by applicable law or agreed to in writing, software .. 19 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 20 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 21 | .. mplied. See the License for the specific language governing .. 22 | .. permissions and limitations under the License. .. 23 | 24 | Contributing 25 | ============ 26 | 27 | .. note:: 28 | 29 | Information on how to contribute. 30 | 31 | .. warning:: 32 | 33 | Section under construction. 34 | -------------------------------------------------------------------------------- /doc/environment.yml: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | name: autowig_doc 25 | channels: 26 | - defaults 27 | - statiskit 28 | - conda-forge 29 | dependencies: 30 | - python-autowig 31 | - python-clanglite 32 | - python-scons 33 | - gitpython 34 | - jupyter 35 | - sphinx>=1.3.6 36 | - pip: 37 | - nbsphinx 38 | - sphinxcontrib-bibtex 39 | -------------------------------------------------------------------------------- /doc/faq/index.rst: -------------------------------------------------------------------------------- 1 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 2 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 3 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 4 | .. .. 5 | .. This file is part of the AutoWIG project. More information can be .. 6 | .. found at .. 7 | .. .. 8 | .. http://autowig.rtfd.io .. 9 | .. .. 10 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 11 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 12 | .. file except in compliance with the License. You should have received .. 13 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 14 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 15 | .. .. 16 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 17 | .. .. 18 | .. Unless required by applicable law or agreed to in writing, software .. 19 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 20 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 21 | .. mplied. See the License for the specific language governing .. 22 | .. permissions and limitations under the License. .. 23 | 24 | .. _faq: 25 | 26 | Frequently Asked Questions 27 | ========================== 28 | 29 | .. note:: 30 | 31 | Frequently asked questions about the project and contributing. 32 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../README.rst 2 | 3 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 4 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 5 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 6 | .. .. 7 | .. This file is part of the AutoWIG project. More information can be .. 8 | .. found at .. 9 | .. .. 10 | .. http://autowig.rtfd.io .. 11 | .. .. 12 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 13 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 14 | .. file except in compliance with the License. You should have received .. 15 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 16 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 17 | .. .. 18 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 19 | .. .. 20 | .. Unless required by applicable law or agreed to in writing, software .. 21 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 22 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 23 | .. mplied. See the License for the specific language governing .. 24 | .. permissions and limitations under the License. .. 25 | 26 | .. sidebar:: External Ressources 27 | 28 | .. raw:: html 29 | 30 | 31 | 32 | .. raw:: html 33 | 34 | 35 | 36 | .. raw:: html 37 | 38 | 39 | 40 | .. :Papers: 41 | .. * |arXiv2017| 42 | .. 43 | .. :Conferences: 44 | .. * |EuroScipy2017b| 45 | .. * |EuroScipy2017a| 46 | .. * |jdS2016| 47 | .. 48 | .. .. |EuroScipy2017b| image:: thumbnails/EuroSciPy2017b.jpg 49 | .. :target: https://www.youtube.com/watch?v=N4q_Vud77Hw 50 | .. 51 | .. |EuroScipy2017a| image:: thumbnails/EuroSciPy2017a.jpg 52 | .. :target: https://www.euroscipy.org/2017/descriptions/19828.html 53 | .. 54 | .. .. |arXiv2017| image:: thumbnails/arXiv2017.jpg 55 | .. :target: https://arxiv.org/pdf/1705.11000 56 | .. 57 | .. .. |jdS2016| image:: https://thumb.ccsd.cnrs.fr/8091494/thumb/little 58 | .. :target: https://hal.inria.fr/hal-01316276/file/submission_167.pdf 59 | 60 | Installation 61 | ============ 62 | 63 | .. toctree:: 64 | :maxdepth: 2 65 | 66 | install/anaconda 67 | install/source 68 | 69 | 70 | Documentation 71 | ============= 72 | 73 | .. toctree:: 74 | :maxdepth: 2 75 | 76 | user_guide 77 | examples/index 78 | faq/index 79 | 80 | Tutorials 81 | ========= 82 | 83 | .. toctree:: 84 | :maxepth: 1 85 | 86 | A 87 | 88 | Authors 89 | ======= 90 | 91 | .. include:: ../AUTHORS.rst 92 | -------------------------------------------------------------------------------- /doc/install/anaconda.rst: -------------------------------------------------------------------------------- 1 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 2 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 3 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 4 | .. .. 5 | .. This file is part of the AutoWIG project. More information can be .. 6 | .. found at .. 7 | .. .. 8 | .. http://autowig.rtfd.io .. 9 | .. .. 10 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 11 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 12 | .. file except in compliance with the License. You should have received .. 13 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 14 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 15 | .. .. 16 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 17 | .. .. 18 | .. Unless required by applicable law or agreed to in writing, software .. 19 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 20 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 21 | .. mplied. See the License for the specific language governing .. 22 | .. permissions and limitations under the License. .. 23 | 24 | Installation from binaries 25 | ========================== 26 | 27 | In order to ease the installation of the **AutoWIG** software on multiple operating systems, the **Conda** package and environment management system is used. 28 | To install **Conda**, please refers to its `documentation `_ or follow the installation instructions given on the **StatisKit** `documentation `_. 29 | Once **Conda** is installed, you can install **AutoWIG** binaries into a special environment that will be used for wrapper generation by typing the following command line in your terminal: 30 | 31 | .. code-block:: console 32 | 33 | conda create -n autowig python-autowig -c statiskit 34 | 35 | .. warning:: 36 | 37 | When compiling wrappers generated by **AutoWIG** in its environment some issues can be encountered at compile time or run time (from within the *Python* interpreter) due to compiler or dependency incompatibilies. 38 | This is why it is recommended to install **AutoWIG** in a separate environment that will only be used for wrappers' generation. 39 | If the problem persits, please refers to the **StatisKit** `documentation `_ concerning the configuration of the development environment. 40 | -------------------------------------------------------------------------------- /doc/install/docker.rst: -------------------------------------------------------------------------------- 1 | .. _test-docker: 2 | 3 | Test it with **Docker** 4 | ======================= 5 | 6 | .. note:: 7 | 8 | **Docker** :cite:`Mer14` is an open-source project that automates the deployment of Linux applications inside software containers. 9 | 10 | 11 | We provide **Docker** images to enable to run **AutoWIG** on various platforms (in particular Windows and MacOS). 12 | For the installation of **Docker**, please refers to its `documentation `_. 13 | Then, you can use the :code:`statiskit/autowig` **Docker** image to run **AutoWIG**: 14 | 15 | .. code-block:: console 16 | 17 | $ docker run -i -t -p 8888:8888 statiskit/autowig 18 | 19 | A list of all available images can be found `here `_. 20 | The image tagged :code:`latest` is unstable, it could be preferable to use the one attached with the AutoWIG paper submitted in Journal of Computational Science (tagged :code:`v1.0.0-alpha`) as follows: 21 | 22 | .. code-block:: console 23 | 24 | $ docker run -i -t -p 8888:8888 statiskit/autowig:v1.0.0-alpha 25 | 26 | For convenience, examples are presented in **Jupyter** notebooks. 27 | You can therefore proceed -- in the container's terminal -- as follows to run examples: 28 | 29 | 1. Launch the Jupyter notebook with the following command 30 | 31 | .. code-block:: console 32 | 33 | $ jupyter notebook --ip='*' --port=8888 --no-browser 34 | 35 | 2. Copy the URL given in the container's terminal and paste it in your browser. 36 | This URL should looks like :code:`http://localhost:8888/?token=/[0-9a-fA-F]+/`. 37 | 38 | 3. Click on the notebooks you want to run (denoted by :code:`*.ipynb`) and then 39 | 40 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 41 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 42 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 43 | .. .. 44 | .. This file is part of the AutoWIG project. More information can be .. 45 | .. found at .. 46 | .. .. 47 | .. http://autowig.rtfd.io .. 48 | .. .. 49 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 50 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 51 | .. file except in compliance with the License. You should have received .. 52 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 53 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 54 | .. .. 55 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 56 | .. .. 57 | .. Unless required by applicable law or agreed to in writing, software .. 58 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 59 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 60 | .. mplied. See the License for the specific language governing .. 61 | .. permissions and limitations under the License. .. 62 | 63 | .. warning:: 64 | 65 | For some systems as Ubuntu, **Docker** requires root permissions (see this `page `_ for more information). 66 | -------------------------------------------------------------------------------- /doc/install/source.rst: -------------------------------------------------------------------------------- 1 | .. _install-source: 2 | 3 | Installation from source code 4 | ============================= 5 | 6 | For installing **AutoWIG** from source code, please refers to the **StatisKit** `documentation `_ concerning the configuration of the development environment. 7 | 8 | .. warning:: 9 | 10 | **AutoWIG** and **ClangLite** repositories are considered as submodule of the **StatisKit** repository. 11 | To update these repositories and benefit from the last development, you must first go to these submodules and pull the code from the actual repositories. 12 | This step, described below, has to be as soon as the **StatisKit** repository is cloned. 13 | 14 | .. code-block:: bash 15 | 16 | cd StatisKit 17 | cd share 18 | cd git 19 | cd ClangLite 20 | git pull origin master 21 | 22 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 23 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 24 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 25 | .. .. 26 | .. This file is part of the AutoWIG project. More information can be .. 27 | .. found at .. 28 | .. .. 29 | .. http://autowig.rtfd.io .. 30 | .. .. 31 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 32 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 33 | .. file except in compliance with the License. You should have received .. 34 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 35 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 36 | .. .. 37 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 38 | .. .. 39 | .. Unless required by applicable law or agreed to in writing, software .. 40 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 41 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 42 | .. mplied. See the License for the specific language governing .. 43 | .. permissions and limitations under the License. .. 44 | 45 | cd AutoWIG 46 | git pull origin master 47 | cd .. 48 | cd .. 49 | cd .. 50 | cd .. 51 | 52 | -------------------------------------------------------------------------------- /doc/make.bat: -------------------------------------------------------------------------------- 1 | :: Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, :: 2 | :: UMR AGAP CIRAD, EPI Virtual Plants Inria :: 3 | :: Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria :: 4 | :: :: 5 | :: This file is part of the AutoWIG project. More information can be :: 6 | :: found at :: 7 | :: :: 8 | :: http://autowig.rtfd.io :: 9 | :: :: 10 | :: The Apache Software Foundation (ASF) licenses this file to you under :: 11 | :: the Apache License, Version 2.0 (the "License"); you may not use this :: 12 | :: file except in compliance with the License. You should have received :: 13 | :: a copy of the Apache License, Version 2.0 along with this file; see :: 14 | :: the file LICENSE. If not, you may obtain a copy of the License at :: 15 | :: :: 16 | :: http://www.apache.org/licenses/LICENSE-2.0 :: 17 | :: :: 18 | :: Unless required by applicable law or agreed to in writing, software :: 19 | :: distributed under the License is distributed on an "AS IS" BASIS, :: 20 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or :: 21 | :: mplied. See the License for the specific language governing :: 22 | :: permissions and limitations under the License. :: 23 | 24 | @ECHO OFF 25 | 26 | REM Command file for Sphinx documentation 27 | 28 | if "%SPHINXBUILD%" == "" ( 29 | set SPHINXBUILD=sphinx-build 30 | ) 31 | set BUILDDIR=_build 32 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 33 | set I18NSPHINXOPTS=%SPHINXOPTS% . 34 | if NOT "%PAPER%" == "" ( 35 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 36 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 37 | ) 38 | 39 | if "%1" == "" goto help 40 | 41 | if "%1" == "help" ( 42 | :help 43 | echo.Please use `make ^` where ^ is one of 44 | echo. html to make standalone HTML files 45 | echo. dirhtml to make HTML files named index.html in directories 46 | echo. singlehtml to make a single large HTML file 47 | echo. pickle to make pickle files 48 | echo. json to make JSON files 49 | echo. htmlhelp to make HTML files and a HTML help project 50 | echo. qthelp to make HTML files and a qthelp project 51 | echo. devhelp to make HTML files and a Devhelp project 52 | echo. epub to make an epub 53 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 54 | echo. text to make text files 55 | echo. man to make manual pages 56 | echo. texinfo to make Texinfo files 57 | echo. gettext to make PO message catalogs 58 | echo. changes to make an overview over all changed/added/deprecated items 59 | echo. xml to make Docutils-native XML files 60 | echo. pseudoxml to make pseudoxml-XML files for display purposes 61 | echo. linkcheck to check all external links for integrity 62 | echo. doctest to run all doctests embedded in the documentation if enabled 63 | goto end 64 | ) 65 | 66 | if "%1" == "clean" ( 67 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 68 | del /q /s %BUILDDIR%\* 69 | goto end 70 | ) 71 | 72 | 73 | %SPHINXBUILD% 2> nul 74 | if errorlevel 9009 ( 75 | echo. 76 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 77 | echo.installed, then set the SPHINXBUILD environment variable to point 78 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 79 | echo.may add the Sphinx directory to PATH. 80 | echo. 81 | echo.If you don't have Sphinx installed, grab it from 82 | echo.http://sphinx-doc.org/ 83 | exit /b 1 84 | ) 85 | 86 | if "%1" == "html" ( 87 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 88 | if errorlevel 1 exit /b 1 89 | echo. 90 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 91 | goto end 92 | ) 93 | 94 | if "%1" == "dirhtml" ( 95 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 96 | if errorlevel 1 exit /b 1 97 | echo. 98 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 99 | goto end 100 | ) 101 | 102 | if "%1" == "singlehtml" ( 103 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 104 | if errorlevel 1 exit /b 1 105 | echo. 106 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 107 | goto end 108 | ) 109 | 110 | if "%1" == "pickle" ( 111 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 112 | if errorlevel 1 exit /b 1 113 | echo. 114 | echo.Build finished; now you can process the pickle files. 115 | goto end 116 | ) 117 | 118 | if "%1" == "json" ( 119 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 120 | if errorlevel 1 exit /b 1 121 | echo. 122 | echo.Build finished; now you can process the JSON files. 123 | goto end 124 | ) 125 | 126 | if "%1" == "htmlhelp" ( 127 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 128 | if errorlevel 1 exit /b 1 129 | echo. 130 | echo.Build finished; now you can run HTML Help Workshop with the ^ 131 | .hhp project file in %BUILDDIR%/htmlhelp. 132 | goto end 133 | ) 134 | 135 | if "%1" == "qthelp" ( 136 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 137 | if errorlevel 1 exit /b 1 138 | echo. 139 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 140 | .qhcp project file in %BUILDDIR%/qthelp, like this: 141 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\MngIt.qhcp 142 | echo.To view the help file: 143 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\MngIt.ghc 144 | goto end 145 | ) 146 | 147 | if "%1" == "devhelp" ( 148 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 149 | if errorlevel 1 exit /b 1 150 | echo. 151 | echo.Build finished. 152 | goto end 153 | ) 154 | 155 | if "%1" == "epub" ( 156 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 157 | if errorlevel 1 exit /b 1 158 | echo. 159 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 160 | goto end 161 | ) 162 | 163 | if "%1" == "latex" ( 164 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 165 | if errorlevel 1 exit /b 1 166 | echo. 167 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 168 | goto end 169 | ) 170 | 171 | if "%1" == "latexpdf" ( 172 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 173 | cd %BUILDDIR%/latex 174 | make all-pdf 175 | cd %BUILDDIR%/.. 176 | echo. 177 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 178 | goto end 179 | ) 180 | 181 | if "%1" == "latexpdfja" ( 182 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 183 | cd %BUILDDIR%/latex 184 | make all-pdf-ja 185 | cd %BUILDDIR%/.. 186 | echo. 187 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 188 | goto end 189 | ) 190 | 191 | if "%1" == "text" ( 192 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 193 | if errorlevel 1 exit /b 1 194 | echo. 195 | echo.Build finished. The text files are in %BUILDDIR%/text. 196 | goto end 197 | ) 198 | 199 | if "%1" == "man" ( 200 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 201 | if errorlevel 1 exit /b 1 202 | echo. 203 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 204 | goto end 205 | ) 206 | 207 | if "%1" == "texinfo" ( 208 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 209 | if errorlevel 1 exit /b 1 210 | echo. 211 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 212 | goto end 213 | ) 214 | 215 | if "%1" == "gettext" ( 216 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 217 | if errorlevel 1 exit /b 1 218 | echo. 219 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 220 | goto end 221 | ) 222 | 223 | if "%1" == "changes" ( 224 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 225 | if errorlevel 1 exit /b 1 226 | echo. 227 | echo.The overview file is in %BUILDDIR%/changes. 228 | goto end 229 | ) 230 | 231 | if "%1" == "linkcheck" ( 232 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 233 | if errorlevel 1 exit /b 1 234 | echo. 235 | echo.Link check complete; look for any errors in the above output ^ 236 | or in %BUILDDIR%/linkcheck/output.txt. 237 | goto end 238 | ) 239 | 240 | if "%1" == "doctest" ( 241 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 242 | if errorlevel 1 exit /b 1 243 | echo. 244 | echo.Testing of doctests in the sources finished, look at the ^ 245 | results in %BUILDDIR%/doctest/output.txt. 246 | goto end 247 | ) 248 | 249 | if "%1" == "xml" ( 250 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 251 | if errorlevel 1 exit /b 1 252 | echo. 253 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 254 | goto end 255 | ) 256 | 257 | if "%1" == "pseudoxml" ( 258 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 259 | if errorlevel 1 exit /b 1 260 | echo. 261 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 262 | goto end 263 | ) 264 | 265 | :end 266 | -------------------------------------------------------------------------------- /doc/references.bib: -------------------------------------------------------------------------------- 1 | @article{Bea03, 2 | title={Automated scientific software scripting with SWIG}, 3 | author={Beazley, David M}, 4 | journal={Future Generation Computer Systems}, 5 | volume={19}, 6 | number={5}, 7 | pages={599--609}, 8 | year={2003}, 9 | publisher={Elsevier} 10 | } 11 | 12 | @article{Pet09, 13 | title={F2PY: a tool for connecting Fortran and Python programs}, 14 | author={Peterson, Pearu}, 15 | journal={International Journal of Computational Science and Engineering}, 16 | volume={4}, 17 | number={4}, 18 | pages={296--305}, 19 | year={2009}, 20 | publisher={Inderscience Publishers} 21 | } 22 | 23 | @article{EFAC+11, 24 | title={Rcpp: Seamless R and C++ integration}, 25 | author={Eddelbuettel, Dirk and Fran{\c{c}}ois, Romain and Allaire, J and Chambers, John and Bates, Douglas and Ushey, Kevin}, 26 | journal={Journal of Statistical Software}, 27 | volume={40}, 28 | number={8}, 29 | pages={1--18}, 30 | year={2011} 31 | } 32 | 33 | @article{AG03, 34 | title={Building hybrid systems with Boost.Python}, 35 | author={Abrahams, David and Grosse-Kunstleve, Ralf W}, 36 | journal={CC Plus Plus Users Journal}, 37 | volume={21}, 38 | number={7}, 39 | pages={29--36}, 40 | year={2003}, 41 | publisher={CMP Media LLC} 42 | } 43 | 44 | @article{Klo08, 45 | title={Automatic C Library Wrapping Ctypes from the Trenches}, 46 | author={Kloss, Guy K}, 47 | journal={The Python Papers}, 48 | volume={3}, 49 | number={3}, 50 | pages={5}, 51 | year={2008} 52 | } 53 | 54 | @article{BBCD+11, 55 | title={Cython: The best of both worlds}, 56 | author={Behnel, Stefan and Bradshaw, Robert and Citro, Craig and Dalcin, Lisandro and Seljebotn, Dag Sverre and Smith, Kurt}, 57 | journal={Computing in Science \& Engineering}, 58 | volume={13}, 59 | number={2}, 60 | pages={31--39}, 61 | year={2011}, 62 | publisher={AIP Publishing} 63 | } 64 | 65 | @article{Oli07, 66 | title={Python for scientific computing}, 67 | author={Oliphant, Travis E}, 68 | journal={Computing in Science \& Engineering}, 69 | volume={9}, 70 | number={3}, 71 | pages={10--20}, 72 | year={2007}, 73 | publisher={AIP Publishing} 74 | } 75 | 76 | @Article{PDKBFG08, 77 | Title = {{O}pen{A}lea: a visual programming and component-based software platform for plant modelling}, 78 | Author = {Pradal, Christophe and Dufour-Kowalski, Samuel and Boudon, Fr{\'e}d{\'e}ric and Fournier, Christian and Godin, Christophe}, 79 | Journal = {Functional plant biology}, 80 | Year = {2008}, 81 | Number = {10}, 82 | Pages = {751--760}, 83 | Volume = {35}, 84 | Publisher = {CSIRO}, 85 | } 86 | 87 | @Article{Kni05, 88 | Title = {Building software with SCons}, 89 | Author = {Knight, Steven}, 90 | Journal = {Computing in Science and Engineering}, 91 | Year = {2005}, 92 | Number = {1}, 93 | Pages = {79--88}, 94 | Volume = {7}, 95 | } 96 | 97 | @Book{MH10, 98 | Title = {Mastering CMake}, 99 | Author = {Martin, Ken and Hoffman, Bill}, 100 | Publisher = {Kitware}, 101 | Year = {2010}, 102 | } 103 | 104 | @Article{PG07, 105 | Title = {{IP}ython: a system for interactive scientific computing}, 106 | Author = {Perez, Fernando and Granger, Brian E}, 107 | Journal = {Computing in Science \& Engineering}, 108 | Year = {2007}, 109 | Number = {3}, 110 | Pages = {21--29}, 111 | Volume = {9}, 112 | Publisher = {AIP Publishing}, 113 | } 114 | 115 | @Manual{EBHW14, 116 | author = {John W. Eaton, David Bateman, Soren Hauberg and Rik Wehbring}, 117 | title = {{GNU Octave} version 3.8.1 manual: a high-level interactive language for numerical computations}, 118 | publisher = {CreateSpace Independent Publishing Platform}, 119 | year = {2014}, 120 | url = {http://www.gnu.org/software/octave/doc/interpreter} 121 | } 122 | 123 | @Manual{sage15, 124 | Key = {Sage}, 125 | Author = {{The Sage Developers}}, 126 | Title = {{S}age {M}athematics {S}oftware ({V}ersion 6.9)}, 127 | url = {http://www.sagemath.org}, 128 | Year = {2015}, 129 | } 130 | 131 | @Manual{R14, 132 | title = {R: A Language and Environment for Statistical Computing}, 133 | author = {{R Core Team}}, 134 | organization = {R Foundation for Statistical Computing}, 135 | address = {Vienna, Austria}, 136 | year = {2014}, 137 | url = {http://www.R-project.org/}, 138 | } 139 | 140 | @InProceedings{LA04, 141 | Title = {LLVM: A compilation framework for lifelong program analysis \& transformation}, 142 | Author = {Lattner, Chris and Adve, Vikram}, 143 | Booktitle = {Code Generation and Optimization, 2004. CGO 2004. International Symposium on}, 144 | Year = {2004}, 145 | Organization = {IEEE}, 146 | Pages = {75--86}, 147 | } 148 | 149 | @InProceedings{Lat08, 150 | Title = {LLVM and Clang: Next generation compiler technology}, 151 | Author = {Lattner, Chris}, 152 | Booktitle = {The BSD Conference}, 153 | Year = {2008}, 154 | Pages = {1--2}, 155 | } 156 | 157 | @misc{Kin12, 158 | Title = {GCC-XML the xml output extension to gcc}, 159 | Author = {King, Brad and others}, 160 | url = {http://www. gccxml. org/HTML/Index. html}, 161 | Year = {2012}, 162 | } 163 | 164 | @Manual{Sco13, 165 | author = {Anthony Scopatz}, 166 | title = {XDress - Type, But Verify}, 167 | url = {http://conference.scipy.org/scipy2013/presentation\_detail.php?id=164}, 168 | year = {2013}, 169 | } 170 | 171 | @Manual{RS12, 172 | Title = {{O}pen {F}ortran {P}arser}, 173 | Author = {Rasmussen, C and Sottile, M}, 174 | Year = {2012}, 175 | url = {http://fortran-parser.sourceforge.net} 176 | } 177 | 178 | @Article{Gar12, 179 | Title = {An abstract view on syntax with sharing}, 180 | Author = {Garner, Richard}, 181 | Journal = {Journal of Logic and Computation}, 182 | Year = {2012}, 183 | Number = {6}, 184 | Pages = {1427--1452}, 185 | Volume = {22}, 186 | 187 | Publisher = {Oxford Univ Press}, 188 | 189 | } 190 | 191 | @Article{Gun11, 192 | Title = {Architecture of clang}, 193 | Author = {Guntli, Christopher}, 194 | Journal = {Analyze an open source compiler based on LLVM}, 195 | Year = {2011}, 196 | } 197 | 198 | @Manual{Hee08, 199 | author = {van Heesch, Dimitri}, 200 | title = {{\pkg{Doxygen}: Source code documentation generator tool}}, 201 | year = {2008}, 202 | url = {http://www.doxygen.org} 203 | } 204 | 205 | @Manual{Bra09, 206 | author = {Brandl, Georg}, 207 | title = {{\pkg{Sphinx}: \proglang{Python} Documentation Generator}}, 208 | year = {2009}, 209 | url = {http://sphinx.pocoo.org/index.html} 210 | } 211 | 212 | @Manual{ST16, 213 | author = {{Python Packaging Authority}}, 214 | title = {{\pkg{Setuptools}}}, 215 | year = {2016}, 216 | url = {https://bitbucket.org/pypa/setuptools} 217 | } 218 | 219 | @Manual{Yak11, 220 | author = {Roman Yakovenko}, 221 | title = {{\pkg{Py++}}}, 222 | year = {2011}, 223 | url = {https://sourceforge.net/projects/pygccxml} 224 | } 225 | 226 | @Manual{Bay12, 227 | title={{\pkg{Mako} Templates for \proglang{Python}}}, 228 | author={Bayer, Michael}, 229 | year={2012}, 230 | url = {http://www.makotemplates.org/} 231 | } 232 | 233 | @book{Bea09, 234 | title={Python essential reference}, 235 | author={Beazley, David M}, 236 | year={2009}, 237 | publisher={Addison-Wesley Professional} 238 | } 239 | 240 | @misc{San10, 241 | Title = {Armadillo: An open source C++ linear algebra library for fast prototyping and computationally intensive experiments}, 242 | Author = {Sanderson, Conrad}, 243 | Year = {2010}, 244 | 245 | Publisher = {NICTA}, 246 | } 247 | 248 | @Book{PLMS00, 249 | Title = {C++ Standard Template Library}, 250 | Author = {Plauger, Phillip James and Lee, Meng and Musser, David and Stepanov, Alexander A.}, 251 | Publisher = {Prentice Hall PTR}, 252 | Year = {2000}, 253 | } 254 | 255 | @article{lehmann2006wrapitk, 256 | title={WrapITK: Enhanced languages support for the Insight Toolkit}, 257 | author={Lehmann, Gaetan and Pincus, Zachary and Regrain, Benoit}, 258 | journal={The Insight Journal}, 259 | volume={1}, 260 | pages={1--35}, 261 | year={2006} 262 | } 263 | 264 | @article{WSNBWYGY14, 265 | title={scikit-image: image processing in Python}, 266 | author={Van Der Walt, Stefan and Sch{\"o}nberger, Johannes L and Nunez-Iglesias, Juan and Boulogne, Fran{\c{c}}ois and Warner, Joshua D and Yager, Neil and Gouillart, Emmanuelle and Yu, Tony}, 267 | journal={PeerJ}, 268 | volume={2}, 269 | pages={e453}, 270 | year={2014}, 271 | publisher={PeerJ Inc.} 272 | } 273 | 274 | @article{PVGMTGBPWD+11, 275 | title={Scikit-learn: Machine learning in Python}, 276 | author={Pedregosa, Fabian and Varoquaux, Ga{\"e}l and Gramfort, Alexandre and Michel, Vincent and Thirion, Bertrand and Grisel, Olivier and Blondel, Mathieu and Prettenhofer, Peter and Weiss, Ron and Dubourg, Vincent and others}, 277 | journal={The Journal of Machine Learning Research}, 278 | volume={12}, 279 | pages={2825--2830}, 280 | year={2011}, 281 | publisher={JMLR. org} 282 | } 283 | 284 | @Book{SML97, 285 | Title = {The Visualization Toolkit, An Object-Oriented Approach To 3D Graphics}, 286 | Author = {Schroeder, Will and Martin, Ken and Lorensen, Bill}, 287 | Publisher = {Prentice hall}, 288 | Year = {1997}, 289 | 290 | Keywords = {vtk}, 291 | } 292 | 293 | @misc{JOP14, 294 | title={$\{$SciPy$\}$: open source scientific tools for $\{$Python$\}$}, 295 | author={Jones, Eric and Oliphant, Travis and Peterson, Pearu}, 296 | year={2014} 297 | } 298 | 299 | @Article{GCHLM07, 300 | Title = {Analyzing growth components in trees}, 301 | Author = {Gu{\'e}don, Yann and Caraglio, Yves and Heuret, Patrick and Lebarbier, Emilie and Meredieu, C{\'e}line}, 302 | Journal = {Journal of Theoretical Biology}, 303 | Year = {2007}, 304 | Number = {3}, 305 | Pages = {418--447}, 306 | Volume = {248}, 307 | Publisher = {Elsevier}, 308 | 309 | } 310 | 311 | @Article{LGMYB15, 312 | Title = {Differentiated responses of apple tree floral phenology to global warming in contrasting climatic regions}, 313 | Author = {Legave, Jean-Michel and Gu{\'e}don, Yann and Malagi, Gustavo and El Yaacoubi, Adnane and Bonhomme, Marc}, 314 | Journal = {Frontiers in plant science}, 315 | Year = {2015}, 316 | Volume = {6}, 317 | 318 | Publisher = {Frontiers Media SA}, 319 | } 320 | 321 | @Article{Gue13, 322 | Title = {Exploring the latent segmentation space for the assessment of multiple change-point models}, 323 | Author = {Gu{\'e}don, Yann}, 324 | Journal = {Computational Statistics}, 325 | Year = {2013}, 326 | Number = {6}, 327 | Pages = {2641--2678}, 328 | Volume = {28}, 329 | Publisher = {Springer}, 330 | } 331 | 332 | @Article{Gue15a, 333 | Title = {Segmentation uncertainty in multiple change-point models}, 334 | Author = {Gu{\'e}don, Yann}, 335 | Journal = {Statistics and Computing}, 336 | Year = {2015}, 337 | Number = {2}, 338 | Pages = {303--320}, 339 | Volume = {25}, 340 | Publisher = {Springer}, 341 | } 342 | 343 | @Article{ZS07, 344 | Title = {A modified {B}ayes information criterion with applications to the analysis of comparative genomic hybridization data}, 345 | Author = {Zhang, Nancy R and Siegmund, David O}, 346 | Journal = {Biometrics}, 347 | Year = {2007}, 348 | Number = {1}, 349 | Pages = {22--32}, 350 | Volume = {63}, 351 | Publisher = {Wiley Online Library}, 352 | } 353 | 354 | @InProceedings{Gue15b, 355 | Title = {Slope heuristics for multiple change-point models}, 356 | Author = {Gu{\'e}don, Yann}, 357 | Booktitle = {30th International Workshop on Statistical Modelling (IWSM 2015)}, 358 | Year = {2015}, 359 | } 360 | 361 | @Book{RF12, 362 | Title = {Numerical Bayesian methods applied to signal processing}, 363 | Author = {Ruanaidh, Joseph JK O and Fitzgerald, William J}, 364 | Publisher = {Springer Science \& Business Media}, 365 | Year = {2012}, 366 | } 367 | 368 | @article{Mer14, 369 | title={Docker: lightweight linux containers for consistent development and deployment}, 370 | author={Merkel, Dirk}, 371 | journal={Linux Journal}, 372 | volume={2014}, 373 | number={239}, 374 | pages={2}, 375 | year={2014}, 376 | publisher={Belltown Media} 377 | } 378 | -------------------------------------------------------------------------------- /doc/thumbnails/EuroSciPy2017a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StatisKit/AutoWIG/e68f0bd7b7e971c80419342d8dc6716a4b59a13c/doc/thumbnails/EuroSciPy2017a.jpg -------------------------------------------------------------------------------- /doc/thumbnails/EuroSciPy2017b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StatisKit/AutoWIG/e68f0bd7b7e971c80419342d8dc6716a4b59a13c/doc/thumbnails/EuroSciPy2017b.jpg -------------------------------------------------------------------------------- /doc/thumbnails/arXiv2017.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StatisKit/AutoWIG/e68f0bd7b7e971c80419342d8dc6716a4b59a13c/doc/thumbnails/arXiv2017.jpg -------------------------------------------------------------------------------- /doc/user_guide.rst: -------------------------------------------------------------------------------- 1 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 2 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 3 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 4 | .. .. 5 | .. This file is part of the AutoWIG project. More information can be .. 6 | .. found at .. 7 | .. .. 8 | .. http://autowig.rtfd.io .. 9 | .. .. 10 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 11 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 12 | .. file except in compliance with the License. You should have received .. 13 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 14 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 15 | .. .. 16 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 17 | .. .. 18 | .. Unless required by applicable law or agreed to in writing, software .. 19 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 20 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 21 | .. mplied. See the License for the specific language governing .. 22 | .. permissions and limitations under the License. .. 23 | 24 | User guide 25 | ========== 26 | 27 | .. note:: 28 | 29 | In this section, we introduce wrapping problems and how **AutoWIG** aims at minimize developers effort. 30 | Basic concepts and conventions are introduced. 31 | 32 | Problem setting 33 | --------------- 34 | 35 | Consider a scientist who has designed multiple *C++* libraries for statistical analysis. 36 | He would like to distribute his libraries and decide to make them available in *Python* in order to reach a public of statisticians but also less expert scientists such as biologists. 37 | Yet, he is not interested in becoming an expert in *C++*/*Python* wrapping, even if it exists classical approaches consisting in writing wrappers with **SWIG** :cite:`Bea03` or **Boost.Python** :cite:`AG03`. 38 | Moreover, he would have serious difficulties to maintain the wrappers, since this semi-automatic process is time consuming and error prone. 39 | Instead, he would like to automate the process of generating wrappers in sync with his evolving *C++* libraries. 40 | That's what the **AutoWIG** software aspires to achieve. 41 | 42 | Automating the process 43 | ---------------------- 44 | 45 | Building such a system entails achieving some minimal features: 46 | 47 | *C++* parsing 48 | In order to automatically expose *C++* components in *Python*, the system requires parsing full legacy code implementing the last *C++* standard. 49 | It has also to represent C++ constructs in Python, like namespaces, enumerators, enumerations, variables, functions, classes or aliases. 50 | 51 | Documentation 52 | The documentation of *C++* components has to be associated automatically to their corresponding *Python* components in order to reduce the redundancy and to keep it up-to-date in only one place. 53 | 54 | Pythonic interface 55 | To respect the *Python* philosophy, *C++* language patterns need to be consistently translated into *Python*. 56 | Some syntax or design patterns in *C++* code are specific and need to be adapted in order to obtain a functional *Python* package. 57 | Note that this is particularly sensible for *C++* operators (e.g. :code:`()`, :code:`<`, :code:`[]`) and corresponding *Python* special functions (e.g. :code:`__call__`, :code:`__lt__`, :code:`__getitem__`, :code:`__setitem__`) or for object serialization. 58 | 59 | Memory management 60 | *C++* libraries expose in their interfaces either raw pointers, shared pointers or references, while *Python* handles memory allocation and garbage collection automatically. 61 | The concepts of pointer or references are thus not meaningful in *Python*. 62 | These language differences entail several problems in the memory management of *C++* components into *Python*. 63 | A special attention is therefore required for dealing with references (:code:`&`) and pointers (:code:`*`) that are highly used in *C++*. 64 | 65 | Error management 66 | *C++* exceptions need to be consistently managed in *Python*. 67 | *Python* doesn't have the necessary equipment to properly unwind the *C++* stack when exception are thrown. 68 | It is therefore important to make sure that exceptions thrown by *C++* code do not pass into the *Python* interpreter core. 69 | All *C++* exceptions thrown by wrappers must therefore be translated into *Python* errors. 70 | This translation must preserve exception names and contents in order to raise informative *Python* errors. 71 | 72 | Dependency management between components 73 | The management of multiple dependencies between *C++* libraries with *Python* bindings is required at run-time from *Python*. 74 | *C++* libraries tends to have dependencies. 75 | For instance the *C++* **Standard Template Library** containers :cite:`PLMS00` are used in many *C++* libraries (e.g :code:`std::vector`, :code:`std::set`). 76 | For such cases, it doesn't seem relevant that every wrapped *C++* library contains wrappers for usual **STL** containers (e.g. :code:`std::vector< double >`, :code:`std::set< int >`). 77 | Moreover, loading in the *Python* interpreter multiple compiled libraries sharing different wrappers from same *C++* components could lead to serious side effects. 78 | It is therefore required that dependencies across different library bindings can be handled automatically. 79 | -------------------------------------------------------------------------------- /doc/zreferences.rst: -------------------------------------------------------------------------------- 1 | .. Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, .. 2 | .. UMR AGAP CIRAD, EPI Virtual Plants Inria .. 3 | .. Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria .. 4 | .. .. 5 | .. This file is part of the AutoWIG project. More information can be .. 6 | .. found at .. 7 | .. .. 8 | .. http://autowig.rtfd.io .. 9 | .. .. 10 | .. The Apache Software Foundation (ASF) licenses this file to you under .. 11 | .. the Apache License, Version 2.0 (the "License"); you may not use this .. 12 | .. file except in compliance with the License. You should have received .. 13 | .. a copy of the Apache License, Version 2.0 along with this file; see .. 14 | .. the file LICENSE. If not, you may obtain a copy of the License at .. 15 | .. .. 16 | .. http://www.apache.org/licenses/LICENSE-2.0 .. 17 | .. .. 18 | .. Unless required by applicable law or agreed to in writing, software .. 19 | .. distributed under the License is distributed on an "AS IS" BASIS, .. 20 | .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or .. 21 | .. mplied. See the License for the specific language governing .. 22 | .. permissions and limitations under the License. .. 23 | 24 | References 25 | ========== 26 | 27 | .. bibliography:: references.bib 28 | -------------------------------------------------------------------------------- /etc/conda/autowig-toolchain/activate.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StatisKit/AutoWIG/e68f0bd7b7e971c80419342d8dc6716a4b59a13c/etc/conda/autowig-toolchain/activate.bat -------------------------------------------------------------------------------- /etc/conda/autowig-toolchain/activate.sh: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the StatisKit project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://statiskit.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | export MACOSX_DEPLOYMENT_TARGET=10.9 -------------------------------------------------------------------------------- /etc/conda/autowig-toolchain/bld.bat: -------------------------------------------------------------------------------- 1 | :: Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, :: 2 | :: UMR AGAP CIRAD, EPI Virtual Plants Inria :: 3 | :: Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria :: 4 | :: :: 5 | :: This file is part of the StatisKit project. More information can be :: 6 | :: found at :: 7 | :: :: 8 | :: http://statiskit.rtfd.io :: 9 | :: :: 10 | :: The Apache Software Foundation (ASF) licenses this file to you under :: 11 | :: the Apache License, Version 2.0 (the "License"); you may not use this :: 12 | :: file except in compliance with the License. You should have received :: 13 | :: a copy of the Apache License, Version 2.0 along with this file; see :: 14 | :: the file LICENSE. If not, you may obtain a copy of the License at :: 15 | :: :: 16 | :: http://www.apache.org/licenses/LICENSE-2.0 :: 17 | :: :: 18 | :: Unless required by applicable law or agreed to in writing, software :: 19 | :: distributed under the License is distributed on an "AS IS" BASIS, :: 20 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or :: 21 | :: mplied. See the License for the specific language governing :: 22 | :: permissions and limitations under the License. :: 23 | 24 | echo ON 25 | 26 | if not exist %PREFIX%\etc\conda\activate.d mkdir %PREFIX%\etc\conda\activate.d 27 | if errorlevel 1 exit 1 28 | copy %RECIPE_DIR%\activate.bat %PREFIX%\etc\conda\activate.d\autowig-toolchain_vars.bat 29 | 30 | if not exist %PREFIX%\etc\conda\deactivate.d mkdir %PREFIX%\etc\conda\deactivate.d 31 | if errorlevel 1 exit 1 32 | copy %RECIPE_DIR%\deactivate.bat %PREFIX%\etc\conda\deactivate.d\autowig-toolchain_vars.bat 33 | 34 | 35 | echo OFF 36 | -------------------------------------------------------------------------------- /etc/conda/autowig-toolchain/build.sh: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the StatisKit project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://statiskit.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | set -ve 25 | 26 | mkdir -p ${PREFIX}/etc/conda/activate.d 27 | cp ${RECIPE_DIR}/activate.sh ${PREFIX}/etc/conda/activate.d/autowig-toolchain_vars.sh 28 | 29 | mkdir -p ${PREFIX}/etc/conda/deactivate.d 30 | cp ${RECIPE_DIR}/deactivate.sh ${PREFIX}/etc/conda/deactivate.d/autowig-toolchain_vars.sh 31 | 32 | set +ve -------------------------------------------------------------------------------- /etc/conda/autowig-toolchain/deactivate.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StatisKit/AutoWIG/e68f0bd7b7e971c80419342d8dc6716a4b59a13c/etc/conda/autowig-toolchain/deactivate.bat -------------------------------------------------------------------------------- /etc/conda/autowig-toolchain/deactivate.sh: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the StatisKit project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://statiskit.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | unset MACOSX_DEPLOYMENT_TARGET -------------------------------------------------------------------------------- /etc/conda/autowig-toolchain/meta.yaml: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | package: 25 | name: autowig-toolchain 26 | version: {{ DATETIME_DESCRIBE_VERSION }} 27 | 28 | build: 29 | number: {{ DATETIME_DESCRIBE_NUMBER }} 30 | 31 | about: 32 | home: http://autowig.readthedocs.org 33 | license: Apache License 2.0 34 | summary: Automatic Wrapper and Interface Generator 35 | 36 | requirements: 37 | build: 38 | - libboost-dev 39 | - libboost_python 40 | - libpybind11-dev 41 | - python-pybind11 42 | - python-autowig 43 | - libtoolchain 44 | - python-toolchain 45 | - python-clanglite 46 | - {{ compiler('c') }} 47 | - {{ compiler('cxx') }} 48 | host: 49 | - python 50 | run: 51 | - {{ pin_compatible('libboost-dev', min_pin='x.x', max_pin='x.x') }} 52 | - {{ pin_compatible('libboost_python', min_pin='x.x', max_pin='x.x') }} 53 | - {{ pin_compatible('libpybind11-dev', min_pin='x.x', max_pin='x.x') }} 54 | - {{ pin_compatible('python-pybind11', min_pin='x.x', max_pin='x.x') }} 55 | - {{ pin_compatible('python-autowig', exact=True) }} 56 | - {{ pin_compatible('libtoolchain', exact=True) }} 57 | - {{ pin_compatible('python-toolchain', exact=True) }} 58 | - {{ pin_compatible('python-clanglite', exact=True) }} 59 | - {{ compiler('c') }} 60 | - {{ compiler('cxx') }} 61 | - python -------------------------------------------------------------------------------- /etc/conda/python-autowig/bld.bat: -------------------------------------------------------------------------------- 1 | :: Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, :: 2 | :: UMR AGAP CIRAD, EPI Virtual Plants Inria :: 3 | :: Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria :: 4 | :: :: 5 | :: This file is part of the AutoWIG project. More information can be :: 6 | :: found at :: 7 | :: :: 8 | :: http://autowig.rtfd.io :: 9 | :: :: 10 | :: The Apache Software Foundation (ASF) licenses this file to you under :: 11 | :: the Apache License, Version 2.0 (the "License"); you may not use this :: 12 | :: file except in compliance with the License. You should have received :: 13 | :: a copy of the Apache License, Version 2.0 along with this file; see :: 14 | :: the file LICENSE. If not, you may obtain a copy of the License at :: 15 | :: :: 16 | :: http://www.apache.org/licenses/LICENSE-2.0 :: 17 | :: :: 18 | :: Unless required by applicable law or agreed to in writing, software :: 19 | :: distributed under the License is distributed on an "AS IS" BASIS, :: 20 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or :: 21 | :: mplied. See the License for the specific language governing :: 22 | :: permissions and limitations under the License. :: 23 | 24 | echo ON 25 | 26 | if "%PY3K%" == "0" ( 27 | 3to2 -n -w %SRC_DIR%\src\py\autowig -x str 28 | 3to2 -n -w %SRC_DIR%\test 29 | ) 30 | 31 | %PYTHON% setup.py install --prefix=%PREFIX% 32 | if errorlevel 1 exit 1 33 | 34 | echo OFF -------------------------------------------------------------------------------- /etc/conda/python-autowig/build.sh: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | set -ev 25 | 26 | cd . 27 | 28 | $PYTHON setup.py install --prefix=$PREFIX 29 | 30 | set +ev 31 | -------------------------------------------------------------------------------- /etc/conda/python-autowig/meta.yaml: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | package: 25 | name: python-autowig 26 | version: {{ GIT_DESCRIBE_VERSION }} 27 | 28 | source: 29 | path: ../../.. 30 | 31 | build: 32 | number: {{ GIT_DESCRIBE_NUMBER }} 33 | 34 | about: 35 | home: http://autowig.readthedocs.org 36 | license: Apache License 2.0 37 | summary: Automatic Wrapper and Interface Generator 38 | 39 | requirements: 40 | build: 41 | - python-toolchain 42 | host: 43 | - python 44 | - six 45 | run: 46 | - python 47 | - mako 48 | - python-dateutil 49 | - python-parse 50 | - pygments 51 | - pandoc 52 | - pypandoc 53 | - path.py 54 | - numpy 55 | 56 | test: 57 | source_files: 58 | - test 59 | requires: 60 | - {{ compiler('c') }} 61 | - {{ compiler('cxx') }} 62 | - python 63 | - nose 64 | - libtoolchain 65 | - python-toolchain 66 | - clang 67 | - python-clanglite 68 | - git 69 | - gitpython 70 | - libboost-dev 71 | - libboost_python 72 | - libpybind11-dev 73 | # commands: 74 | # - nosetests test -x -s -v -A "level <= {{ environ.get('TEST_LEVEL', 1) }} and linux" [linux] 75 | # - nosetests test -x -s -v -A "level <= {{ environ.get('TEST_LEVEL', 1) }} and osx" [osx] 76 | # - nosetests test -x -s -v -A "level <= {{ environ.get('TEST_LEVEL', 1) }} and win" [win] -------------------------------------------------------------------------------- /readthedocs.yml: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | conda: 25 | file: doc/environment.yml 26 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | import six 25 | import os 26 | from setuptools import setup, find_packages 27 | 28 | packages = {"" : "src" + os.sep + "py"} 29 | for package in find_packages("src" + os.sep + "py"): 30 | packages[package] = "src" + os.sep + "py" 31 | 32 | setup(packages = packages.keys(), 33 | package_dir = {"" : "src" + os.sep + "py"}, 34 | name = 'autowig', 35 | version = '1.0.0', 36 | author = 'Pierre Fernique', 37 | author_email = 'pfernique@gmail', 38 | description = '', 39 | long_description = '', 40 | license = 'Apache License 2.0', 41 | package_data = {package: [ "*.so", "*.dll"] for package in packages}, 42 | entry_points = { 43 | 'autowig.parser': [], 44 | 'autowig.controller': ['default = autowig.default_controller:default_controller'], 45 | 'autowig.generator': ['boost_python = autowig.boost_python_generator:boost_python_generator', 46 | 'boost_python_pattern = autowig.boost_python_generator:boost_python_pattern_generator', 47 | 'boost_python_internal = autowig.boost_python_generator:boost_python_internal_generator', 48 | 'boost_python_closure = autowig.boost_python_generator:boost_python_closure_generator', 49 | 'pybind11 = autowig.pybind11_generator:pybind11_generator', 50 | 'pybind11_pattern = autowig.pybind11_generator:pybind11_pattern_generator', 51 | 'pybind11_internal = autowig.pybind11_generator:pybind11_internal_generator', 52 | 'pybind11_closure = autowig.pybind11_generator:pybind11_closure_generator'], 53 | 'autowig.visitor': ['boost_python = autowig.boost_python_generator:boost_python_visitor', 54 | 'boost_python_closure = autowig.boost_python_generator:boost_python_closure_visitor', 55 | 'pybind11 = autowig.pybind11_generator:pybind11_visitor', 56 | 'pybind11_closure = autowig.pybind11_generator:pybind11_closure_visitor', 57 | 'all = autowig.asg:all_visitor', 58 | 'free = autowig.asg:free_visitor', 59 | 'public = autowig.asg:public_visitor', 60 | 'protected = autowig.asg:protected_visitor', 61 | 'private = autowig.asg:private_visitor'], 62 | 'autowig.feedback' : ['edit = autowig.edit_feedback:edit_feedback', 63 | 'comment = autowig.comment_feedback:comment_feedback'], 64 | 'autowig.boost_python_call_policy': ['default = autowig.boost_python_generator:boost_python_default_call_policy'], 65 | 'autowig.boost_python_export': ['custom = autowig.boost_python_generator:BoostPythonExportFileProxy', 66 | 'default = autowig.boost_python_generator:BoostPythonExportDefaultFileProxy'], 67 | 'autowig.boost_python_module': ['default = autowig.boost_python_generator:BoostPythonModuleFileProxy'], 68 | 'autowig.boost_python_decorator': ['default = autowig.boost_python_generator:BoostPythonDecoratorDefaultFileProxy'], 69 | 'autowig.pybind11_call_policy': ['default = autowig.pybind11_generator:pybind11_default_call_policy'], 70 | 'autowig.pybind11_export': ['default = autowig.pybind11_generator:PyBind11ExportFileProxy'], 71 | 'autowig.pybind11_module': ['default = autowig.pybind11_generator:PyBind11ModuleFileProxy'], 72 | 'autowig.pybind11_decorator': ['default = autowig.pybind11_generator:PyBind11DecoratorDefaultFileProxy'], 73 | 'autowig.node_rename': ['PEP8 = autowig._node_rename:pep8_node_rename'], 74 | 'autowig.documenter': ['doxygen2sphinx = autowig.doxygen2sphinx:doxygen2sphinx_documenter'], 75 | 'autowig.node_path' : ['scope = autowig._node_path:scope_node_path', 76 | 'hash = autowig._node_path:hash_node_path'], 77 | 'console_scripts': [], 78 | }, 79 | zip_safe = False 80 | ) 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/py/autowig/__init__.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | """ 25 | """ 26 | 27 | import warnings 28 | 29 | from .asg import AbstractSemanticGraph, visitor 30 | visitor.plugin = 'all' 31 | 32 | from ._parser import parser 33 | if 'clanglite' in parser: 34 | parser.plugin = 'clanglite' 35 | elif 'libclang' in parser: 36 | parser.plugin = 'libclang' 37 | else: 38 | warnings.warn("no parser available", RuntimeWarning) 39 | 40 | from ._documenter import documenter 41 | documenter.plugin = 'doxygen2sphinx' 42 | 43 | from ._controller import controller 44 | controller.plugin = 'default' 45 | 46 | from ._feedback import feedback 47 | feedback.plugin = 'edit' 48 | 49 | from ._node_rename import node_rename 50 | node_rename.plugin = 'PEP8' 51 | 52 | from ._node_path import node_path 53 | node_path.plugin = 'hash' 54 | 55 | from .boost_python_generator import boost_python_call_policy, boost_python_export, boost_python_module, boost_python_decorator 56 | boost_python_call_policy.plugin = 'default' 57 | boost_python_export.proxy = 'default' 58 | boost_python_module.proxy = 'default' 59 | boost_python_decorator.proxy = 'default' 60 | 61 | from .pybind11_generator import pybind11_call_policy, pybind11_export, pybind11_module, pybind11_decorator 62 | pybind11_call_policy.plugin = 'default' 63 | pybind11_export.proxy = 'default' 64 | pybind11_module.proxy = 'default' 65 | pybind11_decorator.proxy = 'default' 66 | 67 | from ._generator import generator 68 | generator.plugin = 'boost_python' 69 | -------------------------------------------------------------------------------- /src/py/autowig/_controller.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | import os 25 | import warnings 26 | 27 | from .plugin import PluginManager 28 | 29 | from .asg import (HeaderProxy, 30 | TypedefProxy, 31 | EnumerationProxy, 32 | FunctionProxy, 33 | ConstructorProxy, 34 | ClassProxy, 35 | ClassTemplateSpecializationProxy, 36 | ClassTemplateProxy, 37 | VariableProxy, 38 | ClassTemplatePartialSpecializationProxy) 39 | 40 | controller = PluginManager('autowig.controller', brief="AutoWIG middle-end plugin_managers", 41 | details="""AutoWIG middle-end plugin_managers are responsible for Abstract Semantic Graph (ASG) modification from Python semantic queries. 42 | 43 | .. seealso:: :class:`autowig.AbstractSemanticGraph` for more details on ASGs""") 44 | 45 | def refactoring(asg): 46 | for function in asg.functions(free=True): 47 | if len(function.parameters) > 1: 48 | if function.localname == 'operator<<': 49 | parameters = [parameter.qualified_type.desugared_type for parameter in function.parameters] 50 | if len(parameters) == 2 and parameters[0].unqualified_type.globalname == 'class ::std::basic_ostream< char, struct ::std::char_traits< char > >' and parameters[1].is_class: 51 | function.parent = parameters[1].unqualified_type 52 | else: 53 | parameter = function.parameters[0].qualified_type.desugared_type 54 | if parameter.is_class: 55 | function.parent = parameter.unqualified_type 56 | elif function.localname.startswith('operator'): 57 | parameter = function.parameters[0].qualified_type.desugared_type 58 | if parameter.is_class: 59 | function.parent = parameter.unqualified_type 60 | return asg 61 | 62 | def cleaning(asg): 63 | """ 64 | """ 65 | temp = [] 66 | for node in asg.nodes(): 67 | if node.clean: 68 | node.clean = True 69 | else: 70 | temp.append(node._node) 71 | 72 | while len(temp) > 0: 73 | node = asg[temp.pop()] 74 | node.clean = False 75 | parent = node.parent 76 | if parent is not None: 77 | if parent.clean: 78 | temp.append(parent._node) 79 | else: 80 | parent.clean = False 81 | if hasattr(node, 'header'): 82 | header = node.header 83 | if header is not None: 84 | if header.clean: 85 | temp.append(header._node) 86 | else: 87 | header.clean = False 88 | if isinstance(node, HeaderProxy): 89 | include = node.include 90 | if include is not None: 91 | if include.clean: 92 | temp.append(include._node) 93 | else: 94 | include.clean = False 95 | elif isinstance(node, (TypedefProxy, VariableProxy)): 96 | target = node.qualified_type.unqualified_type 97 | if target.clean: 98 | temp.append(target._node) 99 | else: 100 | target.clean = False 101 | elif isinstance(node, EnumerationProxy): 102 | for enumerator in node.enumerators: 103 | if enumerator.clean: 104 | temp.append(enumerator._node) 105 | else: 106 | enumerator.clean = False 107 | elif isinstance(node, FunctionProxy): 108 | result_type = node.return_type.unqualified_type 109 | if result_type.clean: 110 | temp.append(result_type._node) 111 | else: 112 | result_type.clean = False 113 | for parameter in node.parameters: 114 | target = parameter.qualified_type.unqualified_type 115 | if target.clean: 116 | temp.append(target._node) 117 | else: 118 | target.clean = False 119 | elif isinstance(node, ConstructorProxy): 120 | for parameter in node.parameters: 121 | target = parameter.qualified_type.unqualified_type 122 | if target.clean: 123 | temp.append(target._node) 124 | else: 125 | target.clean = False 126 | elif isinstance(node, ClassProxy): 127 | for base in node.bases(): 128 | if base.clean: 129 | temp.append(base._node) 130 | else: 131 | base.clean = False 132 | for dcl in node.declarations(): 133 | if dcl.clean: 134 | temp.append(dcl._node) 135 | else: 136 | dcl.clean = False 137 | if isinstance(node, ClassTemplateSpecializationProxy): 138 | specialize = node.specialize 139 | if specialize.clean: 140 | temp.append(node.specialize._node) 141 | else: 142 | specialize.clean = False 143 | for template in node.templates: 144 | target = template.desugared_type.unqualified_type 145 | if target.clean: 146 | temp.append(target._node) 147 | else: 148 | target.clean = False 149 | elif isinstance(node, ClassTemplateProxy): 150 | pass 151 | nodes = sorted([node for node in asg.nodes() if node.clean], key=lambda node: -len(node.ancestors)) 152 | for node in nodes: 153 | try: 154 | if node.parent is not None: 155 | asg._syntax_edges[node.parent._node].remove(node._node) 156 | if isinstance(node, (ClassTemplateSpecializationProxy, ClassTemplatePartialSpecializationProxy)): 157 | asg._specialization_edges[node.specialize._node].remove(node._node) 158 | except Exception as e: 159 | warnings.warn("Cannot find the node '" + node._node + '"', UserWarning) 160 | 161 | nodes = set([node._node for node in nodes]) 162 | 163 | for node in nodes: 164 | asg._nodes.pop(node) 165 | asg._include_edges.pop(node, None) 166 | asg._syntax_edges.pop(node, None) 167 | asg._base_edges.pop(node, None) 168 | asg._type_edges.pop(node, None) 169 | asg._parameter_edges.pop(node, None) 170 | asg._specialization_edges.pop(node, None) 171 | 172 | for node in asg.nodes(): 173 | if isinstance(node, ClassProxy): 174 | asg._base_edges[node._node] = [base for base in asg._base_edges[node._node] if not base['base'] in nodes] 175 | 176 | return asg 177 | -------------------------------------------------------------------------------- /src/py/autowig/_documenter.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | from .plugin import PluginManager 25 | 26 | documenter = PluginManager('autowig.documenter', brief="", 27 | details="""""") 28 | -------------------------------------------------------------------------------- /src/py/autowig/_feedback.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | import os 25 | import parse 26 | from path import Path 27 | 28 | from .plugin import PluginManager 29 | 30 | feedback = PluginManager('autowig.feedback', brief="", 31 | details="""""") 32 | 33 | def parse_errors(err, directory, asg, **kwargs): 34 | if not isinstance(err, str): 35 | raise TypeError('\'err\' parameter') 36 | if not isinstance(directory, Path): 37 | directory = Path(directory) 38 | variant_dir = kwargs.pop('variant_dir', None) 39 | if variant_dir: 40 | variant_dir = directory/variant_dir 41 | else: 42 | variant_dir = directory 43 | src_dir = kwargs.pop('src_dir', None) 44 | if src_dir: 45 | src_dir = directory/src_dir 46 | else: 47 | src_dir = directory 48 | indent = kwargs.pop('indent', 0) 49 | src_dir = str(src_dir.abspath()) + os.sep 50 | variant_dir = str(variant_dir.relpath(directory)) 51 | if variant_dir == '.': 52 | variant_dir = '' 53 | else: 54 | variant_dir += os.sep 55 | wrappers = dict() 56 | for line in err.splitlines(): 57 | parsed = parse.parse(variant_dir+'{filename}:{row}:{column}:{message}', line) 58 | if parsed: 59 | try: 60 | row = int(parsed['row']) 61 | node = src_dir + parsed['filename'] 62 | if node in asg: 63 | if node not in wrappers: 64 | wrappers[node] = [row] 65 | else: 66 | wrappers[node].append(row) 67 | except: 68 | pass 69 | return wrappers -------------------------------------------------------------------------------- /src/py/autowig/_generator.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | from .plugin import PluginManager 25 | 26 | generator = PluginManager('autowig.generator', brief="AutoWIG back-end plugin_managers", 27 | details="""AutoWIG back-end plugin_managers are responsible for C/C++ code generation from an Abstract Semantic Graph (ASG) interpretation. 28 | 29 | .. seealso:: :class:`autowig.AbstractSemanticGraph` for more details on ASGs""") 30 | -------------------------------------------------------------------------------- /src/py/autowig/_node_path.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | """ 25 | """ 26 | 27 | from .asg import DeclarationProxy, EnumeratorProxy, TypedefProxy, VariableProxy 28 | 29 | __all__ = [] 30 | 31 | from .plugin import PluginManager 32 | 33 | node_path = PluginManager('autowig.node_path', brief="", 34 | details="") 35 | 36 | def hash_node_path( node, prefix='', suffix=''): 37 | if not isinstance(node, DeclarationProxy): 38 | raise TypeError('\'node\' parameter is not \'autowig.asg.CodeNodeProxy\' instance but a \'' + node.__class__.__name__ + '\' instance') 39 | if prefix and not prefix.endswith('_'): 40 | prefix = prefix + '_' 41 | if isinstance(node, (TypedefProxy, VariableProxy, EnumeratorProxy)): 42 | node = node.parent 43 | return prefix + node.hash + suffix 44 | -------------------------------------------------------------------------------- /src/py/autowig/_node_rename.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | from .plugin import PluginManager 25 | 26 | from .tools import camel_case_to_lower, to_camel_case, camel_case_to_upper 27 | from .asg import (FunctionProxy, 28 | VariableProxy, 29 | EnumerationProxy, 30 | EnumeratorProxy, 31 | ClassTemplateSpecializationProxy, 32 | ClassTemplateProxy, 33 | ClassProxy, 34 | NamespaceProxy, 35 | TypedefProxy) 36 | 37 | __all__ = [] 38 | 39 | node_rename = PluginManager('autowig.node_rename', brief="", 40 | details="") 41 | 42 | PYTHON_OPERATOR = dict() 43 | PYTHON_OPERATOR['+'] = '__add__' 44 | PYTHON_OPERATOR['++'] = '__next__' 45 | PYTHON_OPERATOR['-'] = '__sub__' 46 | PYTHON_OPERATOR['--'] = '__prev__' 47 | PYTHON_OPERATOR['*'] = '__mul__' 48 | PYTHON_OPERATOR['/'] = '__div__' 49 | PYTHON_OPERATOR['%'] = '__mod__' 50 | PYTHON_OPERATOR['=='] = '__eq__' 51 | PYTHON_OPERATOR['!='] = '__neq__' 52 | PYTHON_OPERATOR['>'] = '__gt__' 53 | PYTHON_OPERATOR['<'] = '__lt__' 54 | PYTHON_OPERATOR['>='] = '__ge__' 55 | PYTHON_OPERATOR['<='] = '__le__' 56 | PYTHON_OPERATOR['!'] = '__not__' 57 | PYTHON_OPERATOR['&&'] = '__and__' 58 | PYTHON_OPERATOR['||'] = '__or__' 59 | PYTHON_OPERATOR['~'] = '__invert__' 60 | PYTHON_OPERATOR['&'] = '__and__' 61 | PYTHON_OPERATOR['|'] = '__or__' 62 | PYTHON_OPERATOR['^'] = '__xor__' 63 | PYTHON_OPERATOR['<<'] = '__lshift__' 64 | PYTHON_OPERATOR['>>'] = '__rshift__' 65 | PYTHON_OPERATOR['+='] = '__iadd__' 66 | PYTHON_OPERATOR['-='] = '__isub__' 67 | PYTHON_OPERATOR['*='] = '__imul__' 68 | PYTHON_OPERATOR['%='] = '__idiv__' 69 | PYTHON_OPERATOR['&='] = '__iand__' 70 | PYTHON_OPERATOR['|='] = '__ior__' 71 | PYTHON_OPERATOR['^='] = '__ixor__' 72 | PYTHON_OPERATOR['<<='] = '__ilshift__' 73 | PYTHON_OPERATOR['>>='] = '__irshift__' 74 | PYTHON_OPERATOR['()'] = '__call__' 75 | PYTHON_OPERATOR['[]'] = '__getitem__' 76 | 77 | PYTHON_FUNCTION = dict() 78 | PYTHON_FUNCTION['generator'] = '__iter__' 79 | PYTHON_FUNCTION['size'] = '__len__' 80 | 81 | def pep8_node_rename(node, scope=False): 82 | if isinstance(node, FunctionProxy) and node.localname.startswith('operator'): 83 | return PYTHON_OPERATOR[node.localname.strip('operator').strip()] 84 | elif isinstance(node, FunctionProxy): 85 | if node.localname in PYTHON_FUNCTION: 86 | return PYTHON_FUNCTION[node.localname] 87 | else: 88 | return camel_case_to_lower(node.localname) 89 | elif isinstance(node, VariableProxy): 90 | return camel_case_to_lower(node.localname) 91 | elif isinstance(node, EnumerationProxy): 92 | return camel_case_to_lower(node.localname) 93 | elif isinstance(node, EnumeratorProxy): 94 | return camel_case_to_upper(node.localname) 95 | elif isinstance(node, ClassTemplateSpecializationProxy): 96 | if not scope: 97 | return '_' + to_camel_case(node.specialize.localname).strip('_') + '_' + node.hash 98 | else: 99 | return '__' + camel_case_to_lower(node.specialize.localname).strip('_') + '_' + node.hash 100 | elif isinstance(node, TypedefProxy): 101 | return to_camel_case(node.localname) 102 | elif isinstance(node, (ClassTemplateProxy, ClassProxy)): 103 | if scope: 104 | return '_' + camel_case_to_lower(node.localname).strip('_') 105 | elif isinstance(node, ClassProxy): 106 | return to_camel_case(node.localname) 107 | else: 108 | return '_' + to_camel_case(node.localname) 109 | elif isinstance(node, NamespaceProxy): 110 | return camel_case_to_lower(node.localname) 111 | else: 112 | return NotImplementedError(node.__class__) 113 | -------------------------------------------------------------------------------- /src/py/autowig/comment_feedback.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | from ._feedback import parse_errors 25 | 26 | def comment_feedback(err, directory, asg, **kwargs): 27 | wrappers = parse_errors(err, directory, asg, **kwargs) 28 | for wrapper, rows in wrappers.items(): 29 | with open(wrapper, 'r') as filehandler: 30 | content = filehandler.readlines() 31 | for row in rows: 32 | if row < len(content): 33 | content[row - 1] = '// TODO ' + content[row - 1] 34 | with open(wrapper, 'w') as filehandler: 35 | filehandler.writelines(content) 36 | return hash(frozenset(wrappers)) 37 | -------------------------------------------------------------------------------- /src/py/autowig/default_controller.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | from ._controller import refactoring, cleaning 25 | 26 | __all__ = [] 27 | 28 | def default_controller(asg, **kwargs): 29 | """Post-processing step of an AutoWIG front-end 30 | 31 | During this step, three distinct operations are executed: 32 | 33 | * The **overloading** operation. 34 | During this operation functions and methods of the Abstract Semantic Graph (ASG) are traversed in order to determine if they are overloaded or not. 35 | This operation has at worst a time-complexity in :math:`\mathcal{O}\left(F^2\right)` where :math:`F` denotes the number of functions and methods in the ASG. 36 | Therefore, its default behavior is altered and all functions and methods are considered as overloaded which induces a time-complexity of :math:`\mathcal{O}\left(N\right)` where :math:`N` denotes the number of nodes in the ASG. 37 | 38 | * The **discarding** operation. 39 | 40 | * The **templating** operation. 41 | 42 | :Parameter: 43 | `overload` (bool) - The boolean considered in order to determine if the behavior of the **overloading** operation is altered or not. 44 | 45 | :Return Type: 46 | `None` 47 | 48 | .. seealso:: 49 | :func:`autowig.libclang_parser.parser` for an example. 50 | :func:`compute_overloads`, :func:`discard_forward_declarations` and :func:`resolve_templates` for a more detailed documentatin about AutoWIG front-end post-processing step. 51 | """ 52 | if kwargs.pop('refactoring', True): 53 | asg = refactoring(asg) 54 | if kwargs.pop('clean', True): 55 | asg = cleaning(asg) 56 | return asg 57 | -------------------------------------------------------------------------------- /src/py/autowig/doxygen2sphinx.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | from mako.template import Template 25 | import pypandoc 26 | import re 27 | 28 | from .asg import (ClassTemplateSpecializationProxy, 29 | EnumeratorProxy, 30 | ClassProxy, 31 | FieldProxy, 32 | FundamentalTypeProxy, 33 | VariableProxy, 34 | MethodProxy, 35 | NamespaceProxy, 36 | TypedefProxy, 37 | EnumerationProxy, 38 | FunctionProxy, 39 | ConstructorProxy) 40 | 41 | from ._node_rename import node_rename 42 | 43 | FORMATTER = Template(text=r"""\ 44 | % if brief: 45 | ${brief} 46 | 47 | % endif 48 | % if details: 49 | ${details} 50 | 51 | % endif 52 | % if len(param) == 1: 53 | :Parameter: 54 | `${param[0][0]}` (${param[0][1]}) - ${('\n' + ' ' * (len(param[0][0]) + len(param[0][1]) + 12)).join(param[0][2].splitlines())} 55 | 56 | % elif len(param) > 1: 57 | :Parameters: 58 | % for nparam, tparam, dparam in param: 59 | - `${nparam}` (${tparam}) - ${('\n' + ' ' * (len(nparam) + len(tparam) + 12)).join(dparam.splitlines())} 60 | % endfor 61 | 62 | % endif 63 | % if returns: 64 | :Returns: 65 | ${'\n '.join(returns.splitlines())} 66 | 67 | % endif 68 | % if return_type: 69 | :Return Type: 70 | ${'\n '.join(return_type.splitlines())} 71 | 72 | % endif 73 | % if len(throws) == 1: 74 | :Raises: 75 | ${throws[0][0]} - ${('\n' + ' ' * (len(throws[0][0]) + 7)).join(throws[0][1].splitlines())} 76 | 77 | % elif len(throws) > 1: 78 | :Raises: 79 | % for tthrows, dthrows in throws: 80 | - ${tthrows} - ${('\n' + ' ' * (len(tthrows) + 7)).join(dthrows.splitlines())} 81 | % endfor 82 | 83 | % endif 84 | % for _note in note: 85 | .. note:: 86 | 87 | ${'\n '.join(_note.splitlines())} 88 | 89 | % endfor 90 | % for _warning in warning: 91 | .. warning:: 92 | 93 | ${'\n '.join(_warning.splitlines())} 94 | 95 | % endfor 96 | % for _see in see: 97 | .. seealso:: 98 | 99 | ${'\n '.join(_see.splitlines())} 100 | 101 | % endfor 102 | % for _todo in todo: 103 | .. todo:: 104 | 105 | ${'\n '.join(_todo.splitlines())} 106 | 107 | % endfor""") 108 | 109 | def doxygen2sphinx_documenter(node, mako=True): 110 | try: 111 | doc = sphinx_formatter(**doxygen_parser(node)) 112 | if mako: 113 | return doc.replace('\n', '\\n').replace('\\', '\\\\').replace('\\\\n', '\\n') 114 | else: 115 | return doc 116 | except: 117 | return "" 118 | 119 | def doxygen_parser(node): 120 | """ 121 | """ 122 | 123 | comment = node.comment 124 | fmtargs = dict(brief = None, 125 | details = None, 126 | see = [], 127 | note = [], 128 | warning = [], 129 | param = dict(), 130 | todo = [], 131 | returns = None, 132 | return_type = None, 133 | throws = []) 134 | 135 | lines = [] 136 | if (comment.startswith('/**') or comment.startswith('/*!')) and comment.endswith('*/'): 137 | comment = comment[3:-2].splitlines() 138 | comment[0].strip('*') 139 | if comment[0].isspace(): 140 | comment.pop(0) 141 | comment[-1].strip('*') 142 | if comment[-1].isspace(): 143 | comment.pop(-1) 144 | lines = [line.strip(' * ') for line in comment] 145 | elif comment.startswith('/// '): 146 | lines = [line.strip('/// ') for line in comment.splitlines()] 147 | elif comment.startswith('//! '): 148 | lines = [line.strip('//! ') for line in comment.splitlines()] 149 | else: 150 | raise ValueError('\'node\' parameter: attribute \'comment\' not formatted as expected') 151 | curr = 0 152 | asg = node._asg 153 | while curr < len(lines): 154 | if lines[curr].startswith(r'\brief'): 155 | if not fmtargs['brief']: 156 | prev, curr = desc_boundary(curr, lines) 157 | fmtargs['brief'] = extract_desc('brief', prev, curr, lines, asg) 158 | else: 159 | raise ValueError('\'comment\' parameter not formatted as expected') 160 | elif lines[curr].startswith(r'\details'): 161 | if not fmtargs['details']: 162 | prev, curr = desc_boundary(curr, lines) 163 | fmtargs['details'] = extract_desc('details', prev, curr, lines, asg) 164 | else: 165 | raise ValueError('\'comment\' parameter not formatted as expected') 166 | elif lines[curr].startswith(r'\warning'): 167 | prev, curr = desc_boundary(curr, lines) 168 | fmtargs['warning'].append(extract_desc('warning', prev, curr, lines, asg)) 169 | elif lines[curr].startswith(r'\see'): 170 | prev, curr = desc_boundary(curr, lines) 171 | fmtargs['see'].append(extract_desc('see', prev, curr, lines, asg)) 172 | elif lines[curr].startswith(r'\param'): 173 | prev, curr = desc_boundary(curr, lines) 174 | fmtargs['param'].__setitem__(*extract_named_desc('param', prev, curr, lines, asg)) 175 | elif lines[curr].startswith(r'\throws'): 176 | prev, curr = desc_boundary(curr, lines) 177 | fmtargs['throws'].append(extract_named_desc('throws', prev, curr, lines, asg)) 178 | elif lines[curr].startswith(r'\returns'): 179 | prev, curr = desc_boundary(curr, lines) 180 | fmtargs['returns'] = extract_desc('returns', prev, curr, lines, asg) 181 | elif lines[curr].startswith(r'\note'): 182 | prev, curr = desc_boundary(curr, lines) 183 | fmtargs['note'].append(extract_desc('note', prev, curr, lines, asg)) 184 | elif lines[curr].startswith(r'\todo'): 185 | prev, curr = desc_boundary(curr, lines) 186 | fmtargs['todo'].append(extract_desc('todo', prev, curr, lines, asg)) 187 | else: 188 | curr += 1 189 | fmtargs['throws'] = [(desc_converter(desc_parser(asg, r'\ref '+ cls)), desc) for cls, desc in fmtargs['throws']] 190 | if isinstance(node, FunctionProxy): 191 | fmtargs['return_type'] = desc_converter(desc_parser(asg, r'\ref ' + link_formatter(node.return_type.desugared_type.unqualified_type))) 192 | if isinstance(node, (ConstructorProxy, FunctionProxy)): 193 | fmtargs['param'] = [(parameter.localname, desc_converter(desc_parser(asg, r'\ref ' + link_formatter(parameter.qualified_type.desugared_type.unqualified_type))), fmtargs['param'].get(parameter.localname, 'Undocumented')) for parameter in node.parameters] 194 | return fmtargs 195 | 196 | def sphinx_formatter(**kwargs): 197 | return FORMATTER.render_unicode(**kwargs) 198 | 199 | def desc_parser(asg, text): 200 | text = text.replace(r'\f$', '$').replace(r'\f[', '$$').replace(r'\f]', '$$') 201 | desc = '' 202 | curr = 0 203 | while curr < len(text): 204 | if text[curr:curr+3] == r'\f{': 205 | curr += 3 206 | prev = curr 207 | while not text[curr] == '}': 208 | curr += 1 209 | env = text[prev:curr] 210 | curr += 1 211 | if text[curr] == '{': 212 | curr += 1 213 | prev = curr 214 | while curr < len(text) and not text[curr:curr+3] == r'\f}': 215 | curr += 1 216 | if text[curr:curr+3] == r'\f}': 217 | desc += r'\begin{' + env + '}' + text[prev:curr] + r'\end{' + env + '}' 218 | curr += 4 219 | elif text[curr:curr+9] == r'\parblock': 220 | curr += 9 221 | elif text[curr:curr+12] == r'\endparblock': 222 | curr += 12 223 | elif text[curr:curr+5] == r'\cite': 224 | curr += 5 225 | prev = curr 226 | while curr < len(text) and text[curr].isspace(): 227 | curr += 1 228 | prev = curr 229 | while curr < len(text) and not text[curr].isspace(): 230 | curr += 1 231 | while curr > prev and text[curr] in [')', '.', ']']: 232 | curr -= 1 233 | desc += '~~:cite:`' + text[prev:curr] + '`~~' 234 | elif text[curr:curr+4] == r'\ref': 235 | curr += 4 236 | prev = curr 237 | while curr < len(text) and text[curr].isspace(): 238 | curr += 1 239 | prev = curr 240 | while curr < len(text) and not text[curr].isspace(): 241 | curr += 1 242 | while curr > prev and text[curr-1] in [')', '.', ']']: 243 | curr -= 1 244 | node = text[prev:curr] 245 | if node in asg: 246 | node = asg[node] 247 | elif 'class ' + node in asg: 248 | node = asg['class ' + node] 249 | elif 'struct ' + node in asg: 250 | node = asg['struct ' + node] 251 | elif 'union ' + node in asg: 252 | node = asg['union ' + node] 253 | elif 'enum ' + node in asg: 254 | node = asg['enum ' + node] 255 | else: 256 | nodes = asg.nodes(node + '::[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}') 257 | if len(nodes) > 0: 258 | if any(node.boost_python_export and node.boost_python_export is not True for node in nodes): 259 | node = [node for node in nodes if node.boost_python_export and node.boost_python_export is not True] 260 | node = nodes.pop() 261 | else: 262 | node = ':cpp:any:`' + node + '`' 263 | if not isinstance(node, str): 264 | node = name_formatter(node) 265 | desc += '~~' + node + '~~' 266 | else: 267 | desc += text[curr] 268 | curr += 1 269 | return desc 270 | 271 | def desc_boundary(curr, lines): 272 | prev = curr 273 | curr += 1 274 | while curr < len(lines) and (not lines[curr].startswith('\\') or lines[curr].startswith('\\f') or lines[curr].startswith('\\ref')): 275 | curr += 1 276 | return prev, curr 277 | 278 | def extract_desc(cmd, prev, curr, lines, asg): 279 | lines = lines[prev:curr] 280 | if len(lines) > 0: 281 | lines[0] = ' ' * (len(cmd) + 1) + lines[0][len(cmd)+1:] 282 | if len(lines) > 1: 283 | trim = float("inf") 284 | for line in lines: 285 | if line: 286 | trim = min(trim, trimming(line)) 287 | if trim > 0: 288 | return desc_converter(desc_parser(asg, '\n'.join(line[trim:] for line in lines)).strip()) 289 | else: 290 | return desc_converter(desc_parser(asg, '\n'.join(lines)).strip()) 291 | else: 292 | return desc_converter(desc_parser(asg, lines[0]).strip()) 293 | 294 | def extract_named_desc(cmd, prev, curr, lines, asg): 295 | lines = lines[prev:curr] 296 | if len(lines) > 0: 297 | ncmd = str(cmd) 298 | while lines[0][len(ncmd)+1].isspace(): 299 | ncmd += ' ' 300 | while not lines[0][len(ncmd)+1].isspace(): 301 | ncmd += lines[0][len(ncmd)+1] 302 | return ncmd.lstrip(cmd).strip(), extract_desc(ncmd, 0, curr-prev, lines, asg) 303 | else: 304 | return None, None 305 | 306 | def trimming(line): 307 | index = 0 308 | while index < len(line) and line[index].isspace(): 309 | index += 1 310 | return index 311 | 312 | def link_formatter(node): 313 | globalname = node.globalname 314 | if globalname.startswith('class '): 315 | return globalname[len('class '):] 316 | elif globalname.startswith('struct '): 317 | return globalname[len('struct '):] 318 | elif globalname.startswith('union '): 319 | return globalname[len('union '):] 320 | elif globalname.startswith('enum '): 321 | return globalname[len('enum '):] 322 | else: 323 | return globalname 324 | 325 | def name_formatter(node): 326 | if isinstance(node, ClassTemplateSpecializationProxy): 327 | while node.is_smart_pointer: 328 | node = node.templates[0].desugared_type.unqualified_type 329 | elif isinstance(node, TypedefProxy): 330 | node = node.qualified_type.desugared_type.unqualified_type 331 | if node.boost_python_export and node.boost_python_export is not True: 332 | decorator = node.boost_python_export.module.decorator 333 | parent = node.parent 334 | name = '`' + decorator.package + '.' + '.'.join(node_rename(ancestor, scope=True) for ancestor in parent.ancestors[1:]) 335 | if parent.globalname == '::': 336 | name += node_rename(node) + '`' 337 | elif parent.parent.globalname == '::': 338 | name += node_rename(parent) + '.' + node_rename(node) + '`' 339 | else: 340 | name += '.' + node_rename(parent) + '.' + node_rename(node) + '`' 341 | if isinstance(node, NamespaceProxy): 342 | name = ':py:mod:' + name 343 | elif isinstance(node, MethodProxy): 344 | name = ':py:meth:' + name 345 | elif isinstance(node, FunctionProxy): 346 | name = ':py:func:' + name 347 | elif isinstance(node, FieldProxy): 348 | name = ':py:attr:' + name 349 | elif isinstance(node, VariableProxy): 350 | name = ':py:data:' + name 351 | elif isinstance(node, EnumeratorProxy): 352 | name = ':py:const:' + name 353 | elif isinstance(node, ClassProxy): 354 | if node.is_error: 355 | name = ':py:exc:' + name 356 | else: 357 | name = ':py:class:' + name 358 | else: 359 | name = ':py:obj:' + name 360 | elif not isinstance(node, FundamentalTypeProxy): 361 | name = '`' + link_formatter(node) + '`' 362 | if isinstance(node, FunctionProxy): 363 | name = ':cpp:func:' + name 364 | elif isinstance(node, VariableProxy): 365 | name = ':cpp:var:' + name 366 | elif isinstance(node, EnumeratorProxy): 367 | name = ':cpp:enumerator:' + name 368 | elif isinstance(node, EnumerationProxy): 369 | name = ':cpp:enumerator:' + name 370 | elif isinstance(node, ClassProxy): 371 | name = ':cpp:class:' + name 372 | else: 373 | name = ':cpp:any:' + name 374 | else: 375 | name = ':cpp:any:' + node.localname 376 | return name 377 | 378 | def desc_converter(desc): 379 | desc = pypandoc.convert(desc, to='rst', format='markdown') 380 | return re.sub(r'\[STRIKEOUT:(\:.*)\:``(.*)``\]', r'\1:`\2`', desc).rstrip().replace(r'"', "'") 381 | 382 | -------------------------------------------------------------------------------- /src/py/autowig/edit_feedback.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | from ._feedback import parse_errors 25 | 26 | def edit_feedback(err, directory, asg, **kwargs): 27 | wrappers = parse_errors(err, directory, asg, **kwargs) 28 | code = [] 29 | for wrapper, rows in wrappers.items(): 30 | wrapper = asg[wrapper] 31 | for row in rows: 32 | code.extend(wrapper.edit(row).splitlines()) 33 | indent = kwargs.pop('indent', 0) 34 | code = "\t" * indent + ("\n" + "\t" * indent).join(code for code in code if code) 35 | if not code.isspace(): 36 | code += '\n' 37 | return code.strip() 38 | -------------------------------------------------------------------------------- /src/py/autowig/plugin.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | import pkg_resources 25 | 26 | class ProxyManager(object): 27 | 28 | def __call__ (self): 29 | proxy = self.proxy 30 | if proxy: 31 | return self[proxy] 32 | else: 33 | raise NotImplementedError("A proxy must be selected using \'proxy\' field") 34 | 35 | def __init__(self, group, brief="", details=""): 36 | """Create a proxy manager""" 37 | self._group = group 38 | self._brief = brief 39 | self._details = details 40 | self._cache = dict() 41 | 42 | def __iter__(self): 43 | def listing(): 44 | for key in list(self._cache.keys()): 45 | yield key 46 | for proxy in pkg_resources.iter_entry_points(self._group): 47 | yield proxy.name 48 | return sorted(listing()).__iter__() 49 | 50 | def __contains__(self, proxy): 51 | """ 52 | """ 53 | return proxy in self._cache or len(list(pkg_resources.iter_entry_points(self._group, proxy))) > 0 54 | 55 | def __getitem__(self, proxy): 56 | """ 57 | """ 58 | while proxy in self._cache: 59 | proxy = self._cache[proxy] 60 | if callable(proxy): 61 | return proxy 62 | else: 63 | return list(pkg_resources.iter_entry_points(self._group, proxy)).pop().load() 64 | 65 | def __setitem__(self, proxy, implementation): 66 | if not isinstance(proxy, str): 67 | raise TypeError('\'proxy\' parameter must be a basestring instance') 68 | if callable(implementation): 69 | self._cache[proxy] = implementation 70 | elif isinstance(implementation, str): 71 | if implementation not in self: 72 | raise ValueError('\'implementation\' parameter must be one of ' + ', '.join('\'' + proxy + '\'' for proxy in self)) 73 | if proxy == implementation: 74 | raise ValueError('\'proxy\' and \'implementation\' parameters cannot have the same value') 75 | self._cache[proxy] = implementation 76 | else: 77 | raise TypeError('must be callable or a basestring instance') 78 | 79 | @property 80 | def __doc__(self): 81 | doc = [] 82 | if self._brief: 83 | doc.append(self._brief) 84 | doc.append('') 85 | if self._details: 86 | doc.append(self._details) 87 | doc.append('') 88 | doc.append(":Available Implementations:") 89 | doc.extend(" - '" + proxy + "'" for proxy in self) 90 | return '\n'.join(doc) 91 | 92 | @property 93 | def proxy(self): 94 | return getattr(self, '_proxy', None) 95 | 96 | @proxy.setter 97 | def proxy(self, proxy): 98 | if proxy not in self: 99 | raise ValueError('\'proxy\' parameter should be one of ' + ', '.join('\'' + proxy + '\'' for proxy in self)) 100 | else: 101 | self._proxy = proxy 102 | 103 | @proxy.deleter 104 | def proxy(self): 105 | self._proxy = None 106 | 107 | class PluginManagerDescriptor(object): 108 | """A plugin plugin manager descriptor that returns and sets plugin_manager implementations 109 | """ 110 | 111 | def __get__(self, obj, objtype): 112 | plugin = obj.plugin 113 | if plugin: 114 | return obj[plugin] 115 | else: 116 | def __call__(): 117 | """No plugin selected""" 118 | raise NotImplementedError("A plugin must be selected using \'plugin\' field") 119 | return __call__ 120 | 121 | 122 | class PluginManager(object): 123 | 124 | __call__ = PluginManagerDescriptor() 125 | 126 | def __init__(self, group, brief="", details=""): 127 | """Create a plugin manager""" 128 | self._group = group 129 | self._brief = brief 130 | self._details = details 131 | self._cache = dict() 132 | 133 | def __iter__(self): 134 | def listing(): 135 | for key in list(self._cache.keys()): 136 | yield key 137 | for plugin in pkg_resources.iter_entry_points(self._group): 138 | yield plugin.name 139 | return sorted(listing()).__iter__() 140 | 141 | def __contains__(self, plugin): 142 | """ 143 | """ 144 | return plugin in self._cache or len(list(pkg_resources.iter_entry_points(self._group, plugin))) > 0 145 | 146 | def __getitem__(self, plugin): 147 | """ 148 | """ 149 | while plugin in self._cache: 150 | plugin = self._cache[plugin] 151 | if callable(plugin): 152 | return plugin 153 | else: 154 | return list(pkg_resources.iter_entry_points(self._group, plugin)).pop().load() 155 | 156 | def __setitem__(self, plugin, implementation): 157 | if not isinstance(plugin, str): 158 | raise TypeError('\'plugin\' parameter must be a basestring instance') 159 | if callable(implementation): 160 | self._cache[plugin] = implementation 161 | elif isinstance(implementation, str): 162 | if implementation not in self: 163 | raise ValueError('\'implementation\' parameter must be one of ' + ', '.join('\'' + plugin + '\'' for plugin in self)) 164 | if plugin == implementation: 165 | raise ValueError('\'plugin\' and \'implementation\' parameters cannot have the same value') 166 | self._cache[plugin] = implementation 167 | else: 168 | raise TypeError('must be callable or a basestring instance') 169 | 170 | @property 171 | def __doc__(self): 172 | doc = [] 173 | if self._brief: 174 | doc.append(self._brief) 175 | doc.append('') 176 | if self._details: 177 | doc.append(self._details) 178 | doc.append('') 179 | doc.append(":Available Implementations:") 180 | doc.extend(" - '" + plugin + "'" for plugin in self) 181 | return '\n'.join(doc) 182 | 183 | @property 184 | def plugin(self): 185 | return getattr(self, '_plugin', None) 186 | 187 | @plugin.setter 188 | def plugin(self, plugin): 189 | if plugin not in self: 190 | raise ValueError('\'plugin\' parameter should be one of ' + ', '.join('\'' + plugin + '\'' for plugin in self)) 191 | else: 192 | self._plugin = plugin 193 | 194 | @plugin.deleter 195 | def plugin(self): 196 | self._plugin = None 197 | -------------------------------------------------------------------------------- /src/py/autowig/tools.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | __all__ = ['camel_case_to_lower', 'to_camel_case', 'camel_case_to_upper'] 25 | 26 | def subclasses(cls, recursive=True): 27 | if recursive: 28 | subclasses = [] 29 | front = [cls] 30 | while len(front) > 0: 31 | cls = front.pop() 32 | front.extend(cls.__subclasses__()) 33 | subclasses.append(cls) 34 | return list({subclass.__name__ : subclass for subclass in subclasses}.values()) 35 | else: 36 | return cls.__subclasses__() 37 | 38 | def camel_case_to_lower(name): 39 | """ 40 | :Examples: 41 | >>> camel_case_to_lower('squareRoot') 42 | 'square_root' 43 | >>> camel_case_to_lower('SquareRoot') 44 | 'square_root' 45 | >>> camel_case_to_lower('ComputeSQRT') 46 | 'compute_sqrt' 47 | >>> camel_case_to_lower('SQRTCompute') 48 | 'sqrt_compute' 49 | """ 50 | lowername = '_' 51 | index = 0 52 | while index < len(name): 53 | if name[index].islower(): 54 | lowername += name[index] 55 | index += 1 56 | else: 57 | if not name[index] == '_': 58 | if not lowername[-1] == '_': 59 | lowername += '_' 60 | lowername += name[index].lower() 61 | index += 1 62 | if index < len(name) and not name[index].islower(): 63 | while index < len(name) and not name[index].islower(): 64 | lowername += name[index].lower() 65 | index += 1 66 | if index < len(name): 67 | lowername = lowername[:-1] + '_' + lowername[-1] 68 | else: 69 | if not lowername[-1] == '_': 70 | lowername += '_' 71 | index += 1 72 | lowername = lowername.lstrip('_') 73 | return lowername 74 | 75 | def camel_case_to_upper(name): 76 | """ 77 | :Examples: 78 | >>> camel_case_to_upper('squareRoot') 79 | 'SQUARE_ROOT' 80 | >>> camel_case_to_upper('SquareRoot') 81 | 'SQUARE_ROOT' 82 | >>> camel_case_to_upper('ComputeSQRT') 83 | 'COMPUTE_SQRT' 84 | >>> camel_case_to_upper('SQRTCompute') 85 | 'SQRT_COMPUTE' 86 | >>> camel_case_to_upper('Char_U') 87 | """ 88 | lowername = '_' 89 | index = 0 90 | while index < len(name): 91 | if name[index].islower(): 92 | lowername += name[index].upper() 93 | index += 1 94 | else: 95 | if not name[index] == '_': 96 | if not lowername[-1] == '_': 97 | lowername += '_' 98 | lowername += name[index].upper() 99 | index += 1 100 | if index < len(name) and not name[index].islower(): 101 | while index < len(name) and not name[index].islower(): 102 | lowername += name[index] 103 | index += 1 104 | if index < len(name): 105 | lowername = lowername[:-1] + '_' + lowername[-1] 106 | else: 107 | if not lowername[-1] == '_': 108 | lowername += '_' 109 | index += 1 110 | lowername = lowername.lstrip('_') 111 | return lowername 112 | 113 | def to_camel_case(name): 114 | """ 115 | :Examples: 116 | >>> lower_to_camel_case(camel_case_to_lower('squareRoot')) 117 | 'SquareRoot' 118 | >>> lower_to_camel_case(camel_case_to_lower('SquareRoot')) 119 | 'SquareRoot' 120 | >>> lower_to_camel_case(camel_case_to_lower('ComputeSQRT')) 121 | 'ComputeSqrt' 122 | >>> lower_to_camel_case(camel_case_to_lower('SQRTCompute')) 123 | 'SqrtCompute' 124 | """ 125 | camelname = '' 126 | index = 0 127 | while index < len(name): 128 | if name[index] == '_': 129 | index += 1 130 | while index < len(name) and name[index] == '_': 131 | index += 1 132 | if index < len(name): 133 | camelname += name[index].upper() 134 | else: 135 | camelname += name[index] 136 | index += 1 137 | if camelname[0].islower(): 138 | camelname = camelname[0].upper() + camelname[1:] 139 | return camelname 140 | -------------------------------------------------------------------------------- /test/test_basic.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | import autowig 25 | 26 | import unittest 27 | from nose.plugins.attrib import attr 28 | 29 | import os 30 | import sys 31 | from path import Path 32 | from git import Repo 33 | import subprocess 34 | import shutil 35 | import platform 36 | import six 37 | 38 | @attr(win=False, 39 | linux=True, 40 | osx=True, 41 | level=1) 42 | class TestBasic(unittest.TestCase): 43 | """Test the wrapping of a basic library""" 44 | 45 | @classmethod 46 | def setUpClass(cls): 47 | if 'libclang' in autowig.parser: 48 | autowig.parser.plugin = 'libclang' 49 | autowig.generator.plugin = 'boost_python_internal' 50 | cls.srcdir = Path('fp17') 51 | cls.prefix = Path(Path(sys.prefix).abspath()) 52 | if any(platform.win32_ver()): 53 | cls.prefix = cls.prefix/'Library' 54 | if not cls.srcdir.exists(): 55 | Repo.clone_from('https://github.com/StatisKit/FP17.git', cls.srcdir.relpath('.'), recursive=True) 56 | if any(platform.win32_ver()): 57 | cls.scons = subprocess.check_output(['where', 'scons.bat']).strip() 58 | else: 59 | cls.scons = subprocess.check_output(['which', 'scons']).strip() 60 | if six.PY3: 61 | cls.scons = cls.scons.decode("ascii", "ignore") 62 | subprocess.check_output([cls.scons, 'cpp', '--prefix=' + str(cls.prefix)], 63 | cwd=cls.srcdir) 64 | cls.incdir = cls.prefix/'include'/'basic' 65 | 66 | def test_mapping_export(self): 67 | """Test `mapping` export""" 68 | 69 | if autowig.generator.plugin == 'pybind11_internal': 70 | os.environ['PYBIND11'] = "true" 71 | 72 | subprocess.check_call([self.scons, 'cpp', '-c', '--prefix=' + self.prefix], 73 | cwd=self.srcdir) 74 | 75 | subprocess.check_call([self.scons, 'cpp', '--prefix=' + self.prefix], 76 | cwd=self.srcdir) 77 | 78 | asg = autowig.AbstractSemanticGraph() 79 | 80 | if autowig.parser.plugin == 'libclang': 81 | kwargs = dict(silent = True) 82 | else: 83 | kwargs = dict() 84 | 85 | asg = autowig.parser(asg, self.incdir.files('*.h'), 86 | flags = ['-x', 'c++', '-std=c++11', '-I' + str(self.incdir.parent)], 87 | **kwargs) 88 | 89 | autowig.controller.plugin = 'default' 90 | autowig.controller(asg) 91 | 92 | 93 | wrappers = autowig.generator(asg, module = self.srcdir/'src'/'py'/'__basic.cpp', 94 | decorator = self.srcdir/'src'/'py'/'basic'/'_basic.py', 95 | prefix = 'wrapper_') 96 | wrappers.write() 97 | 98 | subprocess.check_call([self.scons, 'py', '-c', '--prefix=' + self.prefix], 99 | cwd=self.srcdir) 100 | subprocess.check_call([self.scons, 'py', '--prefix=' + self.prefix, '--package=basic'], 101 | cwd=self.srcdir) 102 | 103 | if autowig.generator.plugin == 'pybind11_internal': 104 | subprocess.check_call(['nosetests', 'test', '--pdb', '-v'], 105 | cwd=self.srcdir) 106 | 107 | for filepath in (self.srcdir/'src'/'py').walkfiles(): 108 | if filepath.exists() and filepath.ext in ['.cpp', '.h']: 109 | filepath.remove() 110 | 111 | @attr(win=False) 112 | def test_pyclanglite_parser(self): 113 | """Test `pyclanglite` parser""" 114 | plugin = autowig.parser.plugin 115 | autowig.parser.plugin = 'clanglite' 116 | self.test_mapping_export() 117 | autowig.parser.plugin = plugin 118 | 119 | @attr(level=2) 120 | def test_pybin11_generator(self): 121 | """Test `pyclanglite` parser""" 122 | plugin = autowig.generator.plugin 123 | autowig.generator.plugin = 'pybind11_internal' 124 | self.test_mapping_export() 125 | autowig.generator.plugin = plugin -------------------------------------------------------------------------------- /test/test_feedback.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | import autowig 25 | import six 26 | 27 | import unittest 28 | from nose.plugins.attrib import attr 29 | 30 | import subprocess 31 | from path import Path 32 | 33 | @attr(linux=True, 34 | osx=False, 35 | win=False, 36 | level=1) 37 | class TestFeedback(unittest.TestCase): 38 | """Test the feedback of a SCons results""" 39 | 40 | @classmethod 41 | def setUpClass(cls): 42 | with open('test.h', 'w') as filehandler: 43 | filehandler.write(""" 44 | #include 45 | 46 | namespace test 47 | { 48 | template 49 | class Pair 50 | { 51 | public: 52 | Pair(const std::string& first, const std::string& second) 53 | { 54 | this->first = first; 55 | this->second = second; 56 | }; 57 | 58 | void swap(const Pair< T, U >& pair) 59 | { this->first = pair.first; this->second = pair.second; } 60 | 61 | protected: 62 | T first; 63 | U second; 64 | }; 65 | 66 | typedef Pair< const double, double > Point; 67 | 68 | enum { 69 | RED, 70 | GREEN, 71 | BLUE 72 | }; 73 | 74 | int color; 75 | }""") 76 | 77 | with open('SConstruct', 'w') as filehandler: 78 | filehandler.write(""" 79 | from distutils import sysconfig 80 | import sys 81 | 82 | variables = Variables() 83 | 84 | env = Environment() 85 | variables.Update(env) 86 | 87 | env.AppendUnique(LIBS = ['boost_python', 'python' + sysconfig.get_python_version()]) 88 | env.AppendUnique(CPPPATH = [sysconfig.get_python_inc()]) 89 | env.AppendUnique(CPPDEFINES = ['BOOST_PYTHON_DYNAMIC_LIB']) 90 | 91 | env.Prepend(CPPPATH=sys.prefix + '/include') 92 | env.Prepend(CPPPATH='.') 93 | env.Prepend(LIBPATH=sys.prefix + '/lib') 94 | 95 | env.AppendUnique(CXXFLAGS = ['-x', 'c++', 96 | '-std=c++0x', 97 | '-Wwrite-strings']) 98 | 99 | pyenv = env.Clone() 100 | #pyenv.AppendUnique(LIBS = ['basic']) 101 | pyenv.AppendUnique(CXXFLAGS = ['-ftemplate-depth-100']) 102 | 103 | wrap = pyenv.LoadableModule('_module', pyenv.Glob('wrapper_*.cpp') + ['_module.cpp'], 104 | LDMODULESUFFIX = '.so', 105 | FRAMEWORKSFLAGS = '-flat_namespace -undefined suppress') 106 | Alias("py", wrap) 107 | Alias("build", wrap) 108 | 109 | Default("build") 110 | """) 111 | autowig.parser.plugin = 'clanglite' 112 | autowig.generator.plugin = 'boost_python_internal' 113 | autowig.feedback.plugin = 'edit' 114 | cls.srcdir = Path('.').abspath() 115 | 116 | def test_with_none_overload_export(self, overload="none"): 117 | """Test `feedback` with 'none' overload""" 118 | 119 | asg = autowig.AbstractSemanticGraph() 120 | 121 | asg = autowig.parser(asg, [self.srcdir/'test.h'], 122 | ['-x', 'c++', '-std=c++11', '-I' + str(self.srcdir)], 123 | silent = True) 124 | 125 | autowig.controller.plugin = 'default' 126 | autowig.controller(asg, overload=overload) 127 | 128 | module = autowig.generator(asg, module = self.srcdir/'_module.cpp', 129 | decorator = self.srcdir/'_module.py', 130 | prefix = 'wrapper_') 131 | 132 | from autowig._controller import cleaning 133 | cleaning(asg) 134 | 135 | module.write() 136 | 137 | 138 | s = subprocess.Popen(['scons', 'py'], 139 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) 140 | prev, curr = s.communicate() 141 | 142 | while curr and not prev == curr: 143 | prev = curr 144 | if six.PY3: 145 | curr = curr.decode('ascii', 'ignore') 146 | code = autowig.feedback(curr, '.', asg) 147 | if code: 148 | exec(code, locals()) 149 | s = subprocess.Popen(['scons', 'py'], 150 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) 151 | _, curr = s.communicate() 152 | 153 | for filepath in self.srcdir.walkfiles(): 154 | if filepath.exists() and filepath.basename().startswith('wrapper_') or filepath.startswith('_module'): 155 | filepath.remove() 156 | 157 | @attr(level=2) 158 | def test_with_all_overload_export(self): 159 | """Test `feedback` with 'all' overload""" 160 | self.test_with_none_overload_export(overload="all") 161 | 162 | @attr(level=2) 163 | def test_with_class_overload_export(self): 164 | """Test `feedback` with 'class' overload""" 165 | self.test_with_none_overload_export(overload="class") 166 | 167 | @attr(level=2) 168 | def test_with_namespace_overload_export(self): 169 | """Test `feedback` with 'namespace' overload""" 170 | self.test_with_none_overload_export(overload="namespace") 171 | -------------------------------------------------------------------------------- /test/test_subset.py: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | import autowig 25 | 26 | import unittest 27 | from nose.plugins.attrib import attr 28 | 29 | import os 30 | from path import Path 31 | from git import Repo 32 | import subprocess 33 | import sys 34 | import platform 35 | 36 | import autowig 37 | 38 | @attr(linux=True, 39 | osx=True, 40 | win=False, 41 | level=2) 42 | class TestSubset(unittest.TestCase): 43 | """Test the wrapping of a library subset""" 44 | 45 | @classmethod 46 | def setUpClass(cls): 47 | if 'libclang' in autowig.parser: 48 | autowig.parser.plugin = 'libclang' 49 | cls.srcdir = Path('fp17') 50 | if not cls.srcdir.exists(): 51 | Repo.clone_from('https://github.com/StatisKit/FP17.git', cls.srcdir.relpath('.'), recursive=True) 52 | cls.srcdir = cls.srcdir/'share'/'git'/'ClangLite' 53 | cls.incdir = Path(sys.prefix).abspath() 54 | if any(platform.win32_ver()): 55 | cls.incdir = cls.incdir/'Library' 56 | subprocess.check_output(['scons', 'cpp', '--prefix=' + str(cls.incdir)], 57 | cwd=cls.srcdir) 58 | if any(platform.win32_ver()): 59 | cls.scons = subprocess.check_output(['where', 'scons.bat']).strip() 60 | else: 61 | cls.scons = subprocess.check_output(['which', 'scons']).strip() 62 | cls.incdir = cls.incdir/'include'/'clanglite' 63 | 64 | def test_libclang_parser(self): 65 | """Test `libclang` parser""" 66 | 67 | headers = [self.incdir/'tool.h'] 68 | 69 | asg = autowig.AbstractSemanticGraph() 70 | asg = autowig.parser(asg, headers, 71 | flags = ['-x', 'c++', '-std=c++11', 72 | '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', 73 | '-I' + str(self.incdir.parent), 74 | '-I' + str(self.incdir.parent.abspath()/'python2.7')], 75 | bootstrap = False, 76 | silent = True) 77 | 78 | def clanglite_controller(asg): 79 | for node in asg['::boost::python'].classes(nested = True): 80 | node.is_copyable = True 81 | 82 | for node in asg.classes(): 83 | node.boost_python_export = False 84 | for node in asg.functions(free=True): 85 | node.boost_python_export = False 86 | for node in asg.variables(free = True): 87 | node.boost_python_export = False 88 | for node in asg.enumerations(): 89 | node.boost_python_export = False 90 | for node in asg.enumerators(): 91 | if node.parent.boost_python_export: 92 | node.boost_python_export = False 93 | for node in asg.typedefs(): 94 | node.boost_python_export = False 95 | 96 | from autowig.default_controller import refactoring 97 | asg = refactoring(asg) 98 | 99 | if autowig.parser.plugin == 'libclang': 100 | for fct in asg.functions(free=False): 101 | asg._nodes[fct._node]['_is_virtual'] = False 102 | asg._nodes[fct._node]['_is_pure'] = False 103 | asg['class ::clang::QualType'].is_abstract = False 104 | asg['class ::clang::QualType'].is_copyable = True 105 | asg['class ::llvm::StringRef'].is_abstract = False 106 | asg['class ::llvm::StringRef'].is_copyable = True 107 | asg['class ::clang::FileID'].is_abstract = False 108 | asg['class ::clang::FileID'].is_copyable = True 109 | asg['class ::clang::SourceLocation'].is_abstract = False 110 | asg['class ::clang::SourceLocation'].is_copyable = True 111 | asg['class ::clang::TemplateArgument'].is_abstract = False 112 | asg['class ::clang::TemplateArgument'].is_copyable = True 113 | for cls in ['::clang::FriendDecl', '::clang::CapturedDecl', '::clang::OMPThreadPrivateDecl', 114 | '::clang::NonTypeTemplateParmDecl', '::clang::TemplateArgumentList', '::clang::ImportDecl', 115 | '::clang::TemplateTemplateParmDecl', '::clang::CapturedDecl', '::clang::OMPThreadPrivateDecl', 116 | '::clang::NonTypeTemplateParmDecl', '::clang::TemplateArgumentList', '::clang::ImportDecl', 117 | '::clang::TemplateTemplateParmDecl']: 118 | asg['class ' + cls].is_abstract = False 119 | 120 | asg['class ::boost::python::api::object'].boost_python_export = True 121 | asg['class ::boost::python::list'].boost_python_export = True 122 | asg['class ::boost::python::str'].boost_python_export = True 123 | 124 | subset = [] 125 | classes = [asg['class ::clang::QualType'], 126 | asg['class ::clang::Type'], 127 | asg['class ::clang::Decl']] 128 | subset += classes 129 | for cls in classes: 130 | subset += cls.subclasses(recursive=True) 131 | for cls in subset: 132 | if not cls.globalname.strip('class ') in ['::clang::QualType', 133 | '::llvm::StringRef', 134 | '::clang::FileID', 135 | '::clang::SourceLocation', 136 | '::clang::TemplateArgument', 137 | '::clang::FriendDecl', 138 | '::clang::CapturedDecl', 139 | '::clang::OMPThreadPrivateDecl', 140 | '::clang::NonTypeTemplateParmDecl', 141 | '::clang::TemplateArgumentList', 142 | '::clang::ImportDecl', 143 | '::clang::TemplateTemplateParmDecl']: 144 | cls.is_copyable = False 145 | else: 146 | cls.is_copyable = True 147 | subset.append(asg['class ::llvm::StringRef']) 148 | 149 | subset.append(asg['class ::clang::Sema']) 150 | subset.append(asg['class ::clang::ASTUnit']) 151 | subset.append(asg['class ::clang::ASTContext']) 152 | subset.append(asg['class ::clang::SourceManager']) 153 | subset.append(asg['class ::clang::FileID']) 154 | 155 | subset.append(asg['class ::clang::SourceLocation']) 156 | 157 | subset.append(asg['class ::clang::CXXBaseSpecifier']) 158 | subset.append(asg['class ::clang::DeclContext']) 159 | subset.append(asg['class ::clang::TemplateArgument']) 160 | 161 | subset.append(asg['class ::clang::TemplateArgumentList']) 162 | subset.append(asg['enum ::clang::Type::TypeClass']) 163 | subset.append(asg['enum ::clang::AccessSpecifier']) 164 | subset.append(asg['enum ::clang::LinkageSpecDecl::LanguageIDs']) 165 | subset.append(asg['enum ::clang::BuiltinType::Kind']) 166 | subset.append(asg['enum ::clang::TemplateArgument::ArgKind']) 167 | subset.append(asg['enum ::clang::Decl::Kind']) 168 | subset.extend(asg.nodes('::clanglite::build_ast_from_code_with_args')) 169 | 170 | for node in subset: 171 | node.boost_python_export = True 172 | 173 | for fct in asg['::clanglite'].functions(): 174 | if not fct.localname == 'build_ast_from_code_with_args': 175 | fct.parent = fct.parameters[0].qualified_type.desugared_type.unqualified_type 176 | fct.boost_python_export = True 177 | 178 | for mtd in asg['class ::clang::ASTContext'].methods(pattern='.*getSourceManager.*'): 179 | if mtd.return_type.globalname == 'class ::clang::SourceManager &': 180 | mtd.boost_python_export = True 181 | break 182 | 183 | if autowig.parser.plugin == 'libclang': 184 | for node in (asg.functions(pattern='.*(llvm|clang).*_(begin|end)') 185 | + asg.functions(pattern='::clang::CXXRecordDecl::getCaptureFields') 186 | + asg.functions(pattern='.*(llvm|clang).*getNameAsString') 187 | + asg.nodes('::clang::NamedDecl::getQualifiedNameAsString') 188 | + asg.functions(pattern='.*::clang::ObjCProtocolDecl') 189 | + asg.nodes('::clang::ObjCProtocolDecl::collectInheritedProtocolProperties') 190 | + asg.nodes('::clang::ASTUnit::LoadFromASTFile') 191 | + asg.nodes('::clang::ASTUnit::getCachedCompletionTypes') 192 | + asg.nodes('::clang::ASTUnit::getBufferForFile') 193 | + asg.nodes('::clang::CXXRecordDecl::getCaptureFields') 194 | + asg.nodes('::clang::ASTContext::SectionInfos') 195 | + asg.nodes('::clang::ASTContext::getAllocator') 196 | + asg.nodes('::clang::ASTContext::getObjCEncoding.*') 197 | + asg.nodes('::clang::ASTContext::getAllocator') 198 | + asg.nodes('::clang::QualType::getAsString') 199 | + asg.nodes('::clang::SourceLocation::printToString') 200 | + asg['class ::llvm::StringRef'].methods()): 201 | node.boost_python_export = False 202 | 203 | if autowig.parser.plugin == 'clanglite': 204 | for mtd in asg['class ::clang::Decl'].methods(): 205 | if mtd.localname == 'hasAttr': 206 | mtd.boost_python_export = False 207 | 208 | import sys 209 | try: 210 | from path import path as Path 211 | except: 212 | from path import Path 213 | 214 | import platform 215 | if any(platform.win32_ver()): 216 | for header in (Path(sys.prefix)/'Library'/'include'/'clang').walkfiles('*.h'): 217 | asg[header.abspath()].is_external_dependency = False 218 | else: 219 | for header in (Path(sys.prefix)/'include'/'clang').walkfiles('*.h'): 220 | asg[header.abspath()].is_external_dependency = False 221 | 222 | return asg 223 | 224 | autowig.controller['clanglite'] = clanglite_controller 225 | autowig.controller.plugin = 'clanglite' 226 | asg = autowig.controller(asg) 227 | 228 | asg['enum ::max_align_t'].boost_python_export = False 229 | asg['::max_align_t::__clang_max_align_nonce1'].boost_python_export = False 230 | 231 | autowig.generator.plugin = 'boost_python_internal' 232 | module = autowig.generator(asg, 233 | module = self.srcdir/'py'/'wrapper'/'_clanglite.cpp', 234 | decorator = self.srcdir/'py'/'clanglite'/'_clanglite.py', 235 | closure = False) 236 | 237 | module.write() 238 | 239 | for filepath in (self.srcdir/'src'/'py'/'wrapper').walkfiles(): 240 | if filepath.exists() and filepath.ext in ['.cpp', '.h']: 241 | filepath.remove() -------------------------------------------------------------------------------- /travis.yml: -------------------------------------------------------------------------------- 1 | ## Copyright [2017-2018] UMR MISTEA INRA, UMR LEPSE INRA, ## 2 | ## UMR AGAP CIRAD, EPI Virtual Plants Inria ## 3 | ## Copyright [2015-2016] UMR AGAP CIRAD, EPI Virtual Plants Inria ## 4 | ## ## 5 | ## This file is part of the AutoWIG project. More information can be ## 6 | ## found at ## 7 | ## ## 8 | ## http://autowig.rtfd.io ## 9 | ## ## 10 | ## The Apache Software Foundation (ASF) licenses this file to you under ## 11 | ## the Apache License, Version 2.0 (the "License"); you may not use this ## 12 | ## file except in compliance with the License. You should have received ## 13 | ## a copy of the Apache License, Version 2.0 along with this file; see ## 14 | ## the file LICENSE. If not, you may obtain a copy of the License at ## 15 | ## ## 16 | ## http://www.apache.org/licenses/LICENSE-2.0 ## 17 | ## ## 18 | ## Unless required by applicable law or agreed to in writing, software ## 19 | ## distributed under the License is distributed on an "AS IS" BASIS, ## 20 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ## 21 | ## mplied. See the License for the specific language governing ## 22 | ## permissions and limitations under the License. ## 23 | 24 | branches: 25 | except: 26 | - doc 27 | 28 | language: cpp 29 | 30 | sudo: required 31 | 32 | git: 33 | depth: false 34 | 35 | services: 36 | - docker 37 | 38 | os: 39 | - linux 40 | - osx 41 | - windows 42 | 43 | dist: trusty 44 | osx_image: xcode8.3 45 | 46 | env: 47 | - CONDA_RECIPE=etc/conda/python-autowig 48 | - CONDA_RECIPE=etc/conda/autowig-toolchain 49 | 50 | matrix: 51 | exclude: 52 | - os: windows 53 | env: CONDA_RECIPE=etc/conda/python-autowig 54 | 55 | before_install: 56 | - git clone https://github.com/StatisKit/travis-ci.git --depth=1 57 | - cd travis-ci 58 | - ./before_install 59 | 60 | install: 61 | - ./install 62 | 63 | before_script: 64 | - ./before_script 65 | 66 | script: 67 | - ./script 68 | 69 | after_success: 70 | - ./after_success 71 | 72 | after_failure: 73 | - ./after_failure 74 | 75 | before_deploy: 76 | - ./before_deploy 77 | 78 | deploy: 79 | skip_cleanup: true 80 | provider: script 81 | on: 82 | all_branches: true 83 | script: ./deploy_script 84 | 85 | after_deploy: 86 | - ./after_deploy 87 | 88 | after_script: 89 | - ./after_script --------------------------------------------------------------------------------