From a289c0e14c4a0034ede1fad9da98f1a110e080d4 Mon Sep 17 00:00:00 2001 From: Damian Kula Date: Sun, 26 Oct 2025 19:15:32 +0100 Subject: [PATCH 1/3] Extract creation of main path to binary to a separate function Signed-off-by: Damian Kula --- python/__init__.py | 15 +++++++++++++++ python/__main__.py | 15 +++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 python/__init__.py diff --git a/python/__init__.py b/python/__init__.py new file mode 100644 index 0000000..62e807f --- /dev/null +++ b/python/__init__.py @@ -0,0 +1,15 @@ +import sys +from pathlib import Path + +def get_path_to_binary() -> Path: + """ + Returns a path to a binary of mseedindex, regardless of the OS. + """ + if sys.platform.lower().startswith("win"): + binary_name = "mseedindex.exe" + else: + binary_name = "mseedindex" + + binary_path = Path(__file__).parent / binary_name + return binary_path + diff --git a/python/__main__.py b/python/__main__.py index e9bcac1..9667ef4 100644 --- a/python/__main__.py +++ b/python/__main__.py @@ -1,15 +1,10 @@ # A Python wrapper for PyPI packaging entry point -import subprocess +import subprocess import sys -from pathlib import Path -def main(): - if sys.platform.lower().startswith("win"): - binary_name = "mseedindex.exe" - else: - binary_name = "mseedindex" - - binary_path = Path(__file__).parent / binary_name +from mseedindex import get_path_to_binary +def main(): + binary_path = get_path_to_binary() result = subprocess.run([str(binary_path)] + sys.argv[1:]) - sys.exit(result.returncode) \ No newline at end of file + sys.exit(result.returncode) From b84ca03612c82f326d445221faf826bbc408563b Mon Sep 17 00:00:00 2001 From: Damian Kula Date: Sun, 26 Oct 2025 19:23:28 +0100 Subject: [PATCH 2/3] Force __init__ to be added to dist Signed-off-by: Damian Kula --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7d81100..7f1bfbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,3 +52,4 @@ packages = ["mseedindex"] [tool.hatch.build.targets.wheel.force-include] "python/__main__.py" = "mseedindex/__main__.py" +"python/__init__.py" = "mseedindex/__init__.py" From 5446b9552ac219b58cecfed07a0802a69f4b0151 Mon Sep 17 00:00:00 2001 From: Damian Kula Date: Sun, 26 Oct 2025 19:24:07 +0100 Subject: [PATCH 3/3] Bumps version of mseedindex Signed-off-by: Damian Kula --- src/mseedindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mseedindex.c b/src/mseedindex.c index c740bcf..c0cc80f 100644 --- a/src/mseedindex.c +++ b/src/mseedindex.c @@ -114,7 +114,7 @@ #include "md5.h" #include "sha256.h" -#define VERSION "3.0.8" +#define VERSION "3.0.9" #define PACKAGE "mseedindex" static flag verbose = 0;