Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 7 additions & 43 deletions exaudfclient/base/python/python3/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)
Expand All @@ -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(
Expand All @@ -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,
)
Expand All @@ -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"],
Expand Down