From 2353ec58db1f497b780ef5d73a67dd0005f935df Mon Sep 17 00:00:00 2001 From: Steffen Pankratz Date: Thu, 13 Aug 2026 11:34:24 +0200 Subject: [PATCH] Internal: simplified exascript Python Signed-off-by: Steffen Pankratz --- exaudfclient/base/python/python3/BUILD | 50 ++++---------------------- 1 file changed, 7 insertions(+), 43 deletions(-) diff --git a/exaudfclient/base/python/python3/BUILD b/exaudfclient/base/python/python3/BUILD index d996f2cd..cb62d1a3 100644 --- a/exaudfclient/base/python/python3/BUILD +++ b/exaudfclient/base/python/python3/BUILD @@ -9,13 +9,13 @@ genrule( mkdir -p build_exascript_python_tmp_cc/exaudflib cp "$(location //exaudflib:swig/script_data_transfer_objects_wrapper.h)" "$(location //exaudflib:exascript.i)" build_exascript_python_tmp_cc/exaudflib cd build_exascript_python_tmp_cc - swig -v $$INCLUDES -O -DEXTERNAL_PROCESS -Wall -c++ -python -py3 -addextern -module exascript_python -o "../$(location exascript_python_tmp.cc)" exaudflib/exascript.i + swig -v $$INCLUDES -O -DEXTERNAL_PROCESS -Wall -c++ -python -py3 -addextern -module exascript_python -o "../$(location exascript_python.cc)" exaudflib/exascript.i #Run replace_swig_import_helper.py because the generated exascript_python.py is not compatible with Python 3.12 #TODO: Update Swig to a new version which produces code compatible with Python 3.12 cd .. $$PYTHON3_PREFIX/bin/$$PYTHON3_VERSION "$(location //:replace_swig_import_helper.py)" "$(location exascript_python.py)" "$(location exascript_python.py)" """, - outs = ["exascript_python_tmp.cc", "exascript_python.py"], + outs = ["exascript_python.cc", "exascript_python.py"], srcs = ["//exaudflib:exascript.i","//exaudflib:swig/script_data_transfer_objects_wrapper.h"], tools = ["//:replace_swig_import_helper.py"], ) @@ -24,14 +24,9 @@ genrule( name = "exascript_python_tmp_h", cmd = """ INCLUDES=`$$PYTHON3_PREFIX/bin/$$PYTHON3_VERSION-config --includes` - mkdir build_exascript_python_tmp_h - cp "$(location //exaudflib:swig/script_data_transfer_objects_wrapper.h)" "$(location //exaudflib:exascript.i)" build_exascript_python_tmp_h - cp "$(location exascript_python_tmp.cc)" "$(location exascript_python.py)" build_exascript_python_tmp_h - cd build_exascript_python_tmp_h - swig -v $$INCLUDES -DEXTERNAL_PROCESS -c++ -python -py3 -external-runtime "../$(location exascript_python_tmp.h)" + swig -v $$INCLUDES -DEXTERNAL_PROCESS -c++ -python -py3 -external-runtime "$(location exascript_python.h)" """, - outs = ["exascript_python_tmp.h"], - srcs = ["//exaudflib:exascript.i","//exaudflib:swig/script_data_transfer_objects_wrapper.h", ":exascript_python_tmp.cc", "exascript_python.py"] + outs = ["exascript_python.h"], ) genrule( @@ -53,41 +48,10 @@ genrule( tools = ["//:build_integrated.py"] ) -genrule( - name = "filter_swig_code_exascript_python_h", - cmd = """ - ACTUAL_PYTHON_VERSION=`$$PYTHON3_PREFIX/bin/$$PYTHON3_VERSION -c 'import sys; print(".".join(map(str, sys.version_info[:3])))'` - if [[ $$ACTUAL_PYTHON_VERSION == 2* ]] ; then - python $(location //:filter_swig_code.py) "$@" "$<" - else - cp "$<" "$@" - fi - """, - outs = ["exascript_python.h"], - srcs = [":exascript_python_tmp_h"], - tools = ["//:filter_swig_code.py"] -) - -genrule( - name = "filter_swig_code_exascript_python_cc", - cmd = """ - ACTUAL_PYTHON_VERSION=`$$PYTHON3_PREFIX/bin/$$PYTHON3_VERSION -c 'import sys; print(".".join(map(str, sys.version_info[:3])))'` - cp $(locations exascript_python_tmp_cc) . - if [[ $$ACTUAL_PYTHON_VERSION == 2* ]] ; then - python $(location //:filter_swig_code.py) "$@" exascript_python_tmp.cc - else - cp exascript_python_tmp.cc "$@" - fi - """, - outs = ["exascript_python.cc"], - srcs = [":exascript_python_tmp_cc"], - tools = ["//:filter_swig_code.py"] -) - cc_library( name = "exascript_python", - srcs = [":filter_swig_code_exascript_python_cc",":filter_swig_code_exascript_python_h"], - hdrs = [":filter_swig_code_exascript_python_h"], + srcs = [":exascript_python_tmp_cc", ":exascript_python_tmp_h"], + hdrs = [":exascript_python_tmp_h"], deps = ["@python3//:python3","//exaudflib:exaudflib-deps","//exaudflib:header"], alwayslink=True, ) @@ -96,7 +60,7 @@ cc_library( name = "pythoncontainer", srcs = ["//python:pythoncontainer.cc", ":dummy.h"], data = [":extend_exascript_python_preset_py"], - hdrs = [":exascript_python_int", ":filter_swig_code_exascript_python_h"], + hdrs = [":exascript_python_int", ":exascript_python_tmp_h"], include_prefix = ".", deps = ["@python3//:python3",":exascript_python","//exaudflib:header", "//utils:utils", "//python:pythoncontainer_header"],