Skip to content

Commit

Permalink
just sys.argv instead of argparse and a bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gipert committed Dec 29, 2024
1 parent bb7c8d9 commit 4ceeb2f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(PYTHON_SOURCES ${_r}/cmake/cpp_config.py.in ${_r}/python/remage/__init__.py
get_target_property(REMAGE_CPP_OUTPUT_NAME remage-cli-cpp OUTPUT_NAME)

# 1) construct the full path to the built executable
set(REMAGE_CPP_EXE_PATH ${CMAKE_BINARY_DIR}/${REMAGE_CPP_OUTPUT_NAME})
set(REMAGE_CPP_EXE_PATH ${CMAKE_BINARY_DIR}/src/${REMAGE_CPP_OUTPUT_NAME})

# configure cpp_config.py.in for the build area with the dynamically derived path
configure_file(
Expand Down
18 changes: 1 addition & 17 deletions python/remage/cli.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
from __future__ import annotations

import argparse
import subprocess
import sys

from .cpp_config import REMAGE_CPP_EXE_PATH


def remage_cli():
parser = argparse.ArgumentParser(
prog="remage", description="remage's command-line interface"
)

parser.add_argument(
"--version", action="store_true", help="""Print remage version and exit"""
)

args = parser.parse_args()

cmdline = [REMAGE_CPP_EXE_PATH]
if args.version:
cmdline += ["--version"]

result = subprocess.run(cmdline, check=False)

result = subprocess.run([REMAGE_CPP_EXE_PATH] + sys.argv[1:], check=False)
sys.exit(result.returncode)
2 changes: 1 addition & 1 deletion python/remage/cpp_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import annotations

REMAGE_CPP_EXE_PATH = "/home/gipert/sw/src/legend/remage/build/install/bin/remage-cpp"
REMAGE_CPP_EXE_PATH = "/home/gipert/sw/src/legend/remage/build/src/remage-cpp"
5 changes: 4 additions & 1 deletion tests/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
get_target_property(REMAGE_PYEXE remage-cli PYEXE_PATH)

add_test(NAME python/cli COMMAND "${REMAGE_PYEXE}" --help)
add_test(
NAME python/cli
COMMAND "${REMAGE_PYEXE}" -q
COMMAND "${REMAGE_PYEXE}" --help)

0 comments on commit 4ceeb2f

Please sign in to comment.