OMSimulator 2.1.3__tar.gz → 3.0.0.post115__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.
@@ -0,0 +1,3 @@
1
+ include build_helpers.py
2
+ include README.md
3
+ include OSMC-License.txt
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: OMSimulator
3
+ Version: 3.0.0.post115
4
+ Summary: OMSimulator - the FMI-based co-simulation environment for Python
5
+ Author-email: "Open Source Modelica Consortium (OSMC)" <openmodelicadevelopers@ida.liu.se>
6
+ Project-URL: Homepage, http://openmodelica.org/
7
+ Project-URL: Documentation, https://openmodelica.org/doc/OMSimulator/master/OMSimulator/UsersGuide/html/
8
+ Project-URL: Source Code, https://github.com/OpenModelica/OMSimulator
9
+ Project-URL: Issues, https://github.com/OpenModelica/OMSimulator/issues
10
+ Project-URL: Release Notes, https://github.com/OpenModelica/OMSimulator/releases
11
+ Project-URL: Download, https://pypi.org/project/OMSimulator/#files
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: OSMC-License.txt
15
+ Requires-Dist: requests
16
+ Requires-Dist: lxml>=5.3.1
17
+ Dynamic: license-file
18
+
19
+ # OMSimulator [![License: OSMC-PL](https://img.shields.io/badge/license-OSMC--PL-lightgrey.svg)](OSMC-License.txt)
20
+
21
+ The OMSimulator project is a FMI-based co-simulation environment.
@@ -1,5 +1,8 @@
1
+ MANIFEST.in
2
+ OSMC-License.txt
1
3
  README.md
2
- setup.py
4
+ build_helpers.py
5
+ pyproject.toml
3
6
  OMSimulator.egg-info/PKG-INFO
4
7
  OMSimulator.egg-info/SOURCES.txt
5
8
  OMSimulator.egg-info/dependency_links.txt
@@ -0,0 +1,2 @@
1
+ requests
2
+ lxml>=5.3.1
@@ -0,0 +1,271 @@
1
+ --- Start of Definition of OSMC Public License ---
2
+
3
+ /*
4
+ * This file is part of OpenModelica.
5
+ *
6
+ * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
7
+ * c/o Linköpings universitet, Department of Computer and Information Science,
8
+ * SE-58183 Linköping, Sweden.
9
+ *
10
+ * All rights reserved.
11
+ *
12
+ * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
13
+ * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
14
+ * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
15
+ * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
16
+ * ACCORDING TO RECIPIENTS CHOICE.
17
+ *
18
+ * The OpenModelica software and the Open Source Modelica
19
+ * Consortium (OSMC) Public License (OSMC-PL) are obtained
20
+ * from OSMC, either from the above address,
21
+ * from the URLs: http://www.ida.liu.se/projects/OpenModelica or
22
+ * http://www.openmodelica.org, and in the OpenModelica distribution.
23
+ * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
24
+ *
25
+ * This program is distributed WITHOUT ANY WARRANTY; without
26
+ * even the implied warranty of MERCHANTABILITY or FITNESS
27
+ * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
28
+ * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
29
+ *
30
+ * See the full OSMC Public License conditions for more details.
31
+ *
32
+ */
33
+
34
+ --- End of OSMC Public License Header ---
35
+
36
+ The OSMC-PL is a public license for OpenModelica with three modes/alternatives
37
+ (GPL, OSMC-Internal-EPL, OSMC-External-EPL) for use and redistribution,
38
+ in source and/or binary/object-code form:
39
+
40
+ * GPL. Any party (member or non-member of OSMC) may use and redistribute
41
+ OpenModelica under GPL version 3.
42
+
43
+ * Level 1 members of OSMC may also use and redistribute OpenModelica under
44
+ OSMC-Internal-EPL conditions.
45
+
46
+ * Level 2 members of OSMC may also use and redistribute OpenModelica under
47
+ OSMC-Internal-EPL or OSMC-External-EPL conditions.
48
+
49
+ Definitions of OSMC Public license modes:
50
+
51
+ * GPL = GPL version 3.
52
+
53
+ * OSMC-Internal-EPL = These OSMC Public license conditions together with
54
+ Internally restricted EPL, i.e., EPL version 1.0 with the Additional
55
+ Condition that use and redistribution by an OSMC member is only allowed
56
+ within the OSMC member's own organization (i.e., its own legal entity),
57
+ or for an OSMC member paying a membership fee corresponding to the size
58
+ of the organization including all its affiliates, use and redistribution
59
+ is allowed within/between its affiliates.
60
+
61
+ * OSMC-External-EPL = These OSMC Public license conditions together with
62
+ Externally restricted EPL, i.e., EPL version 1.0 with the Additional
63
+ Condition that use and redistribution by an OSMC member, or by a Licensed
64
+ Third Party Distributor having a redistribution agreement with that member,
65
+ to parties external to the OSMC member’s own organization (i.e., its own
66
+ legal entity) is only allowed in binary/object-code form, except the case of
67
+ redistribution to other OSMC members to which source is also allowed to be
68
+ distributed.
69
+
70
+ [This has the consequence that an external party who wishes to use
71
+ OpenModelica in source form together with its own proprietary software in all
72
+ cases must be a member of OSMC].
73
+
74
+ In all cases of usage and redistribution by recipients, the following
75
+ conditions also apply:
76
+
77
+ a) Redistributions of source code must retain the above copyright notice,
78
+ all definitions, and conditions. It is sufficient if the OSMC-PL Header is
79
+ present in each source file, if the full OSMC-PL is available in a prominent
80
+ and easily located place in the redistribution.
81
+
82
+ b) Redistributions in binary/object-code form must reproduce the above
83
+ copyright notice, all definitions, and conditions. It is sufficient if the
84
+ OSMC-PL Header and the location in the redistribution of the full OSMC-PL
85
+ are present in the documentation and/or other materials provided with the
86
+ redistribution, if the full OSMC-PL is available in a prominent and easily
87
+ located place in the redistribution.
88
+
89
+ c) A recipient must clearly indicate its chosen usage mode of OSMC-PL,
90
+ in accompanying documentation and in a text file OSMC-USAGE-MODE.txt,
91
+ provided with the distribution.
92
+
93
+ d) Contributor(s) making a Contribution to OpenModelica thereby also makes a
94
+ Transfer of Contribution Copyright. In return, upon the effective date of
95
+ the transfer, OSMC grants the Contributor(s) a Contribution License of the
96
+ Contribution. OSMC has the right to accept or refuse Contributions.
97
+
98
+ Definitions:
99
+
100
+ "Subsidiary license conditions" means:
101
+
102
+ The additional license conditions depending on the by the recipient chosen
103
+ mode of OSMC-PL, defined by GPL version 3.0 for GPL, and by EPL for
104
+ OSMC-Internal-EPL and OSMC-External-EPL.
105
+
106
+ "OSMC-PL" means:
107
+
108
+ Open Source Modelica Consortium Public License version 1.2, i.e., the license
109
+ defined here (the text between
110
+ "--- Start of Definition of OSMC Public License ---" and
111
+ "--- End of Definition of OSMC Public License ---", or later versions thereof.
112
+
113
+ "OSMC-PL Header" means:
114
+
115
+ Open Source Modelica Consortium Public License Header version 1.2, i.e., the
116
+ text between "--- Start of Definition of OSMC Public License ---" and
117
+ "--- End of OSMC Public License Header ---, or later versions thereof.
118
+
119
+ "Contribution" means:
120
+
121
+ a) in the case of the initial Contributor, the initial code and documentation
122
+ distributed under OSMC-PL, and
123
+
124
+ b) in the case of each subsequent Contributor:
125
+ i) changes to OpenModelica, and
126
+ ii) additions to OpenModelica;
127
+
128
+ where such changes and/or additions to OpenModelica originate from and are
129
+ distributed by that particular Contributor. A Contribution 'originates' from
130
+ a Contributor if it was added to OpenModelica by such Contributor itself or
131
+ anyone acting on such Contributor's behalf.
132
+
133
+ For Contributors licensing OpenModelica under OSMC-Internal-EPL or
134
+ OSMC-External-EPL conditions, the following conditions also hold:
135
+
136
+ Contributions do not include additions to the distributed Program which: (i)
137
+ are separate modules of software distributed in conjunction with OpenModelica
138
+ under their own license agreement, (ii) are separate modules which are not
139
+ derivative works of OpenModelica, and (iii) are separate modules of software
140
+ distributed in conjunction with OpenModelica under their own license agreement
141
+ where these separate modules are merged with (weaved together with) modules of
142
+ OpenModelica to form new modules that are distributed as object code or source
143
+ code under their own license agreement, as allowed under the Additional
144
+ Condition of internal distribution according to OSMC-Internal-EPL and/or
145
+ Additional Condition for external distribution according to OSMC-External-EPL.
146
+
147
+ "Transfer of Contribution Copyright" means that the Contributors of a
148
+ Contribution transfer the ownership and the copyright of the Contribution to
149
+ Open Source Modelica Consortium, the OpenModelica Copyright owner, for
150
+ inclusion in OpenModelica. The transfer takes place upon the effective date
151
+ when the Contribution is made available on the OSMC web site under OSMC-PL, by
152
+ such Contributors themselves or anyone acting on such Contributors' behalf.
153
+ The transfer is free of charge. If the Contributors or OSMC so wish,
154
+ an optional Copyright transfer agreement can be signed between OSMC and the
155
+ Contributors, as specified in an Appendix of the OSMC Bylaws.
156
+
157
+ "Contribution License" means a license from OSMC to the Contributors of the
158
+ Contribution, effective on the date of the Transfer of Contribution Copyright,
159
+ where OSMC grants the Contributors a non-exclusive, world-wide, transferable,
160
+ free of charge, perpetual license, including sublicensing rights, to use,
161
+ have used, modify, have modified, reproduce and or have reproduced the
162
+ contributed material, for business and other purposes, including but not
163
+ limited to evaluation, development, testing, integration and merging with
164
+ other software and distribution. The warranty and liability disclaimers of
165
+ OSMC-PL apply to this license.
166
+
167
+ "Contributor" means any person or entity that distributes (part of)
168
+ OpenModelica.
169
+
170
+ "The Program" means the Contributions distributed in accordance with OSMC-PL.
171
+
172
+ "OpenModelica" means the Contributions distributed in accordance with OSMC-PL.
173
+
174
+ "Recipient" means anyone who receives OpenModelica under OSMC-PL,
175
+ including all Contributors.
176
+
177
+ "Licensed Third Party Distributor" means a reseller/distributor having signed
178
+ a redistribution/resale agreement in accordance with OSMC-PL and OSMC Bylaws,
179
+ with an OSMC Level 2 organizational member which is not an Affiliate of the
180
+ reseller/distributor, for distributing a product containing part(s) of
181
+ OpenModelica. The Licensed Third Party Distributor shall only be allowed
182
+ further redistribution to other resellers if the Level 2 member is granting
183
+ such a right to it in the redistribution/resale agreement between the
184
+ Level 2 member and the Licensed Third Party Distributor.
185
+
186
+ "Affiliate" shall mean any legal entity, directly or indirectly, through one
187
+ or more intermediaries, controlling or controlled by or under common control
188
+ with any other legal entity, as the case may be. For purposes of this
189
+ definition, the term "control" (including the terms "controlling,"
190
+ "controlled by" and "under common control with") means the possession,
191
+ direct or indirect, of the power to direct or cause the direction of the
192
+ management and policies of a legal entity, whether through the ownership of
193
+ voting securities, by contract or otherwise.
194
+
195
+ NO WARRANTY
196
+
197
+ EXCEPT AS EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY
198
+ LICENSE CONDITIONS OF OSMC-PL, OPENMODELICA IS PROVIDED ON AN "AS IS"
199
+ BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
200
+ IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
201
+ TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
202
+ PURPOSE. Each Recipient is solely responsible for determining the
203
+ appropriateness of using and distributing OPENMODELICA and assumes all risks
204
+ associated with its exercise of rights under OSMC-PL , including but not
205
+ limited to the risks and costs of program errors, compliance with applicable
206
+ laws, damage to or loss of data, programs or equipment, and unavailability
207
+ or interruption of operations.
208
+
209
+ DISCLAIMER OF LIABILITY
210
+
211
+ EXCEPT AS EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY
212
+ LICENSE CONDITIONS OF OSMC-PL, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
213
+ SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
214
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
215
+ LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
216
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
217
+ ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF OPENMODELICA OR THE
218
+ EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
219
+ POSSIBILITY OF SUCH DAMAGES.
220
+
221
+ A Contributor licensing OpenModelica under OSMC-Internal-EPL or
222
+ OSMC-External-EPL may choose to distribute (parts of) OpenModelica in object
223
+ code form under its own license agreement, provided that:
224
+
225
+ a) it complies with the terms and conditions of OSMC-PL; or for the case of
226
+ redistribution of OpenModelica together with proprietary code it is a dual
227
+ license where the OpenModelica parts are distributed under OSMC-PL compatible
228
+ conditions and the proprietary code is distributed under proprietary license
229
+ conditions; and
230
+
231
+ b) its license agreement:
232
+ i) effectively disclaims on behalf of all Contributors all warranties and
233
+ conditions, express and implied, including warranties or conditions of title
234
+ and non-infringement, and implied warranties or conditions of merchantability
235
+ and fitness for a particular purpose;
236
+ ii) effectively excludes on behalf of all Contributors all liability for
237
+ damages, including direct, indirect, special, incidental and consequential
238
+ damages, such as lost profits;
239
+ iii) states that any provisions which differ from OSMC-PL are offered by that
240
+ Contributor alone and not by any other party; and
241
+ iv) states from where the source code for OpenModelica is available, and
242
+ informs licensees how to obtain it in a reasonable manner on or through a
243
+ medium customarily used for software exchange.
244
+
245
+ When OPENMODELICA is made available in source code form:
246
+
247
+ a) it must be made available under OSMC-PL; and
248
+
249
+ b) a copy of OSMC-PL must be included with each copy of OPENMODELICA.
250
+
251
+ c) a copy of the subsidiary license associated with the selected mode of
252
+ OSMC-PL must be included with each copy of OPENMODELICA.
253
+
254
+ Contributors may not remove or alter any copyright notices contained within
255
+ OPENMODELICA.
256
+
257
+ If there is a conflict between OSMC-PL and the subsidiary license conditions,
258
+ OSMC-PL has priority.
259
+
260
+ This Agreement is governed by the laws of Sweden. The place of jurisdiction
261
+ for all disagreements related to this Agreement, is Linköping, Sweden.
262
+
263
+ The EPL 1.0 license definition has been obtained from:
264
+ http://www.eclipse.org/legal/epl-v10.html. It is also reproduced in Appendix B
265
+ of the OSMC Bylaws, and in the OpenModelica distribution.
266
+
267
+ The GPL Version 3 license definition has been obtained from
268
+ http://www.gnu.org/copyleft/gpl.html. It is also reproduced in Appendix C
269
+ of the OSMC Bylaws, and in the OpenModelica distribution.
270
+
271
+ --- End of Definition of OSMC Public License ---
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: OMSimulator
3
+ Version: 3.0.0.post115
4
+ Summary: OMSimulator - the FMI-based co-simulation environment for Python
5
+ Author-email: "Open Source Modelica Consortium (OSMC)" <openmodelicadevelopers@ida.liu.se>
6
+ Project-URL: Homepage, http://openmodelica.org/
7
+ Project-URL: Documentation, https://openmodelica.org/doc/OMSimulator/master/OMSimulator/UsersGuide/html/
8
+ Project-URL: Source Code, https://github.com/OpenModelica/OMSimulator
9
+ Project-URL: Issues, https://github.com/OpenModelica/OMSimulator/issues
10
+ Project-URL: Release Notes, https://github.com/OpenModelica/OMSimulator/releases
11
+ Project-URL: Download, https://pypi.org/project/OMSimulator/#files
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: OSMC-License.txt
15
+ Requires-Dist: requests
16
+ Requires-Dist: lxml>=5.3.1
17
+ Dynamic: license-file
18
+
19
+ # OMSimulator [![License: OSMC-PL](https://img.shields.io/badge/license-OSMC--PL-lightgrey.svg)](OSMC-License.txt)
20
+
21
+ The OMSimulator project is a FMI-based co-simulation environment.
@@ -1,3 +1,3 @@
1
- # OMSimulator [![License: OSMC-PL](https://img.shields.io/badge/license-OSMC--PL-lightgrey.svg)](OSMC-License.txt)
2
-
3
- The OMSimulator project is a FMI-based co-simulation environment that supports ordinary (i.e., non-delayed) and TLM connections.
1
+ # OMSimulator [![License: OSMC-PL](https://img.shields.io/badge/license-OSMC--PL-lightgrey.svg)](OSMC-License.txt)
2
+
3
+ The OMSimulator project is a FMI-based co-simulation environment.
@@ -0,0 +1,103 @@
1
+ import os
2
+ import platform
3
+ import shutil
4
+ import sys
5
+ import sysconfig
6
+ import tempfile
7
+ from setuptools.command.build_py import build_py
8
+
9
+ # check for requests package
10
+ try:
11
+ import requests
12
+ except ImportError:
13
+ import subprocess
14
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "requests"])
15
+ import requests
16
+
17
+ class OMSInstaller(build_py):
18
+ """
19
+ Custom build_py command to download OMSimulator binaries and copy them
20
+ into the package during build.
21
+ """
22
+ def __init__(self, dist):
23
+ # check if directory exist and remove
24
+ topdir = os.path.join(os.getcwd(), 'OMSimulator')
25
+ if os.path.isdir(topdir):
26
+ shutil.rmtree(topdir)
27
+
28
+ # recreate it, so that setuptools creates the package directory
29
+ os.mkdir(topdir)
30
+ # initialize parent
31
+ super().__init__(dist)
32
+
33
+ def fetch_oms(self):
34
+ target_dir = os.path.join(self.build_lib, "OMSimulator")
35
+ os.makedirs(target_dir, exist_ok=True)
36
+
37
+ # Select platform-specific download
38
+ if (sysconfig.get_platform() == 'linux-x86_64'):
39
+ url = 'https://build.openmodelica.org/omsimulator/nightly/linux-amd64/OMSimulator-linux-amd64-v3.0.0.post115-g47eeb55.tar.gz'
40
+ dll_path = "lib/x86_64-linux-gnu/libOMSimulator.so"
41
+ source_path = "lib/x86_64-linux-gnu/OMSimulator"
42
+ elif (sysconfig.get_platform() == "mingw_x86_64_ucrt" or (sysconfig.get_platform() == 'mingw' and platform.architecture()[0] == '64bit')):
43
+ url = 'https://build.openmodelica.org/omsimulator/nightly/win-mingw-ucrt64/OMSimulator-mingw-ucrt64-v3.0.0.post115-g47eeb55.zip'
44
+ dll_path = "bin/libOMSimulator.dll"
45
+ source_path = "lib/OMSimulator"
46
+ elif (sysconfig.get_platform() == 'win-amd64'):
47
+ url = 'https://build.openmodelica.org/omsimulator/nightly/win-msvc64/OMSimulator-win64-v3.0.0.post115-g47eeb55.zip'
48
+ dll_path = "bin/OMSimulator.dll"
49
+ source_path = "lib/OMSimulator"
50
+ elif (platform.system() == 'Darwin'):
51
+ url = 'https://build.openmodelica.org/omsimulator/nightly/osx/OMSimulator-osx-v3.0.0.post115-g47eeb55.zip'
52
+ dll_path = "lib/libOMSimulator.dylib"
53
+ ## the path needs to be checked, as of now we are not buiding artifacts for macos
54
+ source_path = "lib/OMSimulator"
55
+ else:
56
+ raise Exception("Platform not supported for {} ".format(sysconfig.get_platform()))
57
+
58
+ response = requests.get(url, verify=False)
59
+ if response.status_code != 200:
60
+ raise Exception(f"Failed to download {url}")
61
+
62
+ # Save temp file
63
+ temp_dir = tempfile.mkdtemp(dir=os.getcwd())
64
+ zip_file = os.path.join(temp_dir, os.path.basename(url))
65
+ with open(zip_file, "wb") as f:
66
+ f.write(response.content)
67
+
68
+ # Extract archive
69
+ extract_dir = os.path.join(temp_dir, "OMSimulator_extract")
70
+ if os.path.exists(extract_dir):
71
+ shutil.rmtree(extract_dir)
72
+
73
+ shutil.unpack_archive(zip_file, extract_dir)
74
+
75
+ # Copy package
76
+ shutil.copytree(os.path.join(extract_dir, source_path), target_dir, dirs_exist_ok=True)
77
+ # Copy schema if exists
78
+ schema_src = os.path.join(extract_dir, "share/OMSimulator/schema")
79
+ if os.path.exists(schema_src):
80
+ shutil.copytree(schema_src, os.path.join(target_dir, "schema"), dirs_exist_ok=True)
81
+ # Copy DLL
82
+ dll_src = os.path.join(extract_dir, dll_path)
83
+ if os.path.exists(dll_src):
84
+ shutil.copy2(dll_src, target_dir)
85
+
86
+ # Cleanup
87
+ shutil.rmtree(temp_dir)
88
+
89
+ def run(self):
90
+ if not self.dry_run:
91
+ self.fetch_oms()
92
+ super().run()
93
+
94
+
95
+ # --------------------------
96
+ # Standalone testing
97
+ # --------------------------
98
+ if __name__ == "__main__":
99
+ from setuptools import Distribution
100
+ dist = Distribution()
101
+ installer = OMSInstaller(dist)
102
+ installer.build_lib = os.getcwd()
103
+ installer.fetch_oms()
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["setuptools", "pip", "requests"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "OMSimulator"
7
+ version = "3.0.0.post115" # configure with actual version
8
+ description = "OMSimulator - the FMI-based co-simulation environment for Python"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Open Source Modelica Consortium (OSMC)", email = "openmodelicadevelopers@ida.liu.se" }
12
+ ]
13
+
14
+ license-files = ["OSMC-License.txt"]
15
+
16
+ requires-python = ">=3.10"
17
+
18
+ dependencies = [
19
+ "requests",
20
+ "lxml>=5.3.1"
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "http://openmodelica.org/"
25
+ Documentation = "https://openmodelica.org/doc/OMSimulator/master/OMSimulator/UsersGuide/html/"
26
+ "Source Code" = "https://github.com/OpenModelica/OMSimulator"
27
+ Issues = "https://github.com/OpenModelica/OMSimulator/issues"
28
+ "Release Notes" = "https://github.com/OpenModelica/OMSimulator/releases"
29
+ Download = "https://pypi.org/project/OMSimulator/#files"
30
+
31
+ [tool.setuptools]
32
+ packages = ["OMSimulator"] ## dynamically created
33
+ zip-safe = false
34
+
35
+ [tool.setuptools.cmdclass]
36
+ build_py = "build_helpers.OMSInstaller"
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: OMSimulator
3
- Version: 2.1.3
4
- Summary: OMSimulator - the FMI-based co-simulation environment for Python
5
- Home-page: http://openmodelica.org/
6
- Author: Open Source Modelica Consortium (OSMC)
7
- Author-email: openmodelicadevelopers@ida.liu.se
8
- License: BSD, OSMC-PL 1.2, GPL (user's choice)
9
- Platform: UNKNOWN
10
- Description-Content-Type: text/markdown
11
-
12
- # OMSimulator [![License: OSMC-PL](https://img.shields.io/badge/license-OSMC--PL-lightgrey.svg)](OSMC-License.txt)
13
-
14
- The OMSimulator project is a FMI-based co-simulation environment that supports ordinary (i.e., non-delayed) and TLM connections.
15
-
16
-
@@ -1 +0,0 @@
1
- requests
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: OMSimulator
3
- Version: 2.1.3
4
- Summary: OMSimulator - the FMI-based co-simulation environment for Python
5
- Home-page: http://openmodelica.org/
6
- Author: Open Source Modelica Consortium (OSMC)
7
- Author-email: openmodelicadevelopers@ida.liu.se
8
- License: BSD, OSMC-PL 1.2, GPL (user's choice)
9
- Platform: UNKNOWN
10
- Description-Content-Type: text/markdown
11
-
12
- # OMSimulator [![License: OSMC-PL](https://img.shields.io/badge/license-OSMC--PL-lightgrey.svg)](OSMC-License.txt)
13
-
14
- The OMSimulator project is a FMI-based co-simulation environment that supports ordinary (i.e., non-delayed) and TLM connections.
15
-
16
-
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
-
4
- __license__ = '''
5
- This file is part of OpenModelica.
6
- Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
7
- c/o Linköpings universitet, Department of Computer and Information Science,
8
- SE-58183 Linköping, Sweden.
9
- All rights reserved.
10
- THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
11
- THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
12
- ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13
- RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
14
- ACCORDING TO RECIPIENTS CHOICE.
15
- The OpenModelica software and the Open Source Modelica
16
- Consortium (OSMC) Public License (OSMC-PL) are obtained
17
- from OSMC, either from the above address,
18
- from the URLs: http://www.ida.liu.se/projects/OpenModelica or
19
- http://www.openmodelica.org, and in the OpenModelica distribution.
20
- GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
21
- This program is distributed WITHOUT ANY WARRANTY; without
22
- even the implied warranty of MERCHANTABILITY or FITNESS
23
- FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
24
- IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
25
- See the full OSMC Public License conditions for more details.
26
- '''
27
-
28
- __author__ = 'Open Source Modelica Consortium (OSMC)'
29
- __maintainer__ = 'https://openmodelica.org'
30
- __status__ = 'Production'
31
-
32
-
33
- import os
34
- import platform
35
- import shutil
36
- import sysconfig
37
- import tempfile
38
- from distutils.command.build_py import build_py
39
- from distutils.dir_util import copy_tree
40
- from distutils.file_util import copy_file
41
-
42
- from setuptools import setup
43
-
44
- ## check for requests package, if not found force install it through pip (e.g) "python -m pip install requests"
45
- try:
46
- import requests
47
- except ImportError as e:
48
- print(e.args, "Trying to install package \"requests\" from pip \"python -m pip install requests\"")
49
- import subprocess, sys
50
- subprocess.call([sys.executable,'-m', 'pip', 'install','requests'])
51
-
52
- # override build_py, for compiling and copying the dlls
53
- class my_build_py(build_py):
54
- def __init__(self, dist):
55
- # check if directory exist and remove
56
- topdir = os.path.join(os.getcwd(), 'OMSimulator')
57
- if os.path.isdir(topdir):
58
- os.rmdir(topdir)
59
-
60
- # recreate it, so that setuptools creates the package directory
61
- os.mkdir(topdir)
62
-
63
- build_py.__init__(self, dist)
64
-
65
- def fetch_oms(self):
66
- target_dir = os.path.join(self.build_lib, 'OMSimulator')
67
-
68
- # mkpath is a distutils helper to create directories
69
- self.mkpath(target_dir)
70
-
71
- # download the zip directory from url
72
- if (sysconfig.get_platform() == 'linux-x86_64'):
73
- response = requests.get('https://build.openmodelica.org/omsimulator/nightly/linux-amd64/OMSimulator-linux-amd64-v2.1.3.tar.gz', verify=False)
74
- dllpath = "lib/x86_64-linux-gnu/libOMSimulator.so"
75
- sourcePath = "lib/x86_64-linux-gnu/OMSimulator"
76
- elif (sysconfig.get_platform() == "mingw_x86_64_ucrt" or (sysconfig.get_platform() == 'mingw' and platform.architecture()[0] == '64bit')):
77
- response = requests.get('https://build.openmodelica.org/omsimulator/nightly/win-mingw-ucrt64/OMSimulator-mingw-ucrt64-v2.1.3.zip', verify=False)
78
- dllpath = "bin/libOMSimulator.dll"
79
- sourcePath = "lib/OMSimulator"
80
- elif (sysconfig.get_platform() == 'win-amd64'):
81
- response = requests.get('https://build.openmodelica.org/omsimulator/nightly/win-msvc64/OMSimulator-win64-v2.1.3.zip', verify=False)
82
- dllpath = "bin/OMSimulator.dll"
83
- sourcePath = "lib/OMSimulator"
84
- elif (platform.system() == 'Darwin'):
85
- response = requests.get('https://build.openmodelica.org/omsimulator/nightly/osx/OMSimulator-osx-v2.1.3.zip', verify=False)
86
- dllpath = "lib/libOMSimulator.dylib"
87
- ## the path needs to be checked, as of now we are not buiding artifacts for macos
88
- sourcePath = "lib/OMSimulator"
89
- else:
90
- raise Exception("Platform not supported for {} ".format(sysconfig.get_platform()))
91
-
92
- if response.status_code != 200:
93
- raise Exception("Downloading artifact failed for {} ".format(response.url))
94
-
95
- zipFileName = os.path.basename(response.url)
96
- dirname, extension = os.path.splitext(zipFileName)
97
-
98
- tempDir = tempfile.gettempdir()
99
- zipFilePath = os.path.join(tempDir, zipFileName)
100
-
101
- # remove zip file if exists
102
- if os.path.exists(zipFilePath):
103
- os.remove(zipFilePath)
104
-
105
- # copy the zip file in temp directory
106
- zipfile = open(zipFilePath, "wb")
107
- zipfile.write(response.content)
108
- zipfile.close()
109
-
110
- zipDir = os.path.join(tempDir, dirname)
111
- # remove zip directory if exists
112
- if os.path.isdir(zipDir):
113
- shutil.rmtree(zipDir)
114
-
115
- # unzip the zip file
116
- shutil.unpack_archive(zipFilePath, zipDir)
117
-
118
- # copy OMSimulator package to root directory
119
- copy_tree(os.path.join(zipDir, sourcePath), target_dir)
120
-
121
- # copy schema path to OMSimulator/schema
122
- copy_tree(os.path.join(zipDir, 'share/OMSimulator/schema'), target_dir +"/schema")
123
-
124
- # copy dll to root directory
125
- copy_file(os.path.join(zipDir, dllpath), target_dir)
126
-
127
- # remove the zip directory after copying the files
128
- shutil.rmtree(zipDir)
129
-
130
- # remove the zip file
131
- os.remove(zipFilePath)
132
-
133
- def run(self):
134
- if not self.dry_run:
135
- self.fetch_oms()
136
- build_py.run(self)
137
-
138
- with open('README.md', 'r') as fh:
139
- long_description = fh.read()
140
-
141
- setup(
142
- name = 'OMSimulator',
143
- version = 'v2.1.3',
144
- description = 'OMSimulator - the FMI-based co-simulation environment for Python',
145
- long_description = long_description,
146
- long_description_content_type = 'text/markdown',
147
- author = 'Open Source Modelica Consortium (OSMC)',
148
- author_email = 'openmodelicadevelopers@ida.liu.se',
149
- license = "BSD, OSMC-PL 1.2, GPL (user's choice)",
150
- url = 'http://openmodelica.org/',
151
- setup_requires = ['requests'],
152
- install_requires = ['requests'],
153
- packages = ['OMSimulator'],
154
- cmdclass = {'build_py': my_build_py},
155
- zip_safe = False
156
- )