f2py-cmake 0.1.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.
f2py_cmake/__init__.py ADDED
@@ -0,0 +1,11 @@
1
+ """
2
+ Copyright (c) 2024 Henry Schreiner. All rights reserved.
3
+
4
+ f2py-cmake: CMake helpers for building F2Py modules
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from ._version import version as __version__
10
+
11
+ __all__ = ["__version__"]
f2py_cmake/__main__.py ADDED
@@ -0,0 +1,34 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from pathlib import Path
5
+
6
+ from ._version import version as __version__
7
+ from .vendor import vendorize
8
+
9
+ __all__ = ["main"]
10
+
11
+
12
+ def __dir__() -> list[str]:
13
+ return __all__
14
+
15
+
16
+ def main() -> None:
17
+ """
18
+ Entry point.
19
+ """
20
+ parser = argparse.ArgumentParser(description="CMake F2Py module helper")
21
+ parser.add_argument(
22
+ "--version", action="version", version=f"%(prog)s {__version__}"
23
+ )
24
+ subparser = parser.add_subparsers(required=True)
25
+ vendor_parser = subparser.add_parser("vendor", help="Vendor CMake helpers")
26
+ vendor_parser.add_argument(
27
+ "target", type=Path, help="Directory to vendor the CMake helpers"
28
+ )
29
+ args = parser.parse_args()
30
+ vendorize(args.target)
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
f2py_cmake/_version.py ADDED
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '0.1.0'
16
+ __version_tuple__ = version_tuple = (0, 1, 0)
@@ -0,0 +1,4 @@
1
+ from __future__ import annotations
2
+
3
+ version: str
4
+ version_tuple: tuple[int, int, int] | tuple[int, int, int, str, str]
@@ -0,0 +1,125 @@
1
+ if(CMAKE_VERSION VERSION_LESS 3.17)
2
+ message(FATAL_ERROR "CMake 3.17+ required")
3
+ endif()
4
+
5
+ include_guard(GLOBAL)
6
+
7
+ if(TARGET Python::NumPy)
8
+ set(_Python Python)
9
+ elseif(TARGET Python3::NumPy)
10
+ set(_Python Python3)
11
+ else()
12
+ message(FATAL_ERROR "You must find Python or Python3 with the NumPy component before including F2PY!")
13
+ endif()
14
+
15
+ execute_process(
16
+ COMMAND "${${_Python}_EXECUTABLE}" -c
17
+ "import numpy.f2py; print(numpy.f2py.get_include())"
18
+ OUTPUT_VARIABLE F2PY_inc_output
19
+ ERROR_VARIABLE F2PY_inc_error
20
+ RESULT_VARIABLE F2PY_inc_result
21
+ OUTPUT_STRIP_TRAILING_WHITESPACE
22
+ ERROR_STRIP_TRAILING_WHITESPACE)
23
+
24
+ if(NOT F2PY_inc_result EQUAL 0)
25
+ message(FATAL_ERROR "Can't find f2py, got ${F2PY_inc_output} ${F2PY_inc_error}")
26
+ endif()
27
+
28
+ set(F2PY_INCLUDE_DIR "${F2PY_inc_output}" CACHE STRING "" FORCE)
29
+ set(F2PY_OBJECT_FILES "${F2PY_inc_output}/fortranobject.c;${F2PY_inc_output}/fortranobject.h" CACHE STRING "" FORCE)
30
+ mark_as_advanced(F2PY_INCLUDE_DIR F2PY_OBJECT_FILES)
31
+
32
+ add_library(F2Py::Headers IMPORTED INTERFACE)
33
+ target_include_directories(F2Py::Headers INTERFACE "${F2PY_INCLUDE_DIR}")
34
+
35
+ function(f2py_object_library NAME TYPE)
36
+ add_library(${NAME} ${TYPE} "${F2PY_INCLUDE_DIR}/fortranobject.c")
37
+ target_link_libraries(${NAME} PUBLIC ${_Python}::NumPy F2Py::Headers)
38
+ if("${TYPE}" STREQUAL "OBJECT")
39
+ set_property(TARGET ${NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
40
+ endif()
41
+ endfunction()
42
+
43
+ function(f2py_generate_module NAME)
44
+ cmake_parse_arguments(
45
+ PARSE_ARGV 1
46
+ F2PY
47
+ "NOLOWER;F77;F90"
48
+ "OUTPUT_DIR;OUTPUT_VARIABLE"
49
+ "F2PY_ARGS"
50
+ )
51
+ set(ALL_FILES ${F2PY_UNPARSED_ARGUMENTS})
52
+
53
+ if(NOT ALL_FILES)
54
+ message(FATAL_ERROR "One or more input files must be specified")
55
+ endif()
56
+
57
+ if(NOT F2PY_OUTPUT_DIR)
58
+ set(F2PY_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
59
+ endif()
60
+
61
+ if(NAME MATCHES "\\.pyf$")
62
+ set(_file_arg "${NAME}")
63
+ get_filename_component(NAME "${NAME}" NAME_WE)
64
+ else()
65
+ set(_file_arg -m ${NAME})
66
+ endif()
67
+
68
+ if(F2PY_F77 AND F2PY_F90)
69
+ message(FATAL_ERROR "Can't specify F77 and F90")
70
+ elseif(NOT F2PY_F77 AND NOT F2PY_F90)
71
+ set(HAS_F90_FILE FALSE)
72
+
73
+ foreach(file IN LISTS ALL_FILES)
74
+ if("${file}" MATCHES "\\.f90$")
75
+ set(HAS_F90_FILE TRUE)
76
+ break()
77
+ endif()
78
+ endforeach()
79
+
80
+ if(HAS_F90_FILE)
81
+ set(F2PY_F90 ON)
82
+ else()
83
+ set(F2PY_F77 ON)
84
+ endif()
85
+ endif()
86
+
87
+ if(F2PY_F77)
88
+ set(wrapper_files ${NAME}-f2pywrappers.f)
89
+ else()
90
+ set(wrapper_files ${NAME}-f2pywrappers.f ${NAME}-f2pywrappers2.f90)
91
+ endif()
92
+
93
+ if(F2PY_NOLOWER)
94
+ set(lower "--no-lower")
95
+ else()
96
+ set(lower "--lower")
97
+ endif()
98
+
99
+ set(abs_all_files)
100
+ foreach(file IN LISTS ALL_FILES)
101
+ if(IS_ABSOLUTE "${file}")
102
+ list(APPEND abs_all_files "${file}")
103
+ else()
104
+ list(APPEND abs_all_files "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
105
+ endif()
106
+ endforeach()
107
+
108
+ add_custom_command(
109
+ OUTPUT ${NAME}module.c ${wrapper_files}
110
+ DEPENDS ${ALL_FILES}
111
+ VERBATIM
112
+ COMMAND
113
+ "${${_Python}_EXECUTABLE}" -m numpy.f2py
114
+ "${abs_all_files}" ${_file_arg} ${lower} ${F2PY_F2PY_ARGS}
115
+ COMMAND
116
+ "${CMAKE_COMMAND}" -E touch ${wrapper_files}
117
+ WORKING_DIRECTORY "${F2PY_OUTPUT_DIR}"
118
+ COMMENT
119
+ "F2PY making ${NAME} wrappers"
120
+ )
121
+
122
+ if(F2PY_OUTPUT_VARIABLE)
123
+ set(${F2PY_OUTPUT_VARIABLE} ${NAME}module.c ${wrapper_files} PARENT_SCOPE)
124
+ endif()
125
+ endfunction()
File without changes
f2py_cmake/py.typed ADDED
File without changes
f2py_cmake/vendor.py ADDED
@@ -0,0 +1,30 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ if sys.version_info < (3, 9):
7
+ from importlib_resources import files
8
+ else:
9
+ from importlib.resources import files
10
+
11
+ __all__ = ["vendorize"]
12
+
13
+
14
+ def __dir__() -> list[str]:
15
+ return __all__
16
+
17
+
18
+ def vendorize(target: Path) -> None:
19
+ """
20
+ Vendorize files into a directory. Directory must exist.
21
+ """
22
+ if not target.is_dir():
23
+ msg = f"Target directory {target} does not exist"
24
+ raise AssertionError(msg)
25
+
26
+ cmake_dir = files("f2py_cmake") / "cmake"
27
+
28
+ use = cmake_dir / "UseF2Py.cmake"
29
+ use_target = target / "UseF2Py.cmake"
30
+ use_target.write_text(use.read_text(encoding="utf-8"), encoding="utf-8")
@@ -0,0 +1,343 @@
1
+ Metadata-Version: 2.3
2
+ Name: f2py-cmake
3
+ Version: 0.1.0
4
+ Summary: CMake helpers for building F2Py modules
5
+ Project-URL: Homepage, https://github.com/scikit-build/f2py-cmake
6
+ Project-URL: Bug Tracker, https://github.com/scikit-build/f2py-cmake/issues
7
+ Project-URL: Discussions, https://github.com/scikit-build/f2py-cmake/discussions
8
+ Project-URL: Changelog, https://github.com/scikit-build/f2py-cmake/releases
9
+ Author-email: Henry Schreiner <henryfs@princeton.edu>
10
+ License:
11
+ Apache License
12
+ Version 2.0, January 2004
13
+ http://www.apache.org/licenses/
14
+
15
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
16
+
17
+ 1. Definitions.
18
+
19
+ "License" shall mean the terms and conditions for use, reproduction,
20
+ and distribution as defined by Sections 1 through 9 of this document.
21
+
22
+ "Licensor" shall mean the copyright owner or entity authorized by
23
+ the copyright owner that is granting the License.
24
+
25
+ "Legal Entity" shall mean the union of the acting entity and all
26
+ other entities that control, are controlled by, or are under common
27
+ control with that entity. For the purposes of this definition,
28
+ "control" means (i) the power, direct or indirect, to cause the
29
+ direction or management of such entity, whether by contract or
30
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
31
+ outstanding shares, or (iii) beneficial ownership of such entity.
32
+
33
+ "You" (or "Your") shall mean an individual or Legal Entity
34
+ exercising permissions granted by this License.
35
+
36
+ "Source" form shall mean the preferred form for making modifications,
37
+ including but not limited to software source code, documentation
38
+ source, and configuration files.
39
+
40
+ "Object" form shall mean any form resulting from mechanical
41
+ transformation or translation of a Source form, including but
42
+ not limited to compiled object code, generated documentation,
43
+ and conversions to other media types.
44
+
45
+ "Work" shall mean the work of authorship, whether in Source or
46
+ Object form, made available under the License, as indicated by a
47
+ copyright notice that is included in or attached to the work
48
+ (an example is provided in the Appendix below).
49
+
50
+ "Derivative Works" shall mean any work, whether in Source or Object
51
+ form, that is based on (or derived from) the Work and for which the
52
+ editorial revisions, annotations, elaborations, or other modifications
53
+ represent, as a whole, an original work of authorship. For the purposes
54
+ of this License, Derivative Works shall not include works that remain
55
+ separable from, or merely link (or bind by name) to the interfaces of,
56
+ the Work and Derivative Works thereof.
57
+
58
+ "Contribution" shall mean any work of authorship, including
59
+ the original version of the Work and any modifications or additions
60
+ to that Work or Derivative Works thereof, that is intentionally
61
+ submitted to Licensor for inclusion in the Work by the copyright owner
62
+ or by an individual or Legal Entity authorized to submit on behalf of
63
+ the copyright owner. For the purposes of this definition, "submitted"
64
+ means any form of electronic, verbal, or written communication sent
65
+ to the Licensor or its representatives, including but not limited to
66
+ communication on electronic mailing lists, source code control systems,
67
+ and issue tracking systems that are managed by, or on behalf of, the
68
+ Licensor for the purpose of discussing and improving the Work, but
69
+ excluding communication that is conspicuously marked or otherwise
70
+ designated in writing by the copyright owner as "Not a Contribution."
71
+
72
+ "Contributor" shall mean Licensor and any individual or Legal Entity
73
+ on behalf of whom a Contribution has been received by Licensor and
74
+ subsequently incorporated within the Work.
75
+
76
+ 2. Grant of Copyright License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ copyright license to reproduce, prepare Derivative Works of,
80
+ publicly display, publicly perform, sublicense, and distribute the
81
+ Work and such Derivative Works in Source or Object form.
82
+
83
+ 3. Grant of Patent License. Subject to the terms and conditions of
84
+ this License, each Contributor hereby grants to You a perpetual,
85
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
86
+ (except as stated in this section) patent license to make, have made,
87
+ use, offer to sell, sell, import, and otherwise transfer the Work,
88
+ where such license applies only to those patent claims licensable
89
+ by such Contributor that are necessarily infringed by their
90
+ Contribution(s) alone or by combination of their Contribution(s)
91
+ with the Work to which such Contribution(s) was submitted. If You
92
+ institute patent litigation against any entity (including a
93
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
94
+ or a Contribution incorporated within the Work constitutes direct
95
+ or contributory patent infringement, then any patent licenses
96
+ granted to You under this License for that Work shall terminate
97
+ as of the date such litigation is filed.
98
+
99
+ 4. Redistribution. You may reproduce and distribute copies of the
100
+ Work or Derivative Works thereof in any medium, with or without
101
+ modifications, and in Source or Object form, provided that You
102
+ meet the following conditions:
103
+
104
+ (a) You must give any other recipients of the Work or
105
+ Derivative Works a copy of this License; and
106
+
107
+ (b) You must cause any modified files to carry prominent notices
108
+ stating that You changed the files; and
109
+
110
+ (c) You must retain, in the Source form of any Derivative Works
111
+ that You distribute, all copyright, patent, trademark, and
112
+ attribution notices from the Source form of the Work,
113
+ excluding those notices that do not pertain to any part of
114
+ the Derivative Works; and
115
+
116
+ (d) If the Work includes a "NOTICE" text file as part of its
117
+ distribution, then any Derivative Works that You distribute must
118
+ include a readable copy of the attribution notices contained
119
+ within such NOTICE file, excluding those notices that do not
120
+ pertain to any part of the Derivative Works, in at least one
121
+ of the following places: within a NOTICE text file distributed
122
+ as part of the Derivative Works; within the Source form or
123
+ documentation, if provided along with the Derivative Works; or,
124
+ within a display generated by the Derivative Works, if and
125
+ wherever such third-party notices normally appear. The contents
126
+ of the NOTICE file are for informational purposes only and
127
+ do not modify the License. You may add Your own attribution
128
+ notices within Derivative Works that You distribute, alongside
129
+ or as an addendum to the NOTICE text from the Work, provided
130
+ that such additional attribution notices cannot be construed
131
+ as modifying the License.
132
+
133
+ You may add Your own copyright statement to Your modifications and
134
+ may provide additional or different license terms and conditions
135
+ for use, reproduction, or distribution of Your modifications, or
136
+ for any such Derivative Works as a whole, provided Your use,
137
+ reproduction, and distribution of the Work otherwise complies with
138
+ the conditions stated in this License.
139
+
140
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
141
+ any Contribution intentionally submitted for inclusion in the Work
142
+ by You to the Licensor shall be under the terms and conditions of
143
+ this License, without any additional terms or conditions.
144
+ Notwithstanding the above, nothing herein shall supersede or modify
145
+ the terms of any separate license agreement you may have executed
146
+ with Licensor regarding such Contributions.
147
+
148
+ 6. Trademarks. This License does not grant permission to use the trade
149
+ names, trademarks, service marks, or product names of the Licensor,
150
+ except as required for reasonable and customary use in describing the
151
+ origin of the Work and reproducing the content of the NOTICE file.
152
+
153
+ 7. Disclaimer of Warranty. Unless required by applicable law or
154
+ agreed to in writing, Licensor provides the Work (and each
155
+ Contributor provides its Contributions) on an "AS IS" BASIS,
156
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
157
+ implied, including, without limitation, any warranties or conditions
158
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
159
+ PARTICULAR PURPOSE. You are solely responsible for determining the
160
+ appropriateness of using or redistributing the Work and assume any
161
+ risks associated with Your exercise of permissions under this License.
162
+
163
+ 8. Limitation of Liability. In no event and under no legal theory,
164
+ whether in tort (including negligence), contract, or otherwise,
165
+ unless required by applicable law (such as deliberate and grossly
166
+ negligent acts) or agreed to in writing, shall any Contributor be
167
+ liable to You for damages, including any direct, indirect, special,
168
+ incidental, or consequential damages of any character arising as a
169
+ result of this License or out of the use or inability to use the
170
+ Work (including but not limited to damages for loss of goodwill,
171
+ work stoppage, computer failure or malfunction, or any and all
172
+ other commercial damages or losses), even if such Contributor
173
+ has been advised of the possibility of such damages.
174
+
175
+ 9. Accepting Warranty or Additional Liability. While redistributing
176
+ the Work or Derivative Works thereof, You may choose to offer,
177
+ and charge a fee for, acceptance of support, warranty, indemnity,
178
+ or other liability obligations and/or rights consistent with this
179
+ License. However, in accepting such obligations, You may act only
180
+ on Your own behalf and on Your sole responsibility, not on behalf
181
+ of any other Contributor, and only if You agree to indemnify,
182
+ defend, and hold each Contributor harmless for any liability
183
+ incurred by, or claims asserted against, such Contributor by reason
184
+ of your accepting any such warranty or additional liability.
185
+
186
+ END OF TERMS AND CONDITIONS
187
+
188
+ APPENDIX: How to apply the Apache License to your work.
189
+
190
+ To apply the Apache License to your work, attach the following
191
+ boilerplate notice, with the fields enclosed by brackets "[]"
192
+ replaced with your own identifying information. (Don't include
193
+ the brackets!) The text should be enclosed in the appropriate
194
+ comment syntax for the file format. We also recommend that a
195
+ file or class name and description of purpose be included on the
196
+ same "printed page" as the copyright notice for easier
197
+ identification within third-party archives.
198
+
199
+ Copyright [yyyy] [name of copyright owner]
200
+
201
+ Licensed under the Apache License, Version 2.0 (the "License");
202
+ you may not use this file except in compliance with the License.
203
+ You may obtain a copy of the License at
204
+
205
+ http://www.apache.org/licenses/LICENSE-2.0
206
+
207
+ Unless required by applicable law or agreed to in writing, software
208
+ distributed under the License is distributed on an "AS IS" BASIS,
209
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
210
+ See the License for the specific language governing permissions and
211
+ limitations under the License.
212
+ License-File: LICENSE
213
+ Classifier: Development Status :: 1 - Planning
214
+ Classifier: Intended Audience :: Developers
215
+ Classifier: Intended Audience :: Science/Research
216
+ Classifier: License :: OSI Approved :: Apache Software License
217
+ Classifier: Operating System :: OS Independent
218
+ Classifier: Programming Language :: Python
219
+ Classifier: Programming Language :: Python :: 3
220
+ Classifier: Programming Language :: Python :: 3 :: Only
221
+ Classifier: Programming Language :: Python :: 3.8
222
+ Classifier: Programming Language :: Python :: 3.9
223
+ Classifier: Programming Language :: Python :: 3.10
224
+ Classifier: Programming Language :: Python :: 3.11
225
+ Classifier: Programming Language :: Python :: 3.12
226
+ Classifier: Topic :: Scientific/Engineering
227
+ Classifier: Typing :: Typed
228
+ Requires-Python: >=3.8
229
+ Requires-Dist: importlib-resources; python_version < '3.9'
230
+ Provides-Extra: docs
231
+ Requires-Dist: furo>=2023.08.17; extra == 'docs'
232
+ Requires-Dist: myst-parser>=0.13; extra == 'docs'
233
+ Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
234
+ Requires-Dist: sphinx-copybutton; extra == 'docs'
235
+ Requires-Dist: sphinx>=7.0; extra == 'docs'
236
+ Provides-Extra: test
237
+ Requires-Dist: numpy; extra == 'test'
238
+ Requires-Dist: pytest>=6; extra == 'test'
239
+ Requires-Dist: scikit-build-core; extra == 'test'
240
+ Description-Content-Type: text/markdown
241
+
242
+ # f2py-cmake
243
+
244
+ [![Actions Status][actions-badge]][actions-link]
245
+
246
+ <!--
247
+ [![Documentation Status][rtd-badge]][rtd-link]
248
+ -->
249
+
250
+ [![PyPI version][pypi-version]][pypi-link]
251
+ [![PyPI platforms][pypi-platforms]][pypi-link]
252
+
253
+ <!--
254
+ [![GitHub Discussion][github-discussions-badge]][github-discussions-link]
255
+ -->
256
+
257
+ <!-- SPHINX-START -->
258
+
259
+ This provides helpers for using F2Py. Use:
260
+
261
+ ```cmake
262
+ include(UseF2Py)
263
+ ```
264
+
265
+ You must have found a Python interpreter beforehand. This will define a
266
+ `F2Py::F2Py` target (along with a matching `F2PY_EXECUTABLE` variable). It will
267
+ also provide the following helper functions:
268
+
269
+ ```cmake
270
+ f2py_object_library(<name> <type>)
271
+
272
+ f2py_generate_module(<module> <files>...
273
+ [F2PY_ARGS <args> ...]
274
+ [F77 | F90]
275
+ [NOLOWER]
276
+ [OUTPUT_DIR <OutputDir>]
277
+ [OUTPUT_VARIABLE <OutputVariable>]
278
+ )
279
+ ```
280
+
281
+ ## Example
282
+
283
+ ```cmake
284
+ find_package(
285
+ Python
286
+ COMPONENTS Interpreter Development.Module NumPy
287
+ REQUIRED)
288
+
289
+ include(UseF2Py)
290
+
291
+ # Create the F2Py `numpyobject` library.
292
+ f2py_object_library(f2py_object OBJECT)
293
+
294
+ f2py_generate_module(fibby fib1.f OUTPUT_VARIABLE fibby_files)
295
+
296
+ python_add_library(fibby MODULE "${fibby_files}" WITH_SOABI)
297
+ target_link_library(fibby PRIVATE f2py_object)
298
+ ```
299
+
300
+ ## scikit-build-core
301
+
302
+ To use this package with scikit-build-core, you need to include it in your build
303
+ requirements:
304
+
305
+ ```toml
306
+ [build-system]
307
+ requires = ["scikit-build-core", "numpy", "f2py-cmake"]
308
+ build-backend = "scikit_build_core.build"
309
+ ```
310
+
311
+ ## Vendoring
312
+
313
+ You can vendor UseF2Py into your package, as well. This avoids requiring a
314
+ dependency at build time and protects you against changes in this package, at
315
+ the expense of requiring manual re-vendoring to get bugfixes and/or
316
+ improvements. This mechanism is also ideal if you want to support direct builds,
317
+ outside of scikit-build-core.
318
+
319
+ You should make a CMake helper directory, such as `cmake`. Add this to your
320
+ `CMakeLists.txt` like this:
321
+
322
+ ```cmake
323
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
324
+ ```
325
+
326
+ Then, you can vendor our file into that folder:
327
+
328
+ ```bash
329
+ pipx run f2py-cmake vendor cmake
330
+ ```
331
+
332
+ <!-- prettier-ignore-start -->
333
+ [actions-badge]: https://github.com/scikit-build/f2py-cmake/workflows/CI/badge.svg
334
+ [actions-link]: https://github.com/scikit-build/f2py-cmake/actions
335
+ [github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
336
+ [github-discussions-link]: https://github.com/scikit-build/f2py-cmake/discussions
337
+ [pypi-link]: https://pypi.org/project/f2py-cmake/
338
+ [pypi-platforms]: https://img.shields.io/pypi/pyversions/f2py-cmake
339
+ [pypi-version]: https://img.shields.io/pypi/v/f2py-cmake
340
+ [rtd-badge]: https://readthedocs.org/projects/f2py-cmake/badge/?version=latest
341
+ [rtd-link]: https://f2py-cmake.readthedocs.io/en/latest/?badge=latest
342
+
343
+ <!-- prettier-ignore-end -->
@@ -0,0 +1,13 @@
1
+ f2py_cmake/__init__.py,sha256=5uQdvLGduiY23bIOAw7iEIT0jdZ159BHAQboPBH4EjQ,227
2
+ f2py_cmake/__main__.py,sha256=sJJCdS5EaO5FlIHh6p9yBS9FoQ_gERzr1fkQm4FZSAI,801
3
+ f2py_cmake/_version.py,sha256=IMl2Pr_Sy4LVRKy_Sm4CdwUl1Gryous6ncL96EMYsnM,411
4
+ f2py_cmake/_version.pyi,sha256=j5kbzfm6lOn8BzASXWjGIA1yT0OlHTWqlbyZ8Si_o0E,118
5
+ f2py_cmake/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ f2py_cmake/vendor.py,sha256=hFh86pTcp4XtT-0545h_RCJ6lSb_2wKCosFL-JT6Ql0,707
7
+ f2py_cmake/cmake/UseF2Py.cmake,sha256=cGgVVXgrVtiOfU8w72Uyxo_fBEz_4wEwAdsi0t_fp2Y,3475
8
+ f2py_cmake/cmake/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ f2py_cmake-0.1.0.dist-info/METADATA,sha256=DaYQ-5cqF9T5gWH37nuhBtOHVn_dcGNgao8B_TBg-dM,17690
10
+ f2py_cmake-0.1.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
11
+ f2py_cmake-0.1.0.dist-info/entry_points.txt,sha256=LyaaFR_AgGv62kbp4lD5kCR0htkGI9SmG2IdmvtHjM0,95
12
+ f2py_cmake-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
13
+ f2py_cmake-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.25.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ f2py-cmake = f2py_cmake.__main__:main
3
+
4
+ [cmake.module]
5
+ any = f2py_cmake.cmake
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.