Skip to content
Snippets Groups Projects
Verified Commit 0566d251 authored by Lars Bilke's avatar Lars Bilke
Browse files

[wheel] Added ogs binary entrypoint.

parent 61b1a2a6
No related branches found
No related tags found
No related merge requests found
import os
import subprocess
import sys
from ._cli import *
OGS_BIN_DIR = os.path.join(os.path.join(os.path.dirname(__file__), "bin"))
def _program(name, args):
return subprocess.call([os.path.join(OGS_BIN_DIR, name)] + args)
def ogs():
raise SystemExit(_program("ogs", sys.argv[1:]))
......@@ -284,6 +284,10 @@
{
"name": "ci-no-unity",
"configurePreset": "ci-no-unity"
},
{
"name": "wheel",
"configurePreset": "wheel"
}
],
"testPresets": [
......
import sys
from contextlib import contextmanager
@contextmanager
def push_argv(argv):
old_argv = sys.argv
sys.argv = argv
yield
sys.argv = old_argv
import OpenGeoSys
import tempfile
import os
import pytest
import OpenGeoSys
def test_init():
def test_module():
arguments = [
"",
f"{os.path.abspath(os.path.dirname(__file__))}/../Data/Parabolic/LiquidFlow/Flux/cube_1e3_calculatesurfaceflux.prj",
......@@ -16,3 +19,18 @@ def test_init():
OpenGeoSys.executeSimulation()
print("Python OpenGeoSys.finalize() ...")
OpenGeoSys.finalize()
from . import push_argv
def _run(program, args):
func = getattr(OpenGeoSys, program)
args = ["%s.py" % program] + args
with push_argv(args), pytest.raises(SystemExit) as excinfo:
func()
assert 0 == excinfo.value.code
def test_binaries():
_run("ogs", ["--version"])
......@@ -11,6 +11,11 @@ setup(
package_dir={"": "Applications/Python"},
cmake_install_dir="Applications/Python/OpenGeoSys",
extras_require={"test": ["pytest"]},
cmake_args=["--preset wheel"],
cmake_args=["--preset wheel", "-B ."],
python_requires=">=3.6",
entry_points={
"console_scripts": [
"ogs=OpenGeoSys:ogs",
]
},
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment