diff --git a/CMakeLists.txt b/CMakeLists.txt index 29ad7b6..156ba2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ endif() project(SPTK VERSION 4.4) option(SPTK_INSTALL "Install SPTK library" ON) +option(SPTK_INSTALL_DRAW_COMMANDS "Install Python-based drawing commands" ON) option(SPTK_BUILD_COMMANDS "Build SPTK commands" ON) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -420,12 +421,15 @@ set(PYTHON_SOURCES ${SOURCE_DIR}/draw/gspecgram.py ${SOURCE_DIR}/draw/gwave.py) -if(NOT WIN32 AND SPTK_INSTALL) +if(NOT WIN32 AND SPTK_INSTALL_DRAW_COMMANDS) + install(FILES ${SOURCE_DIR}/draw/sptk/draw_utils.py + DESTINATION ${CMAKE_INSTALL_LIBDIR}/sptk) + foreach(SOURCE ${PYTHON_SOURCES}) get_filename_component(BIN ${SOURCE} NAME_WE) - execute_process(COMMAND ln -snf ${SOURCE} - ${CMAKE_CURRENT_BINARY_DIR}/${BIN}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BIN} - DESTINATION ${CMAKE_INSTALL_BINDIR}) + install( + PROGRAMS ${SOURCE} + DESTINATION ${CMAKE_INSTALL_BINDIR} + RENAME ${BIN}) endforeach() endif() diff --git a/src/draw/fdrw.py b/src/draw/fdrw.py index 990c29f..7d6967a 100755 --- a/src/draw/fdrw.py +++ b/src/draw/fdrw.py @@ -21,7 +21,10 @@ import numpy as np import plotly.graph_objs as go -import sptk.draw_utils as utils +script_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(script_dir, "..", "lib")) + +import sptk.draw_utils as utils # noqa: E402 def get_arguments(): diff --git a/src/draw/glogsp.py b/src/draw/glogsp.py index 93c867a..4c7b574 100755 --- a/src/draw/glogsp.py +++ b/src/draw/glogsp.py @@ -21,7 +21,10 @@ import numpy as np import plotly.graph_objs as go -import sptk.draw_utils as utils +script_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(script_dir, "..", "lib")) + +import sptk.draw_utils as utils # noqa: E402 def get_arguments(): diff --git a/src/draw/gpolezero.py b/src/draw/gpolezero.py index 844262c..24d5962 100755 --- a/src/draw/gpolezero.py +++ b/src/draw/gpolezero.py @@ -21,7 +21,10 @@ import numpy as np import plotly.graph_objs as go -import sptk.draw_utils as utils +script_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(script_dir, "..", "lib")) + +import sptk.draw_utils as utils # noqa: E402 def get_arguments(): diff --git a/src/draw/grlogsp.py b/src/draw/grlogsp.py index 84d3469..14dedd7 100755 --- a/src/draw/grlogsp.py +++ b/src/draw/grlogsp.py @@ -21,7 +21,10 @@ import numpy as np import plotly.graph_objs as go -import sptk.draw_utils as utils +script_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(script_dir, "..", "lib")) + +import sptk.draw_utils as utils # noqa: E402 def get_arguments(): diff --git a/src/draw/gseries.py b/src/draw/gseries.py index 337892e..8392fc0 100755 --- a/src/draw/gseries.py +++ b/src/draw/gseries.py @@ -22,7 +22,10 @@ import plotly.graph_objs as go from plotly.subplots import make_subplots -import sptk.draw_utils as utils +script_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(script_dir, "..", "lib")) + +import sptk.draw_utils as utils # noqa: E402 def get_arguments(): diff --git a/src/draw/gspecgram.py b/src/draw/gspecgram.py index 5e77a42..776f251 100755 --- a/src/draw/gspecgram.py +++ b/src/draw/gspecgram.py @@ -23,7 +23,10 @@ from plotly.subplots import make_subplots from scipy import signal -import sptk.draw_utils as utils +script_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(script_dir, "..", "lib")) + +import sptk.draw_utils as utils # noqa: E402 def get_arguments(): diff --git a/src/draw/gwave.py b/src/draw/gwave.py index b6dba7d..1d876bd 100755 --- a/src/draw/gwave.py +++ b/src/draw/gwave.py @@ -22,7 +22,10 @@ import plotly.graph_objs as go from plotly.subplots import make_subplots -import sptk.draw_utils as utils +script_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(script_dir, "..", "lib")) + +import sptk.draw_utils as utils # noqa: E402 def get_arguments():