diff --git a/Applications/Python/ogs.simulator/CMakeLists.txt b/Applications/Python/ogs.simulator/CMakeLists.txt index f3b5c244980e46976560e811b3f7b8fe8a1b746d..daf04fcd5e2867b54a536b20dcbbd7137dc8f4a6 100644 --- a/Applications/Python/ogs.simulator/CMakeLists.txt +++ b/Applications/Python/ogs.simulator/CMakeLists.txt @@ -17,5 +17,5 @@ target_link_libraries( ) target_include_directories(simulator PRIVATE ../../CLI) -# Install into Python module root dir (enables 'import ogs.callbacks') +# Install into Python module root dir (enables 'import ogs.simulator') install(TARGETS simulator LIBRARY DESTINATION ogs) diff --git a/Applications/Python/ogs/_internal/provide_ogs_cli_tools_via_wheel.py b/Applications/Python/ogs/_internal/provide_ogs_cli_tools_via_wheel.py index 034866a4175aaee9aa4fb1dd7dfe7f1b6029596c..aa476340352f2f1cea6b5cc34b61903015c09783 100644 --- a/Applications/Python/ogs/_internal/provide_ogs_cli_tools_via_wheel.py +++ b/Applications/Python/ogs/_internal/provide_ogs_cli_tools_via_wheel.py @@ -4,6 +4,8 @@ import subprocess import sys from pathlib import Path +# Here, we assume that this script is installed, e.g., in a virtual environment +# alongside a "bin" directory. OGS_BIN_DIR = Path(__file__).parent.parent.parent / "bin" binaries_list = [ @@ -72,7 +74,7 @@ binaries_list = [ ] -def pyproject_get_scripts(): +def pyproject_get_binaries(): return { binary: f"ogs._internal.provide_ogs_cli_tools_via_wheel:{binary}" for binary in binaries_list diff --git a/Applications/Python/ogs/_internal/wrap_cli_tools.py b/Applications/Python/ogs/_internal/wrap_cli_tools.py index 3180c2aa934199ead48d633eb7ffd5ebe6166434..7c87b2dd71937bb14cd78f3ae0833fb4813aa283 100644 --- a/Applications/Python/ogs/_internal/wrap_cli_tools.py +++ b/Applications/Python/ogs/_internal/wrap_cli_tools.py @@ -3,6 +3,8 @@ from pathlib import Path from .provide_ogs_cli_tools_via_wheel import binaries_list, ogs_with_args +# Here, we assume that this script is installed, e.g., in a virtual environment +# alongside a "bin" directory. OGS_BIN_DIR = Path(__file__).parent.parent.parent / "bin" diff --git a/pyproject.toml b/pyproject.toml index 14be11063af11aaa944796f26a2b226dc47caa5c..a6a62bdce60983d38c0da97b319e1ebc8c8a3cb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,9 +39,9 @@ write_to = "Applications/Python/_version.py" write_to_template = '__version__ = "{version}"' version_scheme = "no-guess-dev" git_describe_command = 'git describe --dirty --tags --long --match "*[0-9]*" --abbrev=8' -# TODO neither local_scheme callable (https://github.com/pypa/setuptools_scm/issues/832) -# or env var (https://github.com/pypa/setuptools_scm/issues/455) does not work. -# Should be node-and-date by default and no-local-version in CI +# local_scheme should be node-and-date by default and no-local-version in CI. +# Unfortunately setting via env var does not work. +# See https://github.com/pypa/setuptools_scm/issues/455. local_scheme = "no-local-version" [tool.pytest.ini_options] diff --git a/scripts/python/scikit-build-plugins/scripts/__init__.py b/scripts/python/scikit-build-plugins/scripts/__init__.py index 0b47590711071390967d2dfbd48032f0991afb84..59232a324cc0c2605c40ef4dc296d5c6933ec131 100644 --- a/scripts/python/scikit-build-plugins/scripts/__init__.py +++ b/scripts/python/scikit-build-plugins/scripts/__init__.py @@ -1,10 +1,10 @@ from __future__ import annotations import sys -import os +from pathlib import Path -sys.path.append(os.path.join("Applications", "Python")) -from ogs._internal.provide_ogs_cli_tools_via_wheel import pyproject_get_scripts +sys.path.append(str(Path("Applications").joinpath("Python").absolute())) +from ogs._internal.provide_ogs_cli_tools_via_wheel import pyproject_get_binaries __all__ = ["dynamic_metadata"] @@ -25,10 +25,4 @@ def dynamic_metadata( msg = "No inline configuration is supported" raise ValueError(msg) - # Structure for entry-points - # eps = { - # "console_scripts": {"ogs": "ogs._internal.provide_ogs_cli_tools_via_wheel:ogs"} - # } - # scripts = {"ogs": "ogs._internal.provide_ogs_cli_tools_via_wheel:ogs"} - - return {"scripts": pyproject_get_scripts()} + return {"scripts": pyproject_get_binaries()}