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" 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) 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;