pythonfmu3 0.1.17__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
pythonfmu3/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.17"
1
+ __version__ = "0.2.0"
pythonfmu3/builder.py CHANGED
@@ -66,7 +66,7 @@ class FmuBuilder:
66
66
  dest: FilePath = ".",
67
67
  project_files: Iterable[FilePath] = set(),
68
68
  documentation_folder: Optional[FilePath] = None,
69
- terminals_folder: Optional[FilePath] = None,
69
+ terminals : Optional[FilePath] = None,
70
70
  **options,
71
71
  ) -> Path:
72
72
  script_file = Path(script_file)
@@ -87,11 +87,15 @@ class FmuBuilder:
87
87
  f"The documentation folder does not exists {documentation_folder!s}"
88
88
  )
89
89
 
90
- if terminals_folder is not None:
91
- terminals_folder = Path(terminals_folder)
92
- if not terminals_folder.exists():
90
+ if terminals is not None:
91
+ terminals = Path(terminals)
92
+ if not terminals.exists():
93
93
  raise ValueError(
94
- f"The terminals folder does not exists {terminals_folder!s}"
94
+ f"The specified terminalsAndIcons file does not exists {terminals!s}"
95
+ )
96
+ if not terminals.name == "terminalsAndIcons.xml":
97
+ raise ValueError(
98
+ f"Incorrect terminal name {terminals!s}. Terminal file must be named terminalsAndIcons.xml"
95
99
  )
96
100
 
97
101
  module_name = script_file.stem
@@ -186,12 +190,10 @@ class FmuBuilder:
186
190
  relative_f = f.relative_to(documentation_folder)
187
191
  zip_fmu.write(f, arcname=(documentation / relative_f))
188
192
 
189
- if terminals_folder is not None:
190
- terminals = Path("terminalsAndIcons")
191
- for f in terminals_folder.rglob("*.xml"):
192
- if f.is_file():
193
- relative_f = f.relative_to(terminals_folder)
194
- zip_fmu.write(f, arcname=(terminals / relative_f))
193
+ if terminals is not None:
194
+ terminalsFolder = Path("terminalsAndIcons")
195
+ relative_f = terminals.relative_to(terminals.parent)
196
+ zip_fmu.write(f, arcname=(terminalsFolder / relative_f))
195
197
 
196
198
 
197
199
  # Add the model description
@@ -233,8 +235,8 @@ def create_command_parser(parser: argparse.ArgumentParser):
233
235
 
234
236
  parser.add_argument(
235
237
  "--terminals",
236
- dest="terminals_folder",
237
- help="Folder containing terminals to include in the FMU.",
238
+ dest="terminals",
239
+ help="Terminals file (terminalsAndIcons.xml) to include in the FMU.",
238
240
  default=None
239
241
  )
240
242
 
@@ -26,10 +26,11 @@ target_include_directories(pythonfmu-export
26
26
  "${CMAKE_CURRENT_SOURCE_DIR}"
27
27
  )
28
28
 
29
- target_link_libraries(pythonfmu-export
30
- PRIVATE
31
- ${Python3_LIBRARIES}
32
- )
29
+ if (WIN32)
30
+ target_link_libraries(pythonfmu-export PRIVATE ${Python3_LIBRARIES})
31
+ elseif (APPLE)
32
+ set_target_properties(pythonfmu-export PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
33
+ endif ()
33
34
 
34
35
  if (WIN32)
35
36
  set_target_properties(pythonfmu-export
@@ -183,16 +183,13 @@ def test_terminals(tmp_path):
183
183
  def build():
184
184
  with tempfile.TemporaryDirectory() as terminals_dir:
185
185
  terminals_dir = Path(terminals_dir)
186
- terminal1 = terminals_dir / "terminal1.xml"
187
- terminal1.write_text("Dummy Terminal 1")
186
+ terminals = terminals_dir / "terminalsAndIcons.xml"
187
+ terminals.write_text("Dummy Terminal 1")
188
188
 
189
- terminal2 = terminals_dir / "terminal2.xml"
190
- terminal2.write_text("Dummy Terminal 2")
191
- return FmuBuilder.build_FMU(script_file, dest=tmp_path, terminals_folder=terminals_dir)
189
+ return FmuBuilder.build_FMU(script_file, dest=tmp_path, terminals=terminals)
192
190
 
193
191
  fmu = build()
194
192
  with zipfile.ZipFile(fmu) as files:
195
193
  names = files.namelist()
196
194
 
197
- assert "terminalsAndIcons/terminal1.xml" in names
198
- assert "terminalsAndIcons/terminal2.xml" in names
195
+ assert "terminalsAndIcons/terminalsAndIcons.xml" in names
@@ -2,6 +2,7 @@ MIT License
2
2
 
3
3
  Copyright (c) 2019-2020 NTNU - Department of Ocean Operations and Civil Engineering
4
4
  Copyright (c) 2019-2020 Safran SA
5
+ Copyright (c) 2023 Stephen Smith
5
6
 
6
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
8
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pythonfmu3
3
- Version: 0.1.17
3
+ Version: 0.2.0
4
4
  Summary: A lightweight framework that enables the packaging of Python3.x code as co-simulation FMUs.
5
5
  Home-page: https://github.com/stephensmith25/PythonFMU3
6
6
  Author: Stephen Smith
@@ -62,7 +62,7 @@ pip install pythonfmu3
62
62
  3. Run `pythonfmu3 build` to create the fmu.
63
63
 
64
64
  ```
65
- usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--terminals TERMINALS_FOLDER] [--no-external-tool]
65
+ usage: pythonfmu3 build [-h] -f SCRIPT_FILE [-d DEST] [--doc DOCUMENTATION_FOLDER] [--terminals TERMINALS_FILE] [--no-external-tool]
66
66
  [--no-variable-step] [--interpolate-inputs] [--only-one-per-process] [--handle-state]
67
67
  [--serialize-state] [--use-memory-management]
68
68
  [Project files [Project files ...]]
@@ -79,8 +79,8 @@ optional arguments:
79
79
  -d DEST, --dest DEST Where to save the FMU.
80
80
  --doc DOCUMENTATION_FOLDER
81
81
  Documentation folder to include in the FMU.
82
- --terminals TERMINALS_FOLDER
83
- Folder of terminals to include in the FMU.
82
+ --terminals TERMINALS_FILE
83
+ Terminals file (terminalsAndIcons.xml) to include in the FMU.
84
84
  --no-external-tool If given, needsExecutionTool=false
85
85
  --no-variable-step If given, canHandleVariableCommunicationStepSize=false
86
86
  --interpolate-inputs If given, canInterpolateInputs=true
@@ -1,7 +1,7 @@
1
1
  pythonfmu3/__init__.py,sha256=oN-2oXyCFwq0gvL2IEf5QvwIXBXZgsSBwAJw7LZ9vzc,424
2
2
  pythonfmu3/__main__.py,sha256=gC1T8x2d02hhqshyNQGSS70SyCk-3I3t8zPqoRo2Xd8,1543
3
- pythonfmu3/_version.py,sha256=BzIjnki8Bz3evNWo6bjGxxpLhy_tN9MRYhtM0MnDiWs,23
4
- pythonfmu3/builder.py,sha256=ZW-ig7GkWlwGrQ3z8wVsL6j7S6bynWLtL50Sw__M_og,9679
3
+ pythonfmu3/_version.py,sha256=Zn1KFblwuFHiDRdRAiRnDBRkbPttWh44jKa5zG2ov0E,22
4
+ pythonfmu3/builder.py,sha256=d_nTRWKohZrZsMbTmxiYJzszzVBp-CRisV_y_OVyW6U,9779
5
5
  pythonfmu3/default_experiment.py,sha256=FJ0l0FpU7pT4Pox2RiA2y-Cb_e7DE2XlbWKySRYQaVk,293
6
6
  pythonfmu3/deploy.py,sha256=eqFWVxZUkJCLvmq1-GuMNjn2j0VCGoaXPhRWrCk2Vxg,3741
7
7
  pythonfmu3/enums.py,sha256=ZmC6vGeBTGt7HarPQ4uYV10ezPsvIxAHH1ypjNq7G3E,729
@@ -15,7 +15,7 @@ pythonfmu3/pythonfmu-export/.clang-format,sha256=ApbsHWYwilCXJ1iBux4nqOjLkaqgbGL
15
15
  pythonfmu3/pythonfmu-export/CMakeLists.txt,sha256=p0-4Xh_sAaOI9AVb8lsUsMxJPc6bg9b_6CF6NJt5FHE,1847
16
16
  pythonfmu3/pythonfmu-export/build_unix.sh,sha256=I5RrF2O6y0hRG_SN4ExKN_CCFYaa2l-ngKzqmBXnHmA,73
17
17
  pythonfmu3/pythonfmu-export/build_win.sh,sha256=UzmAcWqFmwBu6mvYne2Dx3UK8iPwTtP4HpjICsjUaJA,97
18
- pythonfmu3/pythonfmu-export/src/CMakeLists.txt,sha256=RyjGhUUDhG_HEieCdt5WMfTR1snofOqigEKc83_zvfE,1104
18
+ pythonfmu3/pythonfmu-export/src/CMakeLists.txt,sha256=fOVlV7hy9c0wx_Qp4K51tQaQ5xy9lL4qtyGl15ZXfGs,1208
19
19
  pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp,sha256=cgrlZa5L-bbjZeVi0pmy4JKE5UJ2GszzuyOqTdRcBRQ,4353
20
20
  pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.cpp,sha256=EsUIevwmCzX9hsui3i8x1crSnSOG8dEK15Zm1ZIavYQ,3843
21
21
  pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_cs.hpp,sha256=UmqAVAVE1KHNHMC8mIh8gIHRJ_aQk0Ma139TU6Kvv4o,6264
@@ -27,11 +27,11 @@ pythonfmu3/pythonfmu-export/src/pythonfmu/IPyState.hpp,sha256=GLiOjhKLDVEICersnq
27
27
  pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.cpp,sha256=MpEUUcxPwoJlM_mW-9qxj4ezgKQd-CkDc2ud0mM7HbQ,25362
28
28
  pythonfmu3/pythonfmu-export/src/pythonfmu/PySlaveInstance.hpp,sha256=T-epGp68SjhDv-JupxUe2ZgnV8unU4htc-PUBokjWm4,4239
29
29
  pythonfmu3/pythonfmu-export/src/pythonfmu/PyState.hpp,sha256=CjFEIrZu8b1jxQAIgfI_o36hyItW_SdQ5VSkImf7JNs,2977
30
- pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so,sha256=LLTlb6TDjJ24xuy7zhO5Sbj39nVzQSODkkXMXGl8Y7s,365224
31
- pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll,sha256=b22hsx-MKU7vhYcbLViGyAfd0Jxv29sx0mxtWO3S7u0,430592
30
+ pythonfmu3/resources/binaries/x86_64-linux/libpythonfmu-export.so,sha256=GBI4GQSCJn1YWkPWIIP9w5tAkyF7DM8aCwoNi-WygEc,365224
31
+ pythonfmu3/resources/binaries/x86_64-windows/pythonfmu-export.dll,sha256=qMK-U8CTplgA2sgu-EHF5kzTeM3Vq5DeWzdtXiO7Tgw,430592
32
32
  pythonfmu3/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  pythonfmu3/tests/conftest.py,sha256=B6XxTnBdeF_tEJ3w2DlfPKUfvlk-oULgIhQtXkgOJIc,171
34
- pythonfmu3/tests/test_builder.py,sha256=gxelTXyk03VreAy5ptQRQtl20IstO9eWTifTSvTceiE,7004
34
+ pythonfmu3/tests/test_builder.py,sha256=GrD4ziin3RLOe_36rBQCMnKrSkhc3IqnxE1a6kCFPok,6842
35
35
  pythonfmu3/tests/test_deploy.py,sha256=JCDo-O93-izxrP9Q4K0njBcfZ-gAXYx9aZ4plgctz7k,1783
36
36
  pythonfmu3/tests/test_fmi3slave.py,sha256=1uwTdfiFZNmU0yzIdC30kAuu95xsZSTMA9CGk_Kdmm4,4304
37
37
  pythonfmu3/tests/test_integration.py,sha256=zA3iJ4rI2cKEE8mDsAmcVuwNWlJzhonV8Wxz92hzEac,10387
@@ -46,9 +46,9 @@ pythonfmu3/tests/slaves/localmodule.py,sha256=-q5Lmh2I88MG7nLTscms0n5xhHLkUDed1I
46
46
  pythonfmu3/tests/slaves/pythonslave.py,sha256=uzrTQmfk0QBalxNTviGMZNph_YgVmcbxPqKgX5rSvXg,2172
47
47
  pythonfmu3/tests/slaves/pythonslave_read_file.py,sha256=t2sDaZSr2veD91gdqCO9W9CN-AN3TyXABXXfV9Rt0Xs,791
48
48
  pythonfmu3/tests/slaves/slavewithdep.py,sha256=hHDFB0dw8wkHiGzxeAVbz9O5LR6ghsFeONgRFdiK_t0,812
49
- pythonfmu3-0.1.17.dist-info/LICENSE,sha256=24Cw_MPouLK-G_t8Hgjm59IS9BnPoL6SKkyuZ0xesXY,1155
50
- pythonfmu3-0.1.17.dist-info/METADATA,sha256=JnvWnoH6HzMnzQiBmd6P9J5goxKpqPdGYQcMO4Aalo4,7571
51
- pythonfmu3-0.1.17.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
52
- pythonfmu3-0.1.17.dist-info/entry_points.txt,sha256=GgkWYs0DKGHLcijMEYZGkhkHOK2RVUpjGwvl1fwyDwQ,60
53
- pythonfmu3-0.1.17.dist-info/top_level.txt,sha256=6ne7bh_cME1hepxCx1BG8N5QVhVAufrp7LLok6vq7nE,11
54
- pythonfmu3-0.1.17.dist-info/RECORD,,
49
+ pythonfmu3-0.2.0.dist-info/LICENSE,sha256=RL2018BU2DKcTi8Eb4ODF-XF3wnr7SDKvMP5S49x4rQ,1188
50
+ pythonfmu3-0.2.0.dist-info/METADATA,sha256=zPN-qU7jEfwtV4RAcYRXCMhpmrFJ9owZxfueBZVTdRQ,7585
51
+ pythonfmu3-0.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
52
+ pythonfmu3-0.2.0.dist-info/entry_points.txt,sha256=GgkWYs0DKGHLcijMEYZGkhkHOK2RVUpjGwvl1fwyDwQ,60
53
+ pythonfmu3-0.2.0.dist-info/top_level.txt,sha256=6ne7bh_cME1hepxCx1BG8N5QVhVAufrp7LLok6vq7nE,11
54
+ pythonfmu3-0.2.0.dist-info/RECORD,,