-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3711 from nilsvu/py_main_entry
Add a main entry point to the Python package
- Loading branch information
Showing
11 changed files
with
130 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Distributed under the MIT License. | ||
# See LICENSE.txt for details. | ||
|
||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Distributed under the MIT License. | ||
# See LICENSE.txt for details. | ||
|
||
[metadata] | ||
name = spectre | ||
version = @SPECTRE_VERSION@ | ||
description = Python bindings for SpECTRE | ||
author = SXS collaboration | ||
url = @SPECTRE_HOMEPAGE@ | ||
license = MIT | ||
|
||
[options] | ||
packages = find: | ||
install_requires = | ||
h5py >= 3.0.0 | ||
numpy | ||
scipy | ||
|
||
[options.package_data] | ||
# Install Python bindings libs alongside the Python code | ||
* = *.so | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
spectre = spectre.__main__:main |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Distributed under the MIT License. | ||
# See LICENSE.txt for details. | ||
|
||
SPECTRE_VERSION = "@SPECTRE_VERSION@" | ||
|
||
|
||
def main(): | ||
import argparse | ||
|
||
class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter, | ||
argparse.RawDescriptionHelpFormatter): | ||
pass | ||
|
||
parser = argparse.ArgumentParser( | ||
prog='spectre', | ||
description="SpECTRE version: {}".format(SPECTRE_VERSION), | ||
formatter_class=HelpFormatter) | ||
|
||
# Version endpoint | ||
parser.add_argument('--version', action='version', version=SPECTRE_VERSION) | ||
|
||
parser.parse_args() | ||
raise NotImplementedError("No subprograms are implemented yet.") | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Distributed under the MIT License. | ||
# See LICENSE.txt for details. | ||
|
||
add_subdirectory(support) | ||
add_subdirectory(Unit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Distributed under the MIT License. | ||
# See LICENSE.txt for details. | ||
|
||
add_subdirectory(Python) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Distributed under the MIT License. | ||
# See LICENSE.txt for details. | ||
|
||
if (BUILD_PYTHON_BINDINGS) | ||
add_test(NAME "support.Python.main" | ||
COMMAND ${CMAKE_BINARY_DIR}/bin/spectre --version) | ||
set_tests_properties( | ||
"support.Python.main" PROPERTIES | ||
PASS_REGULAR_EXPRESSION "${SPECTRE_VERSION}" | ||
LABELS "python") | ||
endif() |