pymoca 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pymoca-0.0.0/LICENSE +28 -0
- pymoca-0.0.0/MANIFEST.in +7 -0
- pymoca-0.0.0/PKG-INFO +155 -0
- pymoca-0.0.0/README.md +77 -0
- pymoca-0.0.0/doc/.gitignore +1 -0
- pymoca-0.0.0/doc/Makefile +193 -0
- pymoca-0.0.0/doc/make.bat +242 -0
- pymoca-0.0.0/doc/source/modules.rst +8 -0
- pymoca-0.0.0/doc/source/pymoca.generated.rst +46 -0
- pymoca-0.0.0/doc/source/pymoca.rst +61 -0
- pymoca-0.0.0/doc/source/setup.rst +7 -0
- pymoca-0.0.0/pyproject.toml +74 -0
- pymoca-0.0.0/setup.cfg +19 -0
- pymoca-0.0.0/src/pymoca/Modelica.g4 +556 -0
- pymoca-0.0.0/src/pymoca/__init__.py +3 -0
- pymoca-0.0.0/src/pymoca/_version.py +683 -0
- pymoca-0.0.0/src/pymoca/ast.py +910 -0
- pymoca-0.0.0/src/pymoca/backends/__init__.py +0 -0
- pymoca-0.0.0/src/pymoca/backends/casadi/__init__.py +0 -0
- pymoca-0.0.0/src/pymoca/backends/casadi/_options.py +42 -0
- pymoca-0.0.0/src/pymoca/backends/casadi/alias_relation.py +98 -0
- pymoca-0.0.0/src/pymoca/backends/casadi/api.py +522 -0
- pymoca-0.0.0/src/pymoca/backends/casadi/generator.py +1051 -0
- pymoca-0.0.0/src/pymoca/backends/casadi/model.py +1465 -0
- pymoca-0.0.0/src/pymoca/backends/casadi/mtensor.py +44 -0
- pymoca-0.0.0/src/pymoca/backends/sympy/__init__.py +0 -0
- pymoca-0.0.0/src/pymoca/backends/sympy/generator.py +218 -0
- pymoca-0.0.0/src/pymoca/backends/sympy/runtime.py +167 -0
- pymoca-0.0.0/src/pymoca/backends/xml/__init__.py +0 -0
- pymoca-0.0.0/src/pymoca/backends/xml/analysis.py +38 -0
- pymoca-0.0.0/src/pymoca/backends/xml/generator.py +134 -0
- pymoca-0.0.0/src/pymoca/backends/xml/model.py +246 -0
- pymoca-0.0.0/src/pymoca/backends/xml/parser.py +395 -0
- pymoca-0.0.0/src/pymoca/backends/xml/sim_scipy.py +190 -0
- pymoca-0.0.0/src/pymoca/generated/ModelicaLexer.py +7261 -0
- pymoca-0.0.0/src/pymoca/generated/ModelicaListener.py +959 -0
- pymoca-0.0.0/src/pymoca/generated/ModelicaParser.py +15653 -0
- pymoca-0.0.0/src/pymoca/generated/ModelicaVisitor.py +488 -0
- pymoca-0.0.0/src/pymoca/generated/__init__.py +0 -0
- pymoca-0.0.0/src/pymoca/parser.py +1115 -0
- pymoca-0.0.0/src/pymoca/tree.py +1271 -0
- pymoca-0.0.0/src/pymoca.egg-info/PKG-INFO +155 -0
- pymoca-0.0.0/src/pymoca.egg-info/SOURCES.txt +45 -0
- pymoca-0.0.0/src/pymoca.egg-info/dependency_links.txt +1 -0
- pymoca-0.0.0/src/pymoca.egg-info/requires.txt +23 -0
- pymoca-0.0.0/src/pymoca.egg-info/top_level.txt +1 -0
pymoca-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Copyright (c) 2016-2021, James Goppert and the Pymoca contributors.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of pymoca nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
pymoca-0.0.0/MANIFEST.in
ADDED
pymoca-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pymoca
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: A python/modelica based simulation environment.
|
|
5
|
+
Author: Pymoca Contributors
|
|
6
|
+
Maintainer-email: Jack Vreeken <jack@vreeken.me>, Kent Rutan <gs1150e@icloud.com>
|
|
7
|
+
License: Copyright (c) 2016-2021, James Goppert and the Pymoca contributors.
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
|
11
|
+
modification, are permitted provided that the following conditions are met:
|
|
12
|
+
|
|
13
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
14
|
+
list of conditions and the following disclaimer.
|
|
15
|
+
|
|
16
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
|
18
|
+
and/or other materials provided with the distribution.
|
|
19
|
+
|
|
20
|
+
* Neither the name of pymoca nor the names of its
|
|
21
|
+
contributors may be used to endorse or promote products derived from
|
|
22
|
+
this software without specific prior written permission.
|
|
23
|
+
|
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Project-URL: homepage, https://github.com/pymoca/pymoca
|
|
37
|
+
Keywords: modelica,simulation,compiler
|
|
38
|
+
Classifier: Development Status :: 3 - Alpha
|
|
39
|
+
Classifier: Intended Audience :: Science/Research
|
|
40
|
+
Classifier: Intended Audience :: Developers
|
|
41
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
42
|
+
Classifier: Programming Language :: Python
|
|
43
|
+
Classifier: Programming Language :: Python :: 3
|
|
44
|
+
Classifier: Programming Language :: Other
|
|
45
|
+
Classifier: Topic :: Software Development
|
|
46
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
47
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
48
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
49
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
50
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
51
|
+
Classifier: Operating System :: POSIX
|
|
52
|
+
Classifier: Operating System :: Unix
|
|
53
|
+
Classifier: Operating System :: MacOS
|
|
54
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
55
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
56
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
57
|
+
Requires-Python: >=3.9
|
|
58
|
+
Description-Content-Type: text/markdown
|
|
59
|
+
License-File: LICENSE
|
|
60
|
+
Requires-Dist: numpy>=1.8.2
|
|
61
|
+
Requires-Dist: antlr4-python3-runtime==4.13.*
|
|
62
|
+
Provides-Extra: casadi
|
|
63
|
+
Requires-Dist: casadi>=3.4.0; extra == "casadi"
|
|
64
|
+
Requires-Dist: setuptools>=60.0.0; extra == "casadi"
|
|
65
|
+
Provides-Extra: lxml
|
|
66
|
+
Requires-Dist: lxml>=3.5.0; extra == "lxml"
|
|
67
|
+
Requires-Dist: scipy>=0.13.3; extra == "lxml"
|
|
68
|
+
Provides-Extra: sympy
|
|
69
|
+
Requires-Dist: sympy>=0.7.6.1; extra == "sympy"
|
|
70
|
+
Requires-Dist: scipy>=0.13.3; extra == "sympy"
|
|
71
|
+
Requires-Dist: jinja2>=2.10.1; extra == "sympy"
|
|
72
|
+
Provides-Extra: examples
|
|
73
|
+
Requires-Dist: jupyterlab; extra == "examples"
|
|
74
|
+
Requires-Dist: matplotlib; extra == "examples"
|
|
75
|
+
Requires-Dist: control<=0.10.0,>=0.9.3.post2; extra == "examples"
|
|
76
|
+
Provides-Extra: all
|
|
77
|
+
Requires-Dist: pymoca[casadi,examples,lxml,sympy]; extra == "all"
|
|
78
|
+
|
|
79
|
+
# <img alt="Pymoca" src="branding/icons/pymocalogo.svg" height="60">
|
|
80
|
+
|
|
81
|
+
A Modelica to computer algebra system (CAS) translator written in Python.
|
|
82
|
+
|
|
83
|
+
[](https://github.com/pymoca/pymoca/actions?query=workflow%3ACI)
|
|
84
|
+
[](https://codecov.io/gh/pymoca/pymoca)
|
|
85
|
+
[](https://zenodo.org/badge/latestdoi/20664755)
|
|
86
|
+
|
|
87
|
+
## Overview
|
|
88
|
+
Pymoca can be used in applications that need to translate [Modelica](https://modelica.org) mathematical models into other forms. Pymoca can "flatten" a model containing a connected set of components defined by object-oriented Modelica classes into a set of variables and simultaneous equations that are easier to further process for analysis or simulation. It is particularly suited to provide Modelica models in symbolic form to [computer algebra systems](https://en.wikipedia.org/wiki/Computer_algebra_system). A common use in this context is to provide differential and algebraic equations for use in [optimal control problems](https://en.wikipedia.org/wiki/Optimal_control). Pymoca can translate Modelica to [CasADi](https://web.casadi.org), [SymPy](https://www.sympy.org), and [ModelicaXML](https://github.com/modelica-association/ModelicaXML), but most development and usage has been with CasADi.
|
|
89
|
+
|
|
90
|
+
## Install
|
|
91
|
+
|
|
92
|
+
For parser support without backend dependencies:
|
|
93
|
+
```bash
|
|
94
|
+
pip install pymoca
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Other options are:
|
|
98
|
+
```bash
|
|
99
|
+
pip install "pymoca[casadi]" # CasADi backend dependencies
|
|
100
|
+
pip install "pymoca[sympy]" # SymPy backend dependencies
|
|
101
|
+
pip install "pymoca[lxml]" # ModelicaXML backend dependencies
|
|
102
|
+
|
|
103
|
+
pip install "pymoca[examples]" # To run Jupyter notebook examples in the repo
|
|
104
|
+
|
|
105
|
+
pip install "pymoca[all]" # All of the above
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Usage
|
|
109
|
+
|
|
110
|
+
Pymoca reads and understands Modelica code (`pymoca.parser`) and provides access to an internal representation of the code called an Abstract Syntax Tree or AST (`pymoca.ast`). The AST is further processed to generate output in various formats (`pymoca.backends`). The `pymoca.tree` module provides functionality to transform the AST into a form that can be more easily used by the backends to generate the target output. In particular, `pymoca.tree` provides classes and functions to convert a hierarchical, object-oriented Modelica model of connected components into a "flat" system of equations and associated variables, parameters, and constants. Pymoca error checking is not always complete or easy to understand, so it is better to develop the Modelica code with other tools and then use Pymoca for translation.
|
|
111
|
+
|
|
112
|
+
The [test suite](test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
|
|
113
|
+
|
|
114
|
+
Here is an example using a simple spring and damper model from the test suite:
|
|
115
|
+
|
|
116
|
+
```Python
|
|
117
|
+
from pprint import pprint
|
|
118
|
+
|
|
119
|
+
import pymoca.parser
|
|
120
|
+
import pymoca.backends.casadi.generator as casadi_backend
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
MODELICA_MODEL = """
|
|
124
|
+
model Spring
|
|
125
|
+
Real x, v_x;
|
|
126
|
+
parameter Real c = 0.1;
|
|
127
|
+
parameter Real k = 2;
|
|
128
|
+
equation
|
|
129
|
+
der(x) = v_x;
|
|
130
|
+
der(v_x) = -k*x - c*v_x;
|
|
131
|
+
end Spring;
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
print("Modelica Model:\n", MODELICA_MODEL)
|
|
135
|
+
|
|
136
|
+
print("\nEquations from the parsed AST in a JSON representation:")
|
|
137
|
+
ast = pymoca.parser.parse(MODELICA_MODEL)
|
|
138
|
+
pprint(ast.to_json(ast.classes["Spring"].equations))
|
|
139
|
+
|
|
140
|
+
print("\nGenerated CasADi model:")
|
|
141
|
+
casadi_model = casadi_backend.generate(ast, "Spring")
|
|
142
|
+
print(casadi_model)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Some more interesting examples are in Jupyter notebooks:
|
|
146
|
+
|
|
147
|
+
* [Casadi Example](test/notebooks/Casadi.ipynb)
|
|
148
|
+
* [Sympy Example](test/notebooks/Spring.ipynb)
|
|
149
|
+
|
|
150
|
+
## Roadmap
|
|
151
|
+
|
|
152
|
+
See the [GitHub Projects](https://github.com/orgs/pymoca/projects) for plans. In particular, see the [Info Panel in the Modelica Flattening project](https://github.com/orgs/pymoca/projects/1/views/1?pane=info) for an overview of a project getting some current focus. Breaking API changes are expected.
|
|
153
|
+
|
|
154
|
+
<!--- vim:ts=4:sw=4:expandtab:
|
|
155
|
+
!-->
|
pymoca-0.0.0/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# <img alt="Pymoca" src="branding/icons/pymocalogo.svg" height="60">
|
|
2
|
+
|
|
3
|
+
A Modelica to computer algebra system (CAS) translator written in Python.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/pymoca/pymoca/actions?query=workflow%3ACI)
|
|
6
|
+
[](https://codecov.io/gh/pymoca/pymoca)
|
|
7
|
+
[](https://zenodo.org/badge/latestdoi/20664755)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
Pymoca can be used in applications that need to translate [Modelica](https://modelica.org) mathematical models into other forms. Pymoca can "flatten" a model containing a connected set of components defined by object-oriented Modelica classes into a set of variables and simultaneous equations that are easier to further process for analysis or simulation. It is particularly suited to provide Modelica models in symbolic form to [computer algebra systems](https://en.wikipedia.org/wiki/Computer_algebra_system). A common use in this context is to provide differential and algebraic equations for use in [optimal control problems](https://en.wikipedia.org/wiki/Optimal_control). Pymoca can translate Modelica to [CasADi](https://web.casadi.org), [SymPy](https://www.sympy.org), and [ModelicaXML](https://github.com/modelica-association/ModelicaXML), but most development and usage has been with CasADi.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
For parser support without backend dependencies:
|
|
15
|
+
```bash
|
|
16
|
+
pip install pymoca
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Other options are:
|
|
20
|
+
```bash
|
|
21
|
+
pip install "pymoca[casadi]" # CasADi backend dependencies
|
|
22
|
+
pip install "pymoca[sympy]" # SymPy backend dependencies
|
|
23
|
+
pip install "pymoca[lxml]" # ModelicaXML backend dependencies
|
|
24
|
+
|
|
25
|
+
pip install "pymoca[examples]" # To run Jupyter notebook examples in the repo
|
|
26
|
+
|
|
27
|
+
pip install "pymoca[all]" # All of the above
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Pymoca reads and understands Modelica code (`pymoca.parser`) and provides access to an internal representation of the code called an Abstract Syntax Tree or AST (`pymoca.ast`). The AST is further processed to generate output in various formats (`pymoca.backends`). The `pymoca.tree` module provides functionality to transform the AST into a form that can be more easily used by the backends to generate the target output. In particular, `pymoca.tree` provides classes and functions to convert a hierarchical, object-oriented Modelica model of connected components into a "flat" system of equations and associated variables, parameters, and constants. Pymoca error checking is not always complete or easy to understand, so it is better to develop the Modelica code with other tools and then use Pymoca for translation.
|
|
33
|
+
|
|
34
|
+
The [test suite](test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
|
|
35
|
+
|
|
36
|
+
Here is an example using a simple spring and damper model from the test suite:
|
|
37
|
+
|
|
38
|
+
```Python
|
|
39
|
+
from pprint import pprint
|
|
40
|
+
|
|
41
|
+
import pymoca.parser
|
|
42
|
+
import pymoca.backends.casadi.generator as casadi_backend
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
MODELICA_MODEL = """
|
|
46
|
+
model Spring
|
|
47
|
+
Real x, v_x;
|
|
48
|
+
parameter Real c = 0.1;
|
|
49
|
+
parameter Real k = 2;
|
|
50
|
+
equation
|
|
51
|
+
der(x) = v_x;
|
|
52
|
+
der(v_x) = -k*x - c*v_x;
|
|
53
|
+
end Spring;
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
print("Modelica Model:\n", MODELICA_MODEL)
|
|
57
|
+
|
|
58
|
+
print("\nEquations from the parsed AST in a JSON representation:")
|
|
59
|
+
ast = pymoca.parser.parse(MODELICA_MODEL)
|
|
60
|
+
pprint(ast.to_json(ast.classes["Spring"].equations))
|
|
61
|
+
|
|
62
|
+
print("\nGenerated CasADi model:")
|
|
63
|
+
casadi_model = casadi_backend.generate(ast, "Spring")
|
|
64
|
+
print(casadi_model)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Some more interesting examples are in Jupyter notebooks:
|
|
68
|
+
|
|
69
|
+
* [Casadi Example](test/notebooks/Casadi.ipynb)
|
|
70
|
+
* [Sympy Example](test/notebooks/Spring.ipynb)
|
|
71
|
+
|
|
72
|
+
## Roadmap
|
|
73
|
+
|
|
74
|
+
See the [GitHub Projects](https://github.com/orgs/pymoca/projects) for plans. In particular, see the [Info Panel in the Modelica Flattening project](https://github.com/orgs/pymoca/projects/1/views/1?pane=info) for an overview of a project getting some current focus. Breaking API changes are expected.
|
|
75
|
+
|
|
76
|
+
<!--- vim:ts=4:sw=4:expandtab:
|
|
77
|
+
!-->
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
build/
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line.
|
|
5
|
+
SPHINXOPTS =
|
|
6
|
+
SPHINXBUILD = sphinx-build
|
|
7
|
+
SPHINXAPIBUILD = sphinx-apidoc
|
|
8
|
+
BROWSER = firefox
|
|
9
|
+
PAPER =
|
|
10
|
+
BUILDDIR = build
|
|
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) source
|
|
21
|
+
# the i18n builder cannot share the environment and doctrees with the others
|
|
22
|
+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
|
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 <target>' where <target> is one of"
|
|
28
|
+
@echo " api to autogenerate api doc"
|
|
29
|
+
@echo " html to make standalone HTML files"
|
|
30
|
+
@echo " html-view to make standalone HTML files"
|
|
31
|
+
@echo " html-zip create a zip of HTML files"
|
|
32
|
+
@echo " dirhtml to make HTML files named index.html in directories"
|
|
33
|
+
@echo " singlehtml to make a single large HTML file"
|
|
34
|
+
@echo " pickle to make pickle files"
|
|
35
|
+
@echo " json to make JSON files"
|
|
36
|
+
@echo " htmlhelp to make HTML files and a HTML help project"
|
|
37
|
+
@echo " qthelp to make HTML files and a qthelp project"
|
|
38
|
+
@echo " devhelp to make HTML files and a Devhelp project"
|
|
39
|
+
@echo " epub to make an epub"
|
|
40
|
+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
|
41
|
+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
|
42
|
+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
|
43
|
+
@echo " text to make text files"
|
|
44
|
+
@echo " man to make manual pages"
|
|
45
|
+
@echo " texinfo to make Texinfo files"
|
|
46
|
+
@echo " info to make Texinfo files and run them through makeinfo"
|
|
47
|
+
@echo " gettext to make PO message catalogs"
|
|
48
|
+
@echo " changes to make an overview of all changed/added/deprecated items"
|
|
49
|
+
@echo " xml to make Docutils-native XML files"
|
|
50
|
+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
|
51
|
+
@echo " linkcheck to check all external links for integrity"
|
|
52
|
+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
|
53
|
+
|
|
54
|
+
clean:
|
|
55
|
+
rm -rf $(BUILDDIR)/*
|
|
56
|
+
|
|
57
|
+
api:
|
|
58
|
+
$(SPHINXAPIBUILD) -o source ..
|
|
59
|
+
@echo
|
|
60
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
61
|
+
|
|
62
|
+
html:
|
|
63
|
+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
|
64
|
+
@echo
|
|
65
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
66
|
+
|
|
67
|
+
html-view: html
|
|
68
|
+
$(BROWSER) build/html/index.html
|
|
69
|
+
|
|
70
|
+
html-zip: html
|
|
71
|
+
cd build/html && zip -r ../pymoca-doc.zip .
|
|
72
|
+
|
|
73
|
+
dirhtml:
|
|
74
|
+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
|
75
|
+
@echo
|
|
76
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
|
77
|
+
|
|
78
|
+
singlehtml:
|
|
79
|
+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
|
80
|
+
@echo
|
|
81
|
+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
|
82
|
+
|
|
83
|
+
pickle:
|
|
84
|
+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
|
85
|
+
@echo
|
|
86
|
+
@echo "Build finished; now you can process the pickle files."
|
|
87
|
+
|
|
88
|
+
json:
|
|
89
|
+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
|
90
|
+
@echo
|
|
91
|
+
@echo "Build finished; now you can process the JSON files."
|
|
92
|
+
|
|
93
|
+
htmlhelp:
|
|
94
|
+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
|
95
|
+
@echo
|
|
96
|
+
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
|
97
|
+
".hhp project file in $(BUILDDIR)/htmlhelp."
|
|
98
|
+
|
|
99
|
+
qthelp:
|
|
100
|
+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
|
101
|
+
@echo
|
|
102
|
+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
|
103
|
+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
|
104
|
+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pymoca.qhcp"
|
|
105
|
+
@echo "To view the help file:"
|
|
106
|
+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pymoca.qhc"
|
|
107
|
+
|
|
108
|
+
devhelp:
|
|
109
|
+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
|
110
|
+
@echo
|
|
111
|
+
@echo "Build finished."
|
|
112
|
+
@echo "To view the help file:"
|
|
113
|
+
@echo "# mkdir -p $$HOME/.local/share/devhelp/pymoca"
|
|
114
|
+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pymoca"
|
|
115
|
+
@echo "# devhelp"
|
|
116
|
+
|
|
117
|
+
epub:
|
|
118
|
+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
|
119
|
+
@echo
|
|
120
|
+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
|
121
|
+
|
|
122
|
+
latex:
|
|
123
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
124
|
+
@echo
|
|
125
|
+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
|
126
|
+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
|
127
|
+
"(use \`make latexpdf' here to do that automatically)."
|
|
128
|
+
|
|
129
|
+
latexpdf:
|
|
130
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
131
|
+
@echo "Running LaTeX files through pdflatex..."
|
|
132
|
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
|
133
|
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
|
134
|
+
|
|
135
|
+
latexpdfja:
|
|
136
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
137
|
+
@echo "Running LaTeX files through platex and dvipdfmx..."
|
|
138
|
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
|
139
|
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
|
140
|
+
|
|
141
|
+
text:
|
|
142
|
+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
|
143
|
+
@echo
|
|
144
|
+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
|
145
|
+
|
|
146
|
+
man:
|
|
147
|
+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
|
148
|
+
@echo
|
|
149
|
+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
|
150
|
+
|
|
151
|
+
texinfo:
|
|
152
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
153
|
+
@echo
|
|
154
|
+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
|
155
|
+
@echo "Run \`make' in that directory to run these through makeinfo" \
|
|
156
|
+
"(use \`make info' here to do that automatically)."
|
|
157
|
+
|
|
158
|
+
info:
|
|
159
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
160
|
+
@echo "Running Texinfo files through makeinfo..."
|
|
161
|
+
make -C $(BUILDDIR)/texinfo info
|
|
162
|
+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
|
163
|
+
|
|
164
|
+
gettext:
|
|
165
|
+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
|
166
|
+
@echo
|
|
167
|
+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
|
168
|
+
|
|
169
|
+
changes:
|
|
170
|
+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
|
171
|
+
@echo
|
|
172
|
+
@echo "The overview file is in $(BUILDDIR)/changes."
|
|
173
|
+
|
|
174
|
+
linkcheck:
|
|
175
|
+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
|
176
|
+
@echo
|
|
177
|
+
@echo "Link check complete; look for any errors in the above output " \
|
|
178
|
+
"or in $(BUILDDIR)/linkcheck/output.txt."
|
|
179
|
+
|
|
180
|
+
doctest:
|
|
181
|
+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
|
182
|
+
@echo "Testing of doctests in the sources finished, look at the " \
|
|
183
|
+
"results in $(BUILDDIR)/doctest/output.txt."
|
|
184
|
+
|
|
185
|
+
xml:
|
|
186
|
+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
|
187
|
+
@echo
|
|
188
|
+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
|
189
|
+
|
|
190
|
+
pseudoxml:
|
|
191
|
+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
|
192
|
+
@echo
|
|
193
|
+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|