From cbdadef9fba5aa8d19d35a09c50bf44eec38fa7c Mon Sep 17 00:00:00 2001 From: youben11 Date: Tue, 11 Jan 2022 19:38:54 +0100 Subject: [PATCH] chore: automatic link creation following python package structure we want to automatically create links to python file in case there is some changes to the package. We still need to do link creation for dialect files manually. --- docs/symlink_py.bash | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/symlink_py.bash b/docs/symlink_py.bash index d8ebe578f..df8cf37f7 100755 --- a/docs/symlink_py.bash +++ b/docs/symlink_py.bash @@ -6,14 +6,21 @@ cd links_to_compiler_build/py/concretelang_core ln -s ../../../../compiler/build/tools/concretelang/python_packages/concretelang_core/mlir -f -mkdir -p concrete/lang - +# Create directories needed for symlinks +mkdir -p concrete/lang/dialects cd concrete +# Consider concrete as a package, as it's not detecting it as a namespace +touch __init__.py -ln -s ../../../../../compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/lang/dialects/_FHE_ops_gen.py lang/fhe.py -f -ln -s ../../../../../compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/lang/dialects/_FHELinalg_ops_gen.py lang/fhelinalg.py -f -ln -s ../../../../../compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/lang/dialects/_ods_common.py lang/_ods_common.py -f +py_prefix="$PWD/../../../../../compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/" +pyfiles=`find $py_prefix -iname "*.py"` -ln -s ../../../../../compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/compiler.py compiler.py -f +for file in $pyfiles +do + ln -s $file `echo $file | sed s:$py_prefix::` -f +done -touch lang/__init__.py __init__.py +# Manually create dialect files +ln -s ${py_prefix}lang/dialects/_FHE_ops_gen.py lang/dialects/fhe.py -f +ln -s ${py_prefix}lang/dialects/_FHELinalg_ops_gen.py lang/dialects/fhelinalg.py -f +ln -s ${py_prefix}lang/dialects/_ods_common.py lang/dialects/_ods_common.py -f