Skip to content

Commit

Permalink
Python: renamed some scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Oct 16, 2019
1 parent 1540de1 commit 9acc976
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 45 deletions.
46 changes: 24 additions & 22 deletions CMakeLists.txt
Expand Up @@ -1337,16 +1337,18 @@ if(WIN32)

# Batch files to setup and run Python and Jupyter

set(RUN_PYTHON_FILENAME "${PROJECT_BUILD_DIR}/run_python.bat")
set(RUN_PYTHON_FILENAME "${PROJECT_BUILD_DIR}/runpython.bat")

configure_file(${CMAKE_SOURCE_DIR}/distrib/windows/run_python.bat.in
configure_file(${CMAKE_SOURCE_DIR}/distrib/windows/runpython.bat.in
${RUN_PYTHON_FILENAME})

install(FILES ${CMAKE_SOURCE_DIR}/distrib/windows/IPython.bat
${CMAKE_SOURCE_DIR}/distrib/windows/JupyterLab.bat
${CMAKE_SOURCE_DIR}/distrib/windows/Notebook.bat
${CMAKE_SOURCE_DIR}/distrib/windows/run_jupyter.bat
${CMAKE_SOURCE_DIR}/distrib/windows/set_python_path.bat
install(FILES ${CMAKE_SOURCE_DIR}/distrib/windows/ipythonconsole.bat
${CMAKE_SOURCE_DIR}/distrib/windows/jupyterlab.bat
${CMAKE_SOURCE_DIR}/distrib/windows/jupyterlab.vbs
${CMAKE_SOURCE_DIR}/distrib/windows/jupyternotebook.bat
${CMAKE_SOURCE_DIR}/distrib/windows/jupyternotebook.vbs
${CMAKE_SOURCE_DIR}/distrib/windows/runjupyter.bat
${CMAKE_SOURCE_DIR}/distrib/windows/setpythonpath.bat
${RUN_PYTHON_FILENAME}
DESTINATION .)

Expand All @@ -1373,7 +1375,7 @@ if(WIN32)
# Update Python scripts to refer to our installed Python

set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
"${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} Exec '\\\"\\\$INSTDIR\\\\Python\\\\bin\\\\python.exe\\\" \\\"\\\$INSTDIR\\\\Python\\\\Scripts\\\\set_python_path.py\\\" \\\"\\\$INSTDIR\\\\Python\\\" -s'
"${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} Exec '\\\"\\\$INSTDIR\\\\Python\\\\bin\\\\python.exe\\\" \\\"\\\$INSTDIR\\\\Python\\\\Scripts\\\\setpythonpath.py\\\" \\\"\\\$INSTDIR\\\\Python\\\" -s'
")
endif()
elseif(APPLE)
Expand Down Expand Up @@ -1408,20 +1410,20 @@ elseif(APPLE)

# Shell scripts to setup and run Python and Jupyter

set(RUN_JUPYTER_FILENAME ${PROJECT_BUILD_DIR}/run_jupyter.sh)
set(RUN_PYTHON_FILENAME ${PROJECT_BUILD_DIR}/run_python.sh)
set(SET_PYTHON_PATH_FILENAME ${PROJECT_BUILD_DIR}/set_python_path.sh)
set(RUN_JUPYTER_FILENAME ${PROJECT_BUILD_DIR}/runjupyter.sh)
set(RUN_PYTHON_FILENAME ${PROJECT_BUILD_DIR}/runpython.sh)
set(SET_PYTHON_PATH_FILENAME ${PROJECT_BUILD_DIR}/setpythonpath.sh)

configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/run_jupyter.sh.in
configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/runjupyter.sh.in
${RUN_JUPYTER_FILENAME} @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/run_python.sh.in
configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/runpython.sh.in
${RUN_PYTHON_FILENAME} @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/set_python_path.sh.in
configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/setpythonpath.sh.in
${SET_PYTHON_PATH_FILENAME} @ONLY)

install(FILES ${CMAKE_SOURCE_DIR}/distrib/macos/ipython.sh
install(FILES ${CMAKE_SOURCE_DIR}/distrib/macos/ipythonconsole.sh
${CMAKE_SOURCE_DIR}/distrib/macos/jupyterlab.sh
${CMAKE_SOURCE_DIR}/distrib/macos/notebook.sh
${CMAKE_SOURCE_DIR}/distrib/macos/jupyternotebook.sh
${RUN_JUPYTER_FILENAME}
${RUN_PYTHON_FILENAME}
${SET_PYTHON_PATH_FILENAME}
Expand Down Expand Up @@ -1502,16 +1504,16 @@ else()

# Shell scripts to setup and run Python and Jupyter

set(RUN_PYTHON_FILENAME ${PROJECT_BUILD_DIR}/run_python.sh)
set(RUN_PYTHON_FILENAME ${PROJECT_BUILD_DIR}/runpython.sh)

configure_file(${CMAKE_SOURCE_DIR}/distrib/linux/run_python.sh.in
configure_file(${CMAKE_SOURCE_DIR}/distrib/linux/runpython.sh.in
${RUN_PYTHON_FILENAME} @ONLY)

install(FILES ${CMAKE_SOURCE_DIR}/distrib/linux/ipython.sh
install(FILES ${CMAKE_SOURCE_DIR}/distrib/linux/ipythonconsole.sh
${CMAKE_SOURCE_DIR}/distrib/linux/jupyterlab.sh
${CMAKE_SOURCE_DIR}/distrib/linux/notebook.sh
${CMAKE_SOURCE_DIR}/distrib/linux/run_jupyter.sh
${CMAKE_SOURCE_DIR}/distrib/linux/set_python_path.sh
${CMAKE_SOURCE_DIR}/distrib/linux/jupyternotebook.sh
${CMAKE_SOURCE_DIR}/distrib/linux/runjupyter.sh
${CMAKE_SOURCE_DIR}/distrib/linux/setpythonpath.sh
${RUN_PYTHON_FILENAME}
DESTINATION .
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
Expand Down
Expand Up @@ -6,4 +6,4 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Start an IPython console attached to an OpenCOR kernel

${OPENCOR_DIR}/run_jupyter.sh console --kernel OpenCOR $*
${OPENCOR_DIR}/runjupyter.sh console --kernel OpenCOR $*
2 changes: 1 addition & 1 deletion distrib/linux/jupyterlab.sh
Expand Up @@ -6,4 +6,4 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Start Jupyter Lab

${OPENCOR_DIR}/run_jupyter.sh lab --ip 127.0.0.1 $*
${OPENCOR_DIR}/runjupyter.sh lab --ip 127.0.0.1 $*
Expand Up @@ -6,4 +6,4 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Start Jupyter notebook

${OPENCOR_DIR}/run_jupyter.sh notebook --ip 127.0.0.1 $*
${OPENCOR_DIR}/runjupyter.sh notebook --ip 127.0.0.1 $*
Expand Up @@ -6,7 +6,7 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Make sure the path to Python is correct before starting Jupyter

${OPENCOR_DIR}/set_python_path.sh
${OPENCOR_DIR}/setpythonpath.sh

# Make sure we can find the OpenCOR application to run as a Jupyter kernel

Expand Down
Expand Up @@ -6,7 +6,7 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Make sure the path to Python is correct before starting Jupyter

${OPENCOR_DIR}/set_python_path.sh
${OPENCOR_DIR}/setpythonpath.sh

# Start the OpenCOR plugin that runs Python code

Expand Down
Expand Up @@ -6,4 +6,4 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Make sure the path to Python is correct

${OPENCOR_DIR}/python/bin/python ${OPENCOR_DIR}/python/bin/set_python_path.py ${OPENCOR_DIR}/python -s
${OPENCOR_DIR}/python/bin/python ${OPENCOR_DIR}/python/bin/setpythonpath.py ${OPENCOR_DIR}/python -s
Expand Up @@ -6,4 +6,4 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Start an IPython console attached to an OpenCOR kernel

${OPENCOR_DIR}/run_jupyter.sh console --kernel OpenCOR $*
${OPENCOR_DIR}/runjupyter.sh console --kernel OpenCOR $*
2 changes: 1 addition & 1 deletion distrib/macos/jupyterlab.sh
Expand Up @@ -6,4 +6,4 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Start Jupyter Lab

${OPENCOR_DIR}/run_jupyter.sh lab --ip 127.0.0.1 $*
${OPENCOR_DIR}/runjupyter.sh lab --ip 127.0.0.1 $*
Expand Up @@ -6,4 +6,4 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Start Jupyter notebook

${OPENCOR_DIR}/run_jupyter.sh notebook --ip 127.0.0.1 $*
${OPENCOR_DIR}/runjupyter.sh notebook --ip 127.0.0.1 $*
Expand Up @@ -6,7 +6,7 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Make sure the path to Python is correct before starting Jupyter

${OPENCOR_DIR}/set_python_path.sh
${OPENCOR_DIR}/setpythonpath.sh

# Make sure we can find the OpenCOR application to run as a Jupyter kernel

Expand Down
Expand Up @@ -6,7 +6,7 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"

# Make sure the path to Python is correct before starting Jupyter

${OPENCOR_DIR}/set_python_path.sh
${OPENCOR_DIR}/setpythonpath.sh

# Start the OpenCOR plugin that runs Python code

Expand Down
Expand Up @@ -7,6 +7,6 @@ OPENCOR_DIR="$(cd "$(dirname "$0")"; pwd)"
# Make sure the path to Python is correct

${OPENCOR_DIR}/@CMAKE_PROJECT_NAME@.app/Contents/Frameworks/Python/bin/python \
${OPENCOR_DIR}/@CMAKE_PROJECT_NAME@.app/Contents/Frameworks/Python/bin/set_python_path.py \
${OPENCOR_DIR}/@CMAKE_PROJECT_NAME@.app/Contents/Frameworks/Python/bin/setpythonpath.py \
${OPENCOR_DIR}/@CMAKE_PROJECT_NAME@.app/Contents/Frameworks/Python \
-s
Expand Up @@ -6,4 +6,4 @@ REM Get the directory containing this batch file
SET OPENCOR_DIR=%~dp0

REM Start an IPython console attached to an OpenCOR kernel
CALL "%OPENCOR_DIR%run_jupyter.bat" console --kernel OpenCOR %*
CALL "%OPENCOR_DIR%runjupyter.bat" console --kernel OpenCOR %*
Expand Up @@ -6,4 +6,4 @@ REM Get the directory containing this batch file
SET OPENCOR_DIR=%~dp0

REM Start a Jupyter Lab server
CALL "%OPENCOR_DIR%run_jupyter.bat" lab --ip 127.0.0.1 %*
CALL "%OPENCOR_DIR%runjupyter.bat" lab --ip 127.0.0.1 %*
Expand Up @@ -5,7 +5,7 @@ REM Get the directory containing this script file
OPENCOR_DIR = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)

REM Ensure the path to Python is correct before starting Jupyter
updatePythonPath = """"&OPENCOR_DIR&"\Python\bin\Python.exe"" """&OPENCOR_DIR&"\Python\Scripts\set_python_path.py"" """&OPENCOR_DIR&"\Python"" -s"
updatePythonPath = """"&OPENCOR_DIR&"\Python\bin\Python.exe"" """&OPENCOR_DIR&"\Python\Scripts\setpythonpath.py"" """&OPENCOR_DIR&"\Python"" -s"
shell.Run updatePythonPath, 0, True

REM Start a Jupyter Lab server
Expand Down
Expand Up @@ -6,4 +6,4 @@ REM Get the directory containing this batch file
SET OPENCOR_DIR=%~dp0

REM Start a Jupyter notebook server
CALL "%OPENCOR_DIR%run_jupyter.bat" notebook --ip 127.0.0.1 %*
CALL "%OPENCOR_DIR%runjupyter.bat" notebook --ip 127.0.0.1 %*
Expand Up @@ -5,7 +5,7 @@ REM Get the directory containing this script file
OPENCOR_DIR = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)

REM Ensure the path to Python is correct before starting Jupyter
updatePythonPath = """"&OPENCOR_DIR&"\Python\bin\Python.exe"" """&OPENCOR_DIR&"\Python\Scripts\set_python_path.py"" """&OPENCOR_DIR&"\Python"" -s"
updatePythonPath = """"&OPENCOR_DIR&"\Python\bin\Python.exe"" """&OPENCOR_DIR&"\Python\Scripts\setpythonpath.py"" """&OPENCOR_DIR&"\Python"" -s"
shell.Run updatePythonPath, 0, True

REM Start a Jupyter notebook server
Expand Down
Expand Up @@ -6,7 +6,7 @@ REM Get the directory containing this batch file
SET OPENCOR_DIR=%~dp0

REM Make sure the path to Python is correct before starting Jupyter
CALL "%OPENCOR_DIR%set_python_path.bat"
CALL "%OPENCOR_DIR%setpythonpath.bat"

REM Start Jupyter
"%OPENCOR_DIR%Python\bin\Python.exe" "%OPENCOR_DIR%Python\Scripts\start_jupyter.py" %*
Expand Up @@ -4,7 +4,7 @@ REM Get the directory containing this batch file
SET OPENCOR_DIR=%~dp0

REM Make sure the path to Python is correct before starting Jupyter
CALL "%OPENCOR_DIR%set_python_path.bat"
CALL "%OPENCOR_DIR%setpythonpath.bat"

REM Start the OpenCOR plugin that runs Python code
"%OPENCOR_DIR%bin\${CMAKE_PROJECT_NAME}" -c Python %*
Expand Up @@ -4,4 +4,4 @@ REM Get the directory containing this batch file
SET OPENCOR_DIR=%~dp0

REM Make sure the path to Python is correct
"%OPENCOR_DIR%Python\bin\Python.exe" "%OPENCOR_DIR%Python\Scripts\set_python_path.py" "%OPENCOR_DIR%Python" -s
"%OPENCOR_DIR%Python\bin\Python.exe" "%OPENCOR_DIR%Python\Scripts\setpythonpath.py" "%OPENCOR_DIR%Python" -s
4 changes: 2 additions & 2 deletions src/plugins/thirdParty/Python/CMakeLists.txt
Expand Up @@ -512,7 +512,7 @@ endif()

# Copy a script to update the Python path in copied scripts

file(COPY ${PROJECT_SOURCE_DIR}/scripts/set_python_path.py
file(COPY ${PROJECT_SOURCE_DIR}/scripts/setpythonpath.py
DESTINATION ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/${SCRIPT_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

Expand All @@ -521,7 +521,7 @@ file(COPY ${PROJECT_SOURCE_DIR}/scripts/set_python_path.py
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/${PYTHON_EXECUTABLE}
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/${SCRIPT_DIR}/set_python_path.py
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/${SCRIPT_DIR}/setpythonpath.py
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR} -s)

# Keep a list of Python specific dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/thirdParty/PythonPackages/CMakeLists.txt
Expand Up @@ -498,7 +498,7 @@ endif()

add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_SCRIPT_DIR}/set_python_path.py
COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_SCRIPT_DIR}/setpythonpath.py
--update-path ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/${PYTHON_RELATIVE_SCRIPT_DIR}
${PYTHON_ROOT_DIR} -s)

Expand Down

0 comments on commit 9acc976

Please sign in to comment.