Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 8b4ad5a1 authored by hhakim's avatar hhakim
Browse files

Update experimental code filter added by ebc954ec and use it CMake scripts for...

Update experimental code filter added by ebc954ec and use it CMake scripts for pyfaust and matfaust.
parent 83a12924
Branches
Tags 2.5.10
No related merge requests found
Pipeline #833882 skipped
......@@ -3,17 +3,43 @@
import re, sys
EXP_BLOCK_START="^(#|%) experimental block start"
EXP_BLOCK_END="(#|%) experimental block end"
EXP_BLOCK_END="^(#|%) experimental block end"
if(len(sys.argv) >= 1):
for script in sys.argv[1:]:
out_lines = []
# option to not write empty out file
if("--no-empty" in sys.argv[:]):
noempty = True
sys.argv.remove("--no-empty")
else:
noempty = False
if(len(sys.argv) >= 2):
for script in [sys.argv[1]]:
in_exp_block = False
for line in open(sys.argv[1]):
for line in open(script):
if(not in_exp_block and re.match(EXP_BLOCK_START,
line)):
in_exp_block = True
elif(in_exp_block and re.match(EXP_BLOCK_END, line)):
in_exp_block = False
elif(not in_exp_block):
print(line,end='')
out_lines += [ line ]
# print("out_lines:", ''.join(out_lines))
# print("matching empty=", re.match('^\s*$',''.join(out_lines)))
if(len(sys.argv) >= 3):
if(not noempty or not re.match('^\s*$',''.join(out_lines))):
outf = open(sys.argv[2], 'w')
outf.writelines(out_lines)
outf.close()
else:
print("deleting file:", sys.argv[2])
# delete the file
import os
os.remove(sys.argv[2])
else:
print(out_lines)
% experimental block start
%==========================================================================================
%> @brief Approximates M by A S_1 ... S_n B using hierarchical.
%>
......@@ -67,3 +68,4 @@ function varargout = hierarchical_constends(M, p, A, B)
F = matfaust.Faust(nF);
varargout = {F, lambda, p};
end
% experimental block end
% experimental block start
%==========================================================================================
%> @brief Approximates M by A S_1 … S_n B using palm4msa.
%>
......@@ -52,3 +53,4 @@ function [F, lambda] = palm4msa_constends(M, p, A, varargin)
nF{2} = nF{2}*lambda;
F = matfaust.Faust(nF);
end
% experimental block end
......@@ -65,6 +65,13 @@ foreach(MATFAUST_FILE IN LISTS FAUST_MATLAB_MATFAUST_FILE_LIST)
message(STATUS "matfaust function file: " ${MATFAUST_FILE})
# just copy the .m
configure_file(${FAUST_MATLAB_NAMESPACE_SRC_DIR}/${MATFAUST_FILE} ${FAUST_MATLAB_NAMESPACE_BIN_DIR}/${MATFAUST_FILE} @ONLY)
# filter out experimental code
execute_process(COMMAND
python
"${PROJECT_SOURCE_DIR}/misc/binpkg_postinst_scripts/filter_experimental_code.py"
${FAUST_MATLAB_NAMESPACE_BIN_DIR}/${MATFAUST_FILE}
${FAUST_MATLAB_NAMESPACE_BIN_DIR}/${MATFAUST_FILE} "--no-empty")
# --no-empty deletes emtpy file after filtering
endif()
endforeach()
......
......@@ -100,6 +100,12 @@ FILE(GLOB_RECURSE PYFAUST_FILES RELATIVE ${FAUST_PYTHON_SRC_DIR} ${FAUST_PYTHON_
foreach(PYFAUST_FILE ${PYFAUST_FILES})
message(STATUS "Installing ${PYFAUST_FILE}")
configure_file(${FAUST_PYTHON_SRC_DIR}/${PYFAUST_FILE} ${FAUST_PYTHON_BIN_DIR}/${PYFAUST_FILE} @ONLY)
# filter experimental code out of pyfaust modules
execute_process(COMMAND
python
"${PROJECT_SOURCE_DIR}/misc/binpkg_postinst_scripts/filter_experimental_code.py"
${FAUST_PYTHON_BIN_DIR}/${PYFAUST_FILE}
${FAUST_PYTHON_BIN_DIR}/${PYFAUST_FILE} "--no-empty")
endforeach()
add_custom_target(${FAUST_PYTHON_TARGET} ALL DEPENDS ${FAUST_TARGET})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment