diff --git a/.gitignore b/.gitignore index 07c6b866b6a40cebb9a12c58a6095cde08701e0e..0bf82370fc12d12d98df4433da272ee489769c11 100644 --- a/.gitignore +++ b/.gitignore @@ -177,7 +177,8 @@ Desktop.ini #Dynamically created files Framework/Kernel/inc/MantidKernel/GitHubApiHelper.h Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h - +qt/applications/workbench/setup.py +qt/python/setup.py # Make sure Third_Party doesn't get checked into the main repository Third_Party/ diff --git a/CMakeLists.txt b/CMakeLists.txt index cbf238f3ac687378183395e565d967e9bc5d3bd6..ccade423d537682f25e723a062a5cbd298eec9c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,17 +17,19 @@ if (POLICY CMP0072) endif () # System package target is important for the windows builds as it allows us to package only the dlls and exes and exclude libs. Defaults to empty for other platforms. -set ( SYSTEM_PACKAGE_TARGET "") +set ( SYSTEM_PACKAGE_TARGET "" ) # Add the path to our custom 'find' modules set ( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/buildconfig/CMake") -set ( ENABLE_MANTIDPLOT ON CACHE BOOL "Switch for compiling the Qt4-based gui & components") -# TODO: Switch this on by default when the builders all have Qt5 installed -set ( ENABLE_WORKBENCH OFF CACHE BOOL "Switch for compiling the Qt5-based gui & components") +set ( ENABLE_MANTIDPLOT ON CACHE BOOL "Enable Qt4-based gui & components" ) +set ( ENABLE_WORKBENCH OFF CACHE BOOL "Enable Qt5-based gui & components" ) +set ( PACKAGE_WORKBENCH OFF CACHE BOOL "If packaging is enabled then include the Qt-5 workbench in the package" ) +if ( PACKAGE_WORKBENCH AND NOT ENABLE_WORKBENCH ) + message ( FATAL_ERROR "Packaging workbench requested but workbench build is disabled!" ) +endif () -set ( CPACK_INSTALL_CMAKE_PROJECTS - "${CMAKE_BINARY_DIR}" "Mantid" "ALL" "/" ) +set ( CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR}" "Mantid" "ALL" "/" ) ########################################################################### # Quick exit if we only want data targets @@ -304,6 +306,9 @@ if ( ENABLE_CPACK ) # scipy set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},scipy" ) set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},mxml,hdf,hdf5,jsoncpp >= 0.7.0" ) + if (ENABLE_WORKBENCH) + set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},python-qt5" ) + endif() if( "${UNIX_CODENAME}" MATCHES "Santiago" ) # RHEL6 # On RHEL6 we have to use an updated qscintilla to fix an auto complete bug @@ -371,6 +376,13 @@ if ( ENABLE_CPACK ) list (REMOVE_ITEM DEPENDS_LIST "python-nxs (>= 4.3),") string ( REPLACE "python-" "python3-" DEPENDS_LIST ${DEPENDS_LIST} ) string ( REPLACE "python3-qt4" "python3-pyqt4" DEPENDS_LIST ${DEPENDS_LIST} ) + if (ENABLE_WORKBENCH) + set ( APPEND DEPENDS_LIST ",python3-qt5" ) + endif() + else() + if (ENABLE_WORKBENCH) + set ( APPEND DEPENDS_LIST ",pyqt5" ) + endif() endif () # parse list to string required for deb package string ( REPLACE ";" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${DEPENDS_LIST} ) diff --git a/buildconfig/CMake/LinuxPackageScripts.cmake b/buildconfig/CMake/LinuxPackageScripts.cmake index 4e70e144b791cfe3b02a08f77f0acd7b8ec31253..8fb1be25b6be2633e98510ccc7f2dab2ece4510a 100644 --- a/buildconfig/CMake/LinuxPackageScripts.cmake +++ b/buildconfig/CMake/LinuxPackageScripts.cmake @@ -3,6 +3,9 @@ # # It provides: # - launch_mantidplot.sh +# - launch_mantidworkbench.sh +# - mantid.sh <- for stable releases +# - mantid.csh <- for stable releases # ########################################################################### @@ -17,7 +20,7 @@ set ( PLUGINS_DIR plugins ) # Separate directory of plugins to be discovered by the ParaView framework # These cannot be mixed with our other plugins. Further sub-directories # based on the Qt version will also be created by the installation targets -set ( PVPLUGINS_SUBDIR paraview ) +set ( PVPLUGINS_DIR "plugins/paraview/qt4/" ) if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) set ( CMAKE_INSTALL_PREFIX /opt/mantid${CPACK_PACKAGE_SUFFIX} CACHE PATH "Install path" FORCE ) @@ -34,7 +37,7 @@ set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /opt /usr/share/applications file ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/mantid.sh "#!/bin/sh\n" "MANTIDPATH=${CMAKE_INSTALL_PREFIX}/${BIN_DIR}\n" - "PV_PLUGIN_PATH=${CMAKE_INSTALL_PREFIX}/${PVPLUGINS_DIR}/${PVPLUGINS_DIR}\n" + "PV_PLUGIN_PATH=${CMAKE_INSTALL_PREFIX}/${PVPLUGINS_DIR}\n" "PATH=$PATH:$MANTIDPATH\n" "export MANTIDPATH PV_PLUGIN_PATH PATH\n" @@ -44,7 +47,7 @@ file ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/mantid.sh file ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/mantid.csh "#!/bin/csh\n" "setenv MANTIDPATH \"${CMAKE_INSTALL_PREFIX}/${BIN_DIR}\"\n" - "setenv PV_PLUGIN_PATH \"${CMAKE_INSTALL_PREFIX}/${PVPLUGINS_DIR}/${PVPLUGINS_DIR}\"\n" + "setenv PV_PLUGIN_PATH \"${CMAKE_INSTALL_PREFIX}/${PVPLUGINS_DIR}\"\n" "setenv PATH \"\${PATH}:\${MANTIDPATH}\"\n" ) @@ -132,6 +135,17 @@ endif() ############################################################################ # Launcher scripts ############################################################################ +# common definition of work for virtualgl - lots of escaping things from cmake +set ( VIRTUAL_GL_WRAPPER +"# whether or not to use vglrun +if [ -n \"\${NXSESSIONID}\" ]; then + command -v vglrun >/dev/null 2>&1 || { echo >&2 \"MantidPlot requires VirtualGL but it's not installed. Aborting.\"; exit 1; } + VGLRUN=\"vglrun\" +elif [ -n \"\${TLSESSIONDATA}\" ]; then + command -v vglrun >/dev/null 2>&1 || { echo >&2 \"MantidPlot requires VirtualGL but it's not installed. Aborting.\"; exit 1; } + VGLRUN=\"vglrun\" +fi" ) + # The scripts need tcmalloc to be resolved to the runtime library as the plain # .so symlink is only present when a -dev/-devel package is present if ( TCMALLOC_FOUND ) @@ -140,6 +154,46 @@ if ( TCMALLOC_FOUND ) string( REGEX REPLACE "([0-9]+)\.[0-9]+\.[0-9]+$" "\\1" TCMALLOC_RUNTIME_LIB ${TCMALLOC_RUNTIME_LIB} ) endif () +# definitions to preload tcmalloc +set ( TCMALLOC_DEFINITIONS +"# Define parameters for tcmalloc +LOCAL_PRELOAD=${TCMALLOC_RUNTIME_LIB} +if [ -n \"\${LD_PRELOAD}\" ]; then + LOCAL_PRELOAD=\${LOCAL_PRELOAD}:\${LD_PRELOAD} +fi +if [ -z \"\${TCMALLOC_RELEASE_RATE}\" ]; then + TCM_RELEASE=10000 +else + TCM_RELEASE=\${TCMALLOC_RELEASE_RATE} +fi + +# Define when to report large memory allocation +if [ -z \"\${TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD}\" ]; then + # total available memory + TCM_REPORT=\$(grep MemTotal /proc/meminfo --color=never | awk '{print \$2}') + # half of available memory + TCM_REPORT=`expr 512 \\* \$TCM_REPORT` + # minimum is 1GB + if [ \${TCM_REPORT} -le 1073741824 ]; then + TCM_REPORT=1073741824 + fi +else + TCM_REPORT=\${TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD} +fi" ) + +# chunk of code for fixing MANTIDPATH +set ( MTD_PATH_DEFINITION "MANTIDPATH=\${INSTALLDIR}/bin" ) + +# chunk of code for launching gdb +set ( GDB_DEFINITIONS +"# run with gdb THIS OPTION MUST BE SUPPLIED FIRST +if [ -n \"\$1\" ] && [ \"\$1\" = \"--debug\" ]; then + shift + GDB=\"gdb --args\" +fi" ) + +set ( ERROR_CMD "ErrorReporter/error_dialog_app.py --exitcode=\$? --directory=\$INSTALLDIR/bin" ) + # Local dev version if ( MAKE_VATES ) set ( PARAVIEW_PYTHON_PATHS ":${ParaView_DIR}/lib:${ParaView_DIR}/lib/site-packages" ) @@ -147,15 +201,26 @@ else () set ( PARAVIEW_PYTHON_PATHS "" ) endif () +set ( LOCAL_PYPATH "\${INSTALLDIR}/bin" ) +set ( SCRIPTSDIR ${CMAKE_HOME_DIRECTORY}/scripts) + +# used by mantidplot and mantidworkbench if (ENABLE_MANTIDPLOT) set ( MANTIDPLOT_EXEC MantidPlot ) - set ( SCRIPTSDIR ${CMAKE_HOME_DIRECTORY}/scripts) configure_file ( ${CMAKE_MODULE_PATH}/Packaging/launch_mantidplot.sh.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launch_mantidplot.sh @ONLY ) # Needs to be executable execute_process ( COMMAND "chmod" "+x" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launch_mantidplot.sh" OUTPUT_QUIET ERROR_QUIET ) endif () +if (ENABLE_WORKBENCH) + set ( MANTIDWORKBENCH_EXEC workbench ) # what the actual thing is called + configure_file ( ${CMAKE_MODULE_PATH}/Packaging/launch_mantidworkbench.sh.in + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launch_mantidworkbench.sh @ONLY ) + # Needs to be executable + execute_process ( COMMAND "chmod" "+x" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launch_mantidworkbench.sh" + OUTPUT_QUIET ERROR_QUIET ) +endif() configure_file ( ${CMAKE_MODULE_PATH}/Packaging/mantidpython.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/mantidpython @ONLY ) # Needs to be executable @@ -168,31 +233,33 @@ execute_process ( COMMAND "chmod" "+x" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/AddPyt OUTPUT_QUIET ERROR_QUIET ) # Package version -set ( EXTRA_LDPATH "\${INSTALLDIR}/../lib/paraview-${ParaView_VERSION_MAJOR}.${ParaView_VERSION_MINOR}" ) if ( MAKE_VATES ) - set ( PV_PYTHON_PATH "\${INSTALLDIR}/../lib/paraview-${ParaView_VERSION_MAJOR}.${ParaView_VERSION_MINOR}" ) + set ( EXTRA_LDPATH "\${INSTALLDIR}/lib/paraview-${ParaView_VERSION_MAJOR}.${ParaView_VERSION_MINOR}" ) + set ( PV_PYTHON_PATH "\${INSTALLDIR}/lib/paraview-${ParaView_VERSION_MAJOR}.${ParaView_VERSION_MINOR}" ) set ( PARAVIEW_PYTHON_PATHS ":${PV_PYTHON_PATH}:${PV_PYTHON_PATH}/site-packages:${PV_PYTHON_PATH}/site-packages/vtk" ) else () set ( PARAVIEW_PYTHON_PATHS "" ) endif () +# used by mantidplot and mantidworkbench +set ( LOCAL_PYPATH "\${INSTALLDIR}/lib:\${INSTALLDIR}/plugins" ) +set ( SCRIPTSDIR "\${INSTALLDIR}/scripts") + if (ENABLE_MANTIDPLOT) set ( MANTIDPLOT_EXEC MantidPlot_exe ) - set ( SCRIPTSDIR "\${INSTALLDIR}/../scripts") configure_file ( ${CMAKE_MODULE_PATH}/Packaging/launch_mantidplot.sh.in ${CMAKE_CURRENT_BINARY_DIR}/launch_mantidplot.sh.install @ONLY ) - install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/launch_mantidplot.sh.install - DESTINATION ${BIN_DIR} RENAME launch_mantidplot.sh - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - GROUP_EXECUTE GROUP_READ - WORLD_EXECUTE WORLD_READ - ) + install ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/launch_mantidplot.sh.install + DESTINATION ${BIN_DIR} RENAME launch_mantidplot.sh ) endif () +if (PACKAGE_WORKBENCH) # will eventually switch to ENABLE_WORKBENCH + set ( MANTIDWORKBENCH_EXEC workbench ) # what the actual thing is called + configure_file ( ${CMAKE_MODULE_PATH}/Packaging/launch_mantidworkbench.sh.in + ${CMAKE_CURRENT_BINARY_DIR}/launch_mantidworkbench.sh.install @ONLY ) + install ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/launch_mantidworkbench.sh.install + DESTINATION ${BIN_DIR} RENAME mantidworkbench ) +endif() configure_file ( ${CMAKE_MODULE_PATH}/Packaging/mantidpython.in ${CMAKE_CURRENT_BINARY_DIR}/mantidpython.install @ONLY ) -install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/mantidpython.install - DESTINATION ${BIN_DIR} RENAME mantidpython - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - GROUP_EXECUTE GROUP_READ - WORLD_EXECUTE WORLD_READ -) +install ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mantidpython.install + DESTINATION ${BIN_DIR} RENAME mantidpython ) diff --git a/buildconfig/CMake/Packaging/launch_mantidplot.sh.in b/buildconfig/CMake/Packaging/launch_mantidplot.sh.in index a8822b897ea6f5f97d204ae12853012924a03cb7..dc4c9d534d9ecfa1500ea81080660b4553a1328a 100644 --- a/buildconfig/CMake/Packaging/launch_mantidplot.sh.in +++ b/buildconfig/CMake/Packaging/launch_mantidplot.sh.in @@ -6,49 +6,18 @@ # Find out where we are THISFILE=$(readlink -f "$0") -INSTALLDIR=$(echo $THISFILE | sed -r -e 's|^(.*)/(.*)$|\1|g') #.* is greedy and eats up until the final slash +INSTALLDIR=$(dirname $THISFILE) # directory of executable +INSTALLDIR=$(dirname $INSTALLDIR) # root install directory -# Define extra libraries and load paths -LOCAL_PRELOAD=@TCMALLOC_RUNTIME_LIB@ -if [ -n "${LD_PRELOAD}" ]; then - LOCAL_PRELOAD=${LOCAL_PRELOAD}:${LD_PRELOAD} -fi -if [ -z "${TCMALLOC_RELEASE_RATE}" ]; then - TCM_RELEASE=10000 -else - TCM_RELEASE=${TCMALLOC_RELEASE_RATE} -fi +@MTD_PATH_DEFINITION@ -if [ -n "${NXSESSIONID}" ]; then - command -v vglrun >/dev/null 2>&1 || { echo >&2 "MantidPlot requires VirtualGL but it's not installed. Aborting."; exit 1; } - VGLRUN="vglrun" -elif [ -n "${TLSESSIONDATA}" ]; then - command -v vglrun >/dev/null 2>&1 || { echo >&2 "MantidPlot requires VirtualGL but it's not installed. Aborting."; exit 1; } - VGLRUN="vglrun" -fi +@TCMALLOC_DEFINITIONS@ -# Define when to report large memory allocation -if [ -z "${TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD}" ]; then - # total available memory - TCM_REPORT=$(grep MemTotal /proc/meminfo --color=never | awk '{print $2}') - # half of available memory - TCM_REPORT=`expr 512 \* $TCM_REPORT` - # minimum is 1GB - if [ ${TCM_REPORT} -le 1073741824 ]; then - TCM_REPORT=1073741824 - fi -else - TCM_REPORT=${TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD} -fi - -# run with gdb THIS OPTION MUST BE SUPPLIED FIRST -if [ -n "$1" ] && [ "$1" = "--debug" ]; then - shift - GDB="gdb --args" -fi +@VIRTUAL_GL_WRAPPER@ +@GDB_DEFINITIONS@ # Launch LD_PRELOAD=${LOCAL_PRELOAD} TCMALLOC_RELEASE_RATE=${TCM_RELEASE} \ - TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=${TCM_REPORT} QT_API=pyqt \ - @WRAPPER_PREFIX@$VGLRUN $GDB $INSTALLDIR/@MANTIDPLOT_EXEC@ $*@WRAPPER_POSTFIX@ || @PYTHON_EXECUTABLE@ @SCRIPTSDIR@/ErrorReporter/error_dialog_app.py --exitcode=$? --directory=$INSTALLDIR + TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=${TCM_REPORT} \ + @WRAPPER_PREFIX@$VGLRUN $GDB $INSTALLDIR/bin/@MANTIDPLOT_EXEC@ $*@WRAPPER_POSTFIX@ || @PYTHON_EXECUTABLE@ @SCRIPTSDIR@/@ERROR_CMD@ diff --git a/buildconfig/CMake/Packaging/launch_mantidworkbench.sh.in b/buildconfig/CMake/Packaging/launch_mantidworkbench.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..25a5d1354b675f266e61a519bb321768cf9d066f --- /dev/null +++ b/buildconfig/CMake/Packaging/launch_mantidworkbench.sh.in @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Launch Mantidplot using any necessary LD_PRELOAD or software collection behaviour +# +# Script is configured by CMake + +# Find out where we are +THISFILE=$(readlink -f "$0") +INSTALLDIR=$(dirname $THISFILE) # directory of executable +INSTALLDIR=$(dirname $INSTALLDIR) # root install directory + +@MTD_PATH_DEFINITION@ + +@TCMALLOC_DEFINITIONS@ + +@VIRTUAL_GL_WRAPPER@ + +# Define where python libraries are +LOCAL_PYTHONPATH=@LOCAL_PYPATH@@PARAVIEW_PYTHON_PATHS@ +if [ -n "${PYTHONPATH}" ]; then + LOCAL_PYTHONPATH=${LOCAL_PYTHONPATH}:${PYTHONPATH} +fi + +@GDB_DEFINITIONS@ + +LD_PRELOAD=${LOCAL_PRELOAD} TCMALLOC_RELEASE_RATE=${TCM_RELEASE} \ + TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=${TCM_REPORT} \ + PYTHONPATH=${LOCAL_PYTHONPATH} \ + @WRAPPER_PREFIX@$VGLRUN $GDB @PYTHON_EXECUTABLE@ $INSTALLDIR/bin/@MANTIDWORKBENCH_EXEC@ $*@WRAPPER_POSTFIX@ || @PYTHON_EXECUTABLE@ @SCRIPTSDIR@/@ERROR_CMD@ diff --git a/buildconfig/CMake/Packaging/mantidpython.in b/buildconfig/CMake/Packaging/mantidpython.in index 668620b986878f3a36a9dd9e47801860871eb9e4..1b9df21e90ce8a6ec06ea990e83108b3688746df 100755 --- a/buildconfig/CMake/Packaging/mantidpython.in +++ b/buildconfig/CMake/Packaging/mantidpython.in @@ -5,74 +5,44 @@ # Script is configured by CMake # Find out where we are -SCRIPTFILE=$(readlink -f "$0") -INSTALLDIR=${SCRIPTFILE%/*} +THISFILE=$(readlink -f "$0") +INSTALLDIR=$(dirname $THISFILE) # directory of executable +INSTALLDIR=$(dirname $INSTALLDIR) # root install directory -# Define extra libraries and load paths -LOCAL_PRELOAD=@TCMALLOC_RUNTIME_LIB@ -if [ -n "${LD_PRELOAD}" ]; then - LOCAL_PRELOAD=${LOCAL_PRELOAD}:${LD_PRELOAD} -fi -if [ -z "${TCMALLOC_RELEASE_RATE}" ]; then - TCM_RELEASE=10000 -else - TCM_RELEASE=${TCMALLOC_RELEASE_RATE} -fi -LOCAL_LDPATH=@EXTRA_LDPATH@:${LD_LIBRARY_PATH} +@MTD_PATH_DEFINITION@ -# Define when to report large memory allocation -if [ -z "${TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD}" ]; then - # total available memory - TCM_REPORT=$(grep MemTotal /proc/meminfo --color=never | awk '{print $2}') - # half of available memory - TCM_REPORT=`expr 512 \* $TCM_REPORT` - # minimum is 1GB - if [ ${TCM_REPORT} -le 1073741824 ]; then - TCM_REPORT=1073741824 - fi -else - TCM_REPORT=${TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD} +@TCMALLOC_DEFINITIONS@ + +LOCAL_LDPATH=@EXTRA_LDPATH@ +if [ -n "${LD_LIBRARY_PATH}" ]; then + LOCAL_LDPATH=${LOCAL_LDPATH}:${LD_LIBRARY_PATH} fi # Define paraview information -PV_PLUGIN_PATH="${INSTALLDIR}/pvplugins/pvplugins" +PV_PLUGIN_PATH="${INSTALLDIR}/plugins/paraview/qt4" -# Define extra libraries for python -LOCAL_PYTHONPATH=${INSTALLDIR}@PARAVIEW_PYTHON_PATHS@ +# Define where python libraries are +LOCAL_PYTHONPATH=${INSTALLDIR}/bin:@LOCAL_PYPATH@@PARAVIEW_PYTHON_PATHS@ if [ -n "${PYTHONPATH}" ]; then LOCAL_PYTHONPATH=${LOCAL_PYTHONPATH}:${PYTHONPATH} fi -# Define QT_API to pyqt if not provided -if [ -z "${QT_API}" ]; then - QT_API=pyqt -fi - -# Define MANTIDPATH -MANTIDPATH="${INSTALLDIR}" - if [ -n "$1" ] && [ "$1" = "--classic" ]; then shift - set -- @WRAPPER_PREFIX@@PYTHON_EXECUTABLE@ $*@WRAPPER_POSTFIX@ - elif [ -n "$1" ] && [ -n "$2" ] && [ "$1" = "-n" ]; then ranks=$2 shift 2 set -- mpirun -n $ranks @WRAPPER_PREFIX@@PYTHON_EXECUTABLE@ $*@WRAPPER_POSTFIX@ - else IPYTHON_STARTUP="import IPython;IPython.start_ipython()" - set -- @WRAPPER_PREFIX@@PYTHON_EXECUTABLE@ -c "${IPYTHON_STARTUP}" $*@WRAPPER_POSTFIX@ - fi - LD_PRELOAD=${LOCAL_PRELOAD} TCMALLOC_RELEASE_RATE=${TCM_RELEASE} \ - TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=${TCM_REPORT} \ - LD_LIBRARY_PATH=${LOCAL_LDPATH} QT_API=${QT_API} \ - PV_PLUGIN_PATH=${PV_PLUGIN_PATH} \ - MANTIDPATH=${MANTIDPATH} \ - PYTHONPATH=${LOCAL_PYTHONPATH} \ - exec "$@" + TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=${TCM_REPORT} \ + PYTHONPATH=${LOCAL_PYTHONPATH} \ + LD_LIBRARY_PATH=${LOCAL_LDPATH} \ + PV_PLUGIN_PATH=${PV_PLUGIN_PATH} \ + exec "$@" +# diff --git a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in index 98e6a3106cb167bc5edf26dd5acc56138cc8e5ed..671583b86c43ad6f2908d78ddb3ed39090f7f79c 100644 --- a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in +++ b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in @@ -12,6 +12,7 @@ if [ -f $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot ]; then if [ ! -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot ]; then ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot fi + # create link to old name so upgrading from old packages doesn't delete the executable if [ ! -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot fi @@ -24,11 +25,20 @@ if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then ln -s $RPM_INSTALL_PREFIX0/@ETC_DIR@/mantid.csh /etc/profile.d/mantid.csh ln -s $RPM_INSTALL_PREFIX0/@ETC_DIR@/mantid.pth @PYTHON_SITE@/mantid.pth else - # Create symbolic links in world's path - if [ ! -L /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ ]; then - ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ + # symbolic links in world's path of mantidplot + if [ -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then + if [ ! -L /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ ]; then + ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ + fi fi + # symbolic link for mantidpython if [ ! -L /usr/bin/mantidpython@CPACK_PACKAGE_SUFFIX@ ]; then ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidpython /usr/bin/mantidpython@CPACK_PACKAGE_SUFFIX@ fi + # link the workbench if it exists + if [ -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidworkbench ]; then + if [ ! -L /usr/bin/mantidworkbench@CPACK_PACKAGE_SUFFIX@ ]; then + ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidworkbench /usr/bin/mantidworkbench@CPACK_PACKAGE_SUFFIX@ + fi + fi fi diff --git a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in index 3b54e3bb45e7be20ac992f5c472446c0f6eda349..2ab08a710e0427a09c742c4dfa561f306f676fbb 100644 --- a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in +++ b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in @@ -10,8 +10,10 @@ ENVVARS_ON_INSTALL=@ENVVARS_ON_INSTALL_INT@ # Remove exe and links only if it looks like we were removed # and not upgraded. If launch_mantidplot.sh exists then package # has been upgraded and MantidPlot_exe replaced so don't touch anything -if [ ! -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh ]; then - rm $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot_exe +if [ ! -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh ]; then + if [ -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot_exe ]; then + rm $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot_exe + fi if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then if [ -h /etc/profile.d/mantid.sh ]; then @@ -40,6 +42,10 @@ if [ ! -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh ]; then if [ -L $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then rm $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot fi + + if [ -L /usr/bin/mantidworkbench@CPACK_PACKAGE_SUFFIX@ ]; then + rm /usr/bin/mantidworkbench@CPACK_PACKAGE_SUFFIX@ + fi fi # If the install prefix contains mantid then prune empty directories. diff --git a/buildconfig/CMake/PythonPackageTargetFunctions.cmake b/buildconfig/CMake/PythonPackageTargetFunctions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..afcc9daed46436c60aec95292fcc6fc9ac41d0d0 --- /dev/null +++ b/buildconfig/CMake/PythonPackageTargetFunctions.cmake @@ -0,0 +1,79 @@ +# Defines functions to help deal with python packages + +# Function to create links to python packages in the source tree +# If the EXECUTABLE option is provided then it additional build rules are +# defined to ensure startup scripts are regenerated appropriately +function ( add_python_package pkg_name ) + # Create a setup.py file if necessary + set ( _setup_py ${CMAKE_CURRENT_SOURCE_DIR}/setup.py ) + set ( _setup_py_build_root ${CMAKE_CURRENT_BINARY_DIR} ) + if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in" ) + set ( SETUPTOOLS_BUILD_COMMANDS_DEF +"def patch_setuptools_command(cmd_cls_name): + import importlib + cmd_module = importlib.import_module('setuptools.command.' + cmd_cls_name) + setuptools_command_cls = getattr(cmd_module, cmd_cls_name) + + class CustomCommand(setuptools_command_cls): + user_options = setuptools_command_cls.user_options[:] + boolean_options = setuptools_command_cls.boolean_options[:] + def finalize_options(self): + build_cmd = self.get_finalized_command('build') + self.build_lib = '${_setup_py_build_root}/build' + setuptools_command_cls.finalize_options(self) + + return CustomCommand + +CustomBuildPy = patch_setuptools_command('build_py') +CustomInstall = patch_setuptools_command('install') +CustomInstallLib = patch_setuptools_command('install_lib') +" ) + set ( SETUPTOOLS_BUILD_COMMANDS_USE "cmdclass={'build_py': CustomBuildPy, 'install': CustomInstall, 'install-lib': CustomInstallLib }" ) + configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${_setup_py} @ONLY ) + endif () + + set ( _egg_link_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} ) + set ( _egg_link ${_egg_link_dir}/${pkg_name}.egg-link ) + + if ( ARGC GREATER 1 AND "${ARGN}" STREQUAL "EXECUTABLE" ) + if ( WIN32 ) + set ( _startup_script ${_egg_link_dir}/${pkg_name}-script.pyw ) + set ( _startup_exe ${_egg_link_dir}/${pkg_name}.exe ) + else () + set ( _startup_script ) + set ( _startup_exe ${_egg_link_dir}/${pkg_name} ) + endif () + endif () + + # create the developer setup which just creates a pth file rather than copying things over + set ( _outputs ${_egg_link} ${_startup_script} ${_startup_exe} ) + add_custom_command ( OUTPUT ${_outputs} + COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${_egg_link_dir} + ${PYTHON_EXECUTABLE} ${_setup_py} develop + --install-dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} + --script-dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${_setup_py} + ) + add_custom_target ( ${pkg_name} ALL + DEPENDS ${_outputs} + ) + + if ( ${PACKAGE_WORKBENCH} ) + # setuptools by default wants to build into a directory called 'build' relative the to the working directory. We have overridden + # commands in setup.py.in to force the build directory to take place out of source. The install directory is specified here and then + # --install-scripts=bin --install-lib=lib removes any of the plaform/distribution specific install directories so we can have a flat + # structure + install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${_setup_py} install -O1 --single-version-externally-managed --root=${_setup_py_build_root}/install --install-scripts=bin --install-lib=lib WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})") + # register the "installed" components with cmake so it will carry them over + install(DIRECTORY ${_setup_py_build_root}/install/lib + DESTINATION . + PATTERN "test" EXCLUDE ) + + # install the generated executable - only tested with "workbench" + if ( ARGC GREATER 1 AND "${ARGN}" STREQUAL "EXECUTABLE" ) + install(PROGRAMS ${_setup_py_build_root}/install/bin/${pkg_name} + DESTINATION bin) + endif() + endif() +endfunction () diff --git a/buildconfig/CMake/QtTargetFunctions.cmake b/buildconfig/CMake/QtTargetFunctions.cmake index 7314faba29176e1386d232ea2e288345709851e6..01772f4b161f53eb6ef84cacfea6075cc3e8dbdb 100644 --- a/buildconfig/CMake/QtTargetFunctions.cmake +++ b/buildconfig/CMake/QtTargetFunctions.cmake @@ -214,13 +214,11 @@ function (mtd_add_qt_target) _append_qt_suffix (AS_DIR VERSION ${PARSED_QT_VERSION} OUTPUT_VARIABLE _install_dir ${PARSED_INSTALL_DIR_BASE}) else() - set ( _install_dir ${LIB_DIR} ) + set ( _install_dir "" ) + message ( FATAL_ERROR "Target: ${_target} is configured to build but has no install destination" ) endif() - # Hack: Only install Qt4 to packages for now... - if (${PARSED_QT_VERSION} EQUAL 4) - install ( TARGETS ${_target} ${SYSTEM_PACKAGE_TARGET} DESTINATION ${_install_dir} ) - endif() - endif() + mtd_install_qt_library ( ${PARSED_QT_VERSION} ${_target} "${SYSTEM_PACKAGE_TARGET}" ${_install_dir} ) + endif () # Group into folder for VS set_target_properties ( ${_target} PROPERTIES FOLDER "Qt${PARSED_QT_VERSION}" ) @@ -234,6 +232,17 @@ function (mtd_add_qt_target) endfunction() +# Create an install rule for a Qt target +# - qt_version The version of Qt targeted +# - target The name of the target +# - install_target_type The type of target that should be installed. See https://cmake.org/cmake/help/latest/command/install.html?highlight=install +# - install_dir A relative directory to install_prefix +function (mtd_install_qt_library qt_version target install_target_type install_dir ) + if ( qt_version EQUAL 4 OR (qt_version EQUAL 5 AND ${PACKAGE_WORKBENCH}) ) + install ( TARGETS ${target} ${install_target_type} DESTINATION ${install_dir} ) + endif () +endfunction () + function (mtd_add_qt_tests) _qt_versions(_qt_vers ${ARGN}) # Create targets diff --git a/buildconfig/CMake/SipQtTargetFunctions.cmake b/buildconfig/CMake/SipQtTargetFunctions.cmake index 120ad0175939f086b12674900e8a3874cb885081..85c049f710054a0027fdd9698a5649090d320509 100644 --- a/buildconfig/CMake/SipQtTargetFunctions.cmake +++ b/buildconfig/CMake/SipQtTargetFunctions.cmake @@ -3,7 +3,7 @@ # of .sip definitions include ( QtTargetFunctions ) -# + # brief: Add a module target to generate Python bindings # for a set of sip sources. The sources list should be a list of filenames # without a path. The .sip module is generated in the CMAKE_CURRENT_BINARY_DIR @@ -17,6 +17,9 @@ include ( QtTargetFunctions ) # keyword: LINK_LIBS A list of additional target_link_libraries # keyword: PYQT_VERSION A single value indicating the version of PyQt # to compile against +# keyword: INSTALL_DIR The target location for installing this library +# keyword: OSX_INSTALL_RPATH Install path for osx version > 10.8 +# keyword: LINUX_INSTALL_RPATH Install path for CMAKE_SYSTEM_NAME == Linux function ( mtd_add_sip_module ) find_file ( _sipmodule_template_path NAME sipqtmodule_template.sip.in PATHS ${CMAKE_MODULE_PATH} ) @@ -27,7 +30,7 @@ function ( mtd_add_sip_module ) set ( options ) set ( oneValueArgs MODULE_NAME TARGET_NAME MODULE_OUTPUT_DIR PYQT_VERSION FOLDER ) - set ( multiValueArgs SIP_SRCS HEADER_DEPS INCLUDE_DIRS LINK_LIBS OSX_INSTALL_RPATH LINUX_INSTALL_RPATH ) + set ( multiValueArgs SIP_SRCS HEADER_DEPS INCLUDE_DIRS LINK_LIBS INSTALL_DIR OSX_INSTALL_RPATH LINUX_INSTALL_RPATH ) cmake_parse_arguments ( PARSED "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) @@ -106,6 +109,10 @@ function ( mtd_add_sip_module ) endif () endif () + if ( PARSED_INSTALL_DIR AND PACKAGE_WORKBENCH) + mtd_install_qt_library ( ${PARSED_PYQT_VERSION} ${PARSED_TARGET_NAME} "" ${PARSED_INSTALL_DIR} ) + endif () + if ( WIN32 ) set_target_properties( ${PARSED_TARGET_NAME} PROPERTIES PREFIX "" SUFFIX ".pyd" ) if ( PYTHON_DEBUG_LIBRARY ) diff --git a/buildconfig/Jenkins/buildscript b/buildconfig/Jenkins/buildscript index e41fbfdaa5de580f3874c8c4fc321d571f141659..2a79c6fdf5e2e03887ce614b98fb278edadeb3c6 100755 --- a/buildconfig/Jenkins/buildscript +++ b/buildconfig/Jenkins/buildscript @@ -229,8 +229,9 @@ if [[ ${DO_BUILD_PKG} == true ]]; then PACKAGINGVARS="-DPACKAGE_DOCS=ON" # Set some variables relating to the linux packages if [[ "${ON_MACOS}" == true ]]; then - PACKAGINGVARS="${PACKAGINGVARS} -DCPACK_PACKAGE_SUFFIX=" + PACKAGINGVARS="${PACKAGINGVARS} -DPACKAGE_WORKBENCH=OFF -DCPACK_PACKAGE_SUFFIX=" else + PACKAGINGVARS="${PACKAGINGVARS} -DPACKAGE_WORKBENCH=ON" # Use different suffix for linux builds if parameter is not defined if [[ -n "${PACKAGE_SUFFIX}" ]]; then echo "Using PACKAGE_SUFFIX=${PACKAGE_SUFFIX} from job parameter" diff --git a/buildconfig/Jenkins/buildscript.bat b/buildconfig/Jenkins/buildscript.bat index 9119939107bd040be8905ecd5007040bf10da66c..8a7d9211c778f75ecf4b43c5778b5dbe115332a6 100755 --- a/buildconfig/Jenkins/buildscript.bat +++ b/buildconfig/Jenkins/buildscript.bat @@ -150,7 +150,7 @@ if not "%JOB_NAME%"=="%JOB_NAME:debug=%" ( ) else ( set VATES_OPT_VAL=ON ) -call cmake.exe -G "%CM_GENERATOR%" -DCMAKE_SYSTEM_VERSION=%SDK_VERSION% -DCONSOLE=OFF -DENABLE_CPACK=ON -DMAKE_VATES=%VATES_OPT_VAL% -DParaView_DIR=%PARAVIEW_DIR% -DMANTID_DATA_STORE=!MANTID_DATA_STORE! -DENABLE_WORKBENCH=ON -DUSE_PRECOMPILED_HEADERS=ON %PACKAGE_OPTS% .. +call cmake.exe -G "%CM_GENERATOR%" -DCMAKE_SYSTEM_VERSION=%SDK_VERSION% -DCONSOLE=OFF -DENABLE_CPACK=ON -DMAKE_VATES=%VATES_OPT_VAL% -DParaView_DIR=%PARAVIEW_DIR% -DMANTID_DATA_STORE=!MANTID_DATA_STORE! -DENABLE_WORKBENCH=ON -DPACKAGE_WORKBENCH=OFF -DUSE_PRECOMPILED_HEADERS=ON %PACKAGE_OPTS% .. if ERRORLEVEL 1 exit /B %ERRORLEVEL% ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 28e79e57ca2f3bf5ee139bc00793373bd40f8634..5df1efb28936b4320e15951c35aceb7fd8e4bc42 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -3,37 +3,6 @@ find_package ( QScintillaQt4 REQUIRED ) # Utilities for defining targets include ( QtTargetFunctions ) -# Function to create links to python packages in the source tree -# If the EXECUTABLE option is provided then it additional build rules are -# defined to ensure startup scripts are regenerated appropriately -function ( add_python_package pkg_name ) - # Create a setup.py file - set ( _setup_py ${CMAKE_CURRENT_SOURCE_DIR}/setup.py ) - set ( _egg_link_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} ) - set ( _egg_link ${_egg_link_dir}/${pkg_name}.egg-link ) - if ( ARGV0 EQUAL "EXECUTABLE" ) - if ( WIN32 ) - set ( _startup_script ${_egg_link_dir}/${pkg_name}-script.pyw ) - set ( _startup_exe ${_egg_link_dir}/${pkg_name}.exe ) - else () - set ( _startup_script ) - set ( _startup_exe ${_egg_link_dir}/${pkg_name} ) - endif () - endif () - set ( _outputs ${_egg_link} ${_startup_script} ${_startup_exe} ) - add_custom_command ( OUTPUT ${_outputs} - COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${_egg_link_dir} - ${PYTHON_EXECUTABLE} ${_setup_py} develop - --install-dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} - --script-dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${_setup_py} - ) - add_custom_target ( ${pkg_name} ALL - DEPENDS ${_outputs} - ) -endfunction () - # Resource compiler for PyQt5 if ( ENABLE_WORKBENCH AND NOT PYRCC5_CMD ) # Newer versions of PyQt5 have a pyrcc_main python module, whereas older diff --git a/qt/applications/workbench/setup.py b/qt/applications/workbench/setup.py.in similarity index 76% rename from qt/applications/workbench/setup.py rename to qt/applications/workbench/setup.py.in index 6e3db4ad665309e688d04d56de958f5b79b2dfc1..dedef6c41ab3a5163ac374765dd40d1cdac50b42 100644 --- a/qt/applications/workbench/setup.py +++ b/qt/applications/workbench/setup.py.in @@ -16,15 +16,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from setuptools import setup +from setuptools import find_packages, setup + +@SETUPTOOLS_BUILD_COMMANDS_DEF@ # The most basic setup possible to be able to use setup.py develop setup( - name="workbench", + name='MantidWorkbench', # probaly the wrong name if someone wants to include it + version='@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@', install_requires=['mantidqt'], + packages=find_packages(exclude=['*.test']), entry_points={ 'gui_scripts': [ 'workbench = workbench.app.mainwindow:main' ] }, + @SETUPTOOLS_BUILD_COMMANDS_USE@ ) diff --git a/qt/applications/workbench/workbench/plugins/test/test_jupyterconsole.py b/qt/applications/workbench/workbench/plugins/test/test_jupyterconsole.py index f1ae661e90d3e4e8d804651b025fdc944edb1f9e..ed88ea6334583c8f3310dd4e8ab1715144406709 100644 --- a/qt/applications/workbench/workbench/plugins/test/test_jupyterconsole.py +++ b/qt/applications/workbench/workbench/plugins/test/test_jupyterconsole.py @@ -20,7 +20,7 @@ from __future__ import (absolute_import) import unittest # third-party library imports -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from qtpy.QtWidgets import QMainWindow # local package imports diff --git a/qt/applications/workbench/workbench/widgets/plotselector/test/test_plotselector_view.py b/qt/applications/workbench/workbench/widgets/plotselector/test/test_plotselector_view.py index fba1be352f09d0e0f51f8fdf0c53dd3f5330b992..dcb7fa8b9bc75df912e9eb9056c43934c0486a74 100644 --- a/qt/applications/workbench/workbench/widgets/plotselector/test/test_plotselector_view.py +++ b/qt/applications/workbench/workbench/widgets/plotselector/test/test_plotselector_view.py @@ -21,7 +21,7 @@ from qtpy.QtTest import QTest import qtawesome as qta -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from workbench.widgets.plotselector.presenter import PlotSelectorPresenter from workbench.widgets.plotselector.view import EXPORT_TYPES, PlotSelectorView, Column diff --git a/qt/paraview_ext/VatesAlgorithms/CMakeLists.txt b/qt/paraview_ext/VatesAlgorithms/CMakeLists.txt index 5fc54adb2eeddf14972e2714d1fd9130b6818eda..8d4a794b3cb33c5f4745f254454c4de8237d6e4e 100644 --- a/qt/paraview_ext/VatesAlgorithms/CMakeLists.txt +++ b/qt/paraview_ext/VatesAlgorithms/CMakeLists.txt @@ -50,7 +50,7 @@ ${POCO_LIBRARIES} if (OSX_VERSION VERSION_GREATER 10.8) set_target_properties(VatesAlgorithms PROPERTIES INSTALL_RPATH "@loader_path/../Contents/MacOS;@loader_path/../Libraries") elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) - set_target_properties(VatesAlgorithms PROPERTIES INSTALL_RPATH "\$ORIGIN/../${LIB_DIR}") + set_target_properties(VatesAlgorithms PROPERTIES INSTALL_RPATH "\$ORIGIN/../${LIB_DIR};\$ORIGIN/../${LIB_DIR}/paraview-${ParaView_VERSION_MAJOR}.${ParaView_VERSION_MINOR}") endif () # Create test file projects diff --git a/qt/python/CMakeLists.txt b/qt/python/CMakeLists.txt index 508b70e03026ca2f7cf23c5f7150a0e5a3366cea..e92c9fd5375c586af71ca8c5ad6c13d0973518db 100644 --- a/qt/python/CMakeLists.txt +++ b/qt/python/CMakeLists.txt @@ -1,6 +1,7 @@ # This file manages building/installation of the mantidqt and mantidqtpython # Python wrappers. # +include ( PythonPackageTargetFunctions ) # Legacy wrappers for MantidPlot add_subdirectory ( mantidqtpython ) @@ -20,7 +21,6 @@ if ( ENABLE_WORKBENCH ) ${CMAKE_CURRENT_SOURCE_DIR}/mantidqt/utils/qt/plugins.py ) - # Create egg link to binary output directory for mantidqt add_python_package ( mantidqt ) # Configure resources data in place for ease of development. The output diff --git a/qt/python/mantidqt/CMakeLists.txt b/qt/python/mantidqt/CMakeLists.txt index 1ec7b21fc9d2478fea791db55318cfe486266792..6ca91e85bdc9c66d88074b58a1754ab417e5c70b 100644 --- a/qt/python/mantidqt/CMakeLists.txt +++ b/qt/python/mantidqt/CMakeLists.txt @@ -2,7 +2,6 @@ include ( SipQtTargetFunctions ) set ( COMMON_INC_DIR ../../../widgets/common/inc ) set ( HEADER_DEPENDS - ${COMMON_INC_DIR}/MantidQtWidgets/Common/AlgorithmDialog.h ${COMMON_INC_DIR}/MantidQtWidgets/Common/AlgorithmDialog.h ${COMMON_INC_DIR}/MantidQtWidgets/Common/Message.h ${COMMON_INC_DIR}/MantidQtWidgets/Common/MessageDisplay.h @@ -18,7 +17,8 @@ list ( APPEND common_link_libs ${PYTHON_LIBRARIES} ) -# Wrapper module linked against Qt4 +# Wrapper module linked against Qt4 - not currently installed until required for backward compatability +# with MantidPlot mtd_add_sip_module ( MODULE_NAME _commonqt4 TARGET_NAME mantidqt_commonqt4 @@ -59,5 +59,9 @@ mtd_add_sip_module ( ${PYTHON_LIBRARIES} ${Boost_LIBRARIES} API + INSTALL_DIR + ${LIB_DIR}/mantidqt + LINUX_INSTALL_RPATH + "\$ORIGIN/.." FOLDER Qt5 ) diff --git a/qt/python/mantidqt/dialogs/test/test_algorithm_dialog.py b/qt/python/mantidqt/dialogs/test/test_algorithm_dialog.py index d5ac28bfd304a7da8221cd7fd6f590e8570d5319..3d4595a4e13d49b8e43db64031d48543e1c498ff 100644 --- a/qt/python/mantidqt/dialogs/test/test_algorithm_dialog.py +++ b/qt/python/mantidqt/dialogs/test/test_algorithm_dialog.py @@ -20,7 +20,7 @@ from qtpy.QtWidgets import QWidget, QLineEdit from mantid.api import AlgorithmManager, AlgorithmFactory, PythonAlgorithm from mantid.kernel import Direction, FloatArrayProperty -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from mantidqt.dialogs.algorithmdialog import AlgorithmDialog from mantidqt.dialogs.genericdialog import GenericDialog from mantidqt.interfacemanager import InterfaceManager diff --git a/qt/python/mantidqt/dialogs/test/test_spectraselectiondialog.py b/qt/python/mantidqt/dialogs/test/test_spectraselectiondialog.py index 135614b46a41c1f39fb20cbac9d6062c3098a72d..fe899f3841ba35e7edbc38524b1b3a592c91734d 100644 --- a/qt/python/mantidqt/dialogs/test/test_spectraselectiondialog.py +++ b/qt/python/mantidqt/dialogs/test/test_spectraselectiondialog.py @@ -24,7 +24,7 @@ from mantid.simpleapi import CreateSampleWorkspace, CropWorkspace from qtpy.QtWidgets import QDialogButtonBox # local imports -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from mantidqt.dialogs.spectraselectordialog import parse_selection_str, SpectraSelectionDialog diff --git a/qt/python/mantidqt/utils/qt/testing/__init__.py b/qt/python/mantidqt/utils/qt/test/__init__.py similarity index 100% rename from qt/python/mantidqt/utils/qt/testing/__init__.py rename to qt/python/mantidqt/utils/qt/test/__init__.py diff --git a/qt/python/mantidqt/utils/qt/testing/modal_tester.py b/qt/python/mantidqt/utils/qt/test/modal_tester.py similarity index 100% rename from qt/python/mantidqt/utils/qt/testing/modal_tester.py rename to qt/python/mantidqt/utils/qt/test/modal_tester.py diff --git a/qt/python/mantidqt/utils/qt/testing/run_test_app.py b/qt/python/mantidqt/utils/qt/test/run_test_app.py similarity index 100% rename from qt/python/mantidqt/utils/qt/testing/run_test_app.py rename to qt/python/mantidqt/utils/qt/test/run_test_app.py diff --git a/qt/python/mantidqt/utils/test/test_modal_tester.py b/qt/python/mantidqt/utils/test/test_modal_tester.py index 66ec5ff868b2092b947658ad327bd18462163dd3..9d68103564fd269b16e9edc55b824ea5ebd4fafc 100644 --- a/qt/python/mantidqt/utils/test/test_modal_tester.py +++ b/qt/python/mantidqt/utils/test/test_modal_tester.py @@ -22,7 +22,7 @@ import unittest from qtpy.QtWidgets import QInputDialog -from mantidqt.utils.qt.testing import requires_qapp, ModalTester +from mantidqt.utils.qt.test import requires_qapp, ModalTester @requires_qapp diff --git a/qt/python/mantidqt/utils/test/test_qt_utils.py b/qt/python/mantidqt/utils/test/test_qt_utils.py index 6e9497eaf7ed1d56aa70560cfefb4ec20a89c5e8..d1d88a021bd98dafb4538b498fb45c6b94b1f1d0 100644 --- a/qt/python/mantidqt/utils/test/test_qt_utils.py +++ b/qt/python/mantidqt/utils/test/test_qt_utils.py @@ -27,7 +27,7 @@ try: except ImportError: NEW_STYLE_SIGNAL = True -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from mantidqt.utils.qt import add_actions, create_action diff --git a/qt/python/mantidqt/utils/test/test_writetosignal.py b/qt/python/mantidqt/utils/test/test_writetosignal.py index e65614158ae8ac1bb7058806cf4b7b19ca39d198..5742e465dd9acba02a5aee5d224c9a786dbcb3e9 100644 --- a/qt/python/mantidqt/utils/test/test_writetosignal.py +++ b/qt/python/mantidqt/utils/test/test_writetosignal.py @@ -23,7 +23,7 @@ import unittest from qtpy.QtCore import QCoreApplication, QObject # local imports -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from mantidqt.utils.writetosignal import WriteToSignal diff --git a/qt/python/mantidqt/widgets/algorithmselector/test/test_algorithmselector.py b/qt/python/mantidqt/widgets/algorithmselector/test/test_algorithmselector.py index ae0da9bbb0a345b6e979513582c72ddab9d321f8..c346fd1266bd52a75c11d2f2206a298cd5ad8089 100644 --- a/qt/python/mantidqt/widgets/algorithmselector/test/test_algorithmselector.py +++ b/qt/python/mantidqt/widgets/algorithmselector/test/test_algorithmselector.py @@ -23,7 +23,7 @@ import unittest from qtpy.QtCore import Qt from qtpy.QtTest import QTest -from mantidqt.utils.qt.testing import requires_qapp, select_item_in_combo_box, select_item_in_tree +from mantidqt.utils.qt.test import requires_qapp, select_item_in_combo_box, select_item_in_tree from mantidqt.widgets.algorithmselector.model import AlgorithmSelectorModel from mantidqt.widgets.algorithmselector.widget import AlgorithmSelectorWidget diff --git a/qt/python/mantidqt/widgets/codeeditor/test/test_codeeditor.py b/qt/python/mantidqt/widgets/codeeditor/test/test_codeeditor.py index 933547f4e0c0de6cef74fd06ff31cc0c647a8e18..63887f2d8a8d39c8a1d810ae058b4fbfe5eee833 100644 --- a/qt/python/mantidqt/widgets/codeeditor/test/test_codeeditor.py +++ b/qt/python/mantidqt/widgets/codeeditor/test/test_codeeditor.py @@ -21,7 +21,7 @@ import unittest # local imports from mantidqt.widgets.codeeditor.editor import CodeEditor -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp TEST_LANG = "Python" diff --git a/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py b/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py index b0d6a5b7865644ca2882d7d21827ba53437ce2ab..e10529105be6e44c524b5b603224007499ea462c 100644 --- a/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py +++ b/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py @@ -23,7 +23,7 @@ import unittest from qtpy.QtCore import QCoreApplication, QObject # local imports -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from mantidqt.widgets.codeeditor.execution import PythonCodeExecution diff --git a/qt/python/mantidqt/widgets/codeeditor/test/test_interpreter.py b/qt/python/mantidqt/widgets/codeeditor/test/test_interpreter.py index 18cfbb0d85db0bec0e740485ff0572b9750ba0c6..43956c43a5659fb2963b15b8010c2715a1329565 100644 --- a/qt/python/mantidqt/widgets/codeeditor/test/test_interpreter.py +++ b/qt/python/mantidqt/widgets/codeeditor/test/test_interpreter.py @@ -24,7 +24,7 @@ import six # local imports from mantidqt.widgets.codeeditor.interpreter import PythonFileInterpreter -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp if six.PY2: import mock diff --git a/qt/python/mantidqt/widgets/codeeditor/test/test_multifileinterpreter.py b/qt/python/mantidqt/widgets/codeeditor/test/test_multifileinterpreter.py index 2122b51f23169e5cdd40d11ce8fe7bc9426ba3e6..c152e31c23da4dab3d83092c5f1e8451f2b97c50 100644 --- a/qt/python/mantidqt/widgets/codeeditor/test/test_multifileinterpreter.py +++ b/qt/python/mantidqt/widgets/codeeditor/test/test_multifileinterpreter.py @@ -22,7 +22,7 @@ import unittest # third-party library imports # local imports -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp from mantidqt.widgets.codeeditor.multifileinterpreter import MultiPythonFileInterpreter diff --git a/qt/python/mantidqt/widgets/test/test_jupyterconsole.py b/qt/python/mantidqt/widgets/test/test_jupyterconsole.py index b102633b5c92652eb504ccb9f5c5a09dce04a367..c13e8e3c877e1843b54e57fae112bb60eb4b09cf 100644 --- a/qt/python/mantidqt/widgets/test/test_jupyterconsole.py +++ b/qt/python/mantidqt/widgets/test/test_jupyterconsole.py @@ -26,7 +26,7 @@ from qtpy import QT_VERSION # local package imports from mantidqt.widgets.jupyterconsole import InProcessJupyterConsole -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp PRE_IPY5_PY3_QT5 = (sys.version_info.major == 3 and IPython.version_info[0] < 5 and int(QT_VERSION[0]) == 5) diff --git a/qt/python/mantidqt/widgets/test/test_messagedisplay.py b/qt/python/mantidqt/widgets/test/test_messagedisplay.py index 01a2fc1287d9ef0367e118ce9a69ebe7ca346757..665d73c88c00d3c3026ec0cfc86196af4b5e82f6 100644 --- a/qt/python/mantidqt/widgets/test/test_messagedisplay.py +++ b/qt/python/mantidqt/widgets/test/test_messagedisplay.py @@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function, import unittest from mantidqt.widgets.messagedisplay import MessageDisplay -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp @requires_qapp diff --git a/qt/python/mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py b/qt/python/mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py index c58f0c263fc8320d25b9cd3ba5303a9e8f2b3158..bcd52c80976fb17b152005878e17cc4fbbf190c1 100644 --- a/qt/python/mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py +++ b/qt/python/mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py @@ -19,7 +19,7 @@ from __future__ import absolute_import, print_function import unittest from mantidqt.widgets.workspacewidget.workspacetreewidget import WorkspaceTreeWidget -from mantidqt.utils.qt.testing import requires_qapp +from mantidqt.utils.qt.test import requires_qapp @requires_qapp diff --git a/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py b/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py index f8fee5faa670f553f8595f478f3c8bcfede1c4c5..fbb7909906199c03ac31c44a3635f487a6f71d2f 100644 --- a/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py +++ b/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py @@ -24,5 +24,5 @@ from __future__ import (absolute_import, unicode_literals) from mantidqt.utils.qt import import_qt -WorkspaceTreeWidget = import_qt('.._common', 'mantidqt.widgets.workspacewidget', +WorkspaceTreeWidget = import_qt('..._common', 'mantidqt.widgets.workspacewidget', 'WorkspaceTreeWidgetSimple') diff --git a/qt/python/setup.py b/qt/python/setup.py.in similarity index 70% rename from qt/python/setup.py rename to qt/python/setup.py.in index bdfe7f9bd16f6f1e16d2ca037f09879741805526..12ed9d606069c5e990b1b74048429d6fd1ddb27d 100644 --- a/qt/python/setup.py +++ b/qt/python/setup.py.in @@ -16,9 +16,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from setuptools import setup +from setuptools import find_packages, setup + +@SETUPTOOLS_BUILD_COMMANDS_DEF@ # The most basic setup possible to be able to use setup.py develop setup( - name="mantidqt", + name='mantidqt', # must match what is required by workbench setup.py + version='@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@', + packages=find_packages(exclude=['*.test']), + package_data={'mantidqt': ['dialogs/*.ui']}, + @SETUPTOOLS_BUILD_COMMANDS_USE@ ) diff --git a/qt/widgets/common/CMakeLists.txt b/qt/widgets/common/CMakeLists.txt index 58323bb8d146747ce0b1eea469939e39b426d508..2783cc5b2400bd7457126257969078b2630873fe 100644 --- a/qt/widgets/common/CMakeLists.txt +++ b/qt/widgets/common/CMakeLists.txt @@ -531,6 +531,8 @@ mtd_add_qt_library (TARGET_NAME MantidQtWidgetsCommon Qt5::PrintSupport ${_webwidgets_tgt} Qt5::Qscintilla + INSTALL_DIR + ${LIB_DIR} OSX_INSTALL_RPATH @loader_path/../MacOS @loader_path/../Libraries diff --git a/qt/widgets/factory/CMakeLists.txt b/qt/widgets/factory/CMakeLists.txt index 1f6dd12c4dd5f92a61183efd198fe9f8f009c656..be29eaa80bbf78bafb8fd38dcf5315a5bfe24b1b 100644 --- a/qt/widgets/factory/CMakeLists.txt +++ b/qt/widgets/factory/CMakeLists.txt @@ -6,11 +6,11 @@ set ( INC_FILES inc/MantidQtWidgets/Factory/WidgetFactory.h ) -set ( MOC_FILES +set ( MOC_FILES inc/MantidQtWidgets/Factory/WidgetFactory.h ) -set ( UI_FILES +set ( UI_FILES ) set ( TEST_FILES @@ -37,7 +37,8 @@ mtd_add_qt_library (TARGET_NAME MantidQtWidgetsFactory MantidQtWidgetsCommon MantidQtWidgetsLegacyQwt MantidQtWidgetsSliceViewer + INSTALL_DIR + ${LIB_DIR} LINUX_INSTALL_RPATH "\$ORIGIN/../${LIB_DIR}" ) - diff --git a/qt/widgets/instrumentview/CMakeLists.txt b/qt/widgets/instrumentview/CMakeLists.txt index a0573d09f7853c4e3fac66650aecb7591d17e045..e63d30c9986470a3c20b27e65682038b098c6534 100644 --- a/qt/widgets/instrumentview/CMakeLists.txt +++ b/qt/widgets/instrumentview/CMakeLists.txt @@ -135,10 +135,11 @@ mtd_add_qt_library (TARGET_NAME MantidQtWidgetsInstrumentView MTD_QT_LINK_LIBS MantidQtWidgetsCommon MantidQtWidgetsLegacyQwt + INSTALL_DIR + ${LIB_DIR} + OSX_INSTALL_RPATH + @loader_path/../MacOS + @loader_path/../Libraries + LINUX_INSTALL_RPATH + "\$ORIGIN/../${LIB_DIR}" ) - -if (OSX_VERSION VERSION_GREATER 10.8) - set_target_properties(MantidQtWidgetsInstrumentViewQt4 PROPERTIES INSTALL_RPATH "@loader_path/../MacOS;@loader_path/../Libraries") -elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) - set_target_properties(MantidQtWidgetsInstrumentViewQt4 PROPERTIES INSTALL_RPATH "\$ORIGIN/../${LIB_DIR}") -endif () diff --git a/qt/widgets/legacyqwt/CMakeLists.txt b/qt/widgets/legacyqwt/CMakeLists.txt index 004a0271725b9273dc9f2c10eb9ff12b3d7d49fa..d2014997a426d7489ccd0b6ba24417b41fb93768 100644 --- a/qt/widgets/legacyqwt/CMakeLists.txt +++ b/qt/widgets/legacyqwt/CMakeLists.txt @@ -77,6 +77,8 @@ mtd_add_qt_library (TARGET_NAME MantidQtWidgetsLegacyQwt Qwt5 MTD_QT_LINK_LIBS MantidQtWidgetsCommon + INSTALL_DIR + ${LIB_DIR} OSX_INSTALL_RPATH @loader_path/../MacOS LINUX_INSTALL_RPATH diff --git a/qt/widgets/refdetectorview/CMakeLists.txt b/qt/widgets/refdetectorview/CMakeLists.txt index e0f806beb037465e0332b81c78721d8cc9d769e8..2d651511e4ff97ebe1b796c514aad3f57e99f6dc 100644 --- a/qt/widgets/refdetectorview/CMakeLists.txt +++ b/qt/widgets/refdetectorview/CMakeLists.txt @@ -50,14 +50,14 @@ mtd_add_qt_library (TARGET_NAME MantidQtWidgetsRefDetectorView Qwt5 MTD_QT_LINK_LIBS MantidQtWidgetsSpectrumViewer + INSTALL_DIR + ${LIB_DIR} + OSX_INSTALL_RPATH + @loader_path/../MacOS + LINUX_INSTALL_RPATH + "\$ORIGIN/../${LIB_DIR}" ) -if (OSX_VERSION VERSION_GREATER 10.8) - set_target_properties( MantidQtWidgetsRefDetectorViewQt4 PROPERTIES INSTALL_RPATH "@loader_path/../MacOS") -elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) - set_target_properties( MantidQtWidgetsRefDetectorViewQt4 PROPERTIES INSTALL_RPATH "\$ORIGIN/../${LIB_DIR}") -endif () - ########################################################################### # DEMO/GUI TESTING APPLICATIONS ########################################################################### diff --git a/qt/widgets/sliceviewer/CMakeLists.txt b/qt/widgets/sliceviewer/CMakeLists.txt index 3473c45eddebfbe39d90627bd6f1b78a7ed6fd7f..97fe4355fa4b8b60918c1bd932e04dbacc89063e 100644 --- a/qt/widgets/sliceviewer/CMakeLists.txt +++ b/qt/widgets/sliceviewer/CMakeLists.txt @@ -138,6 +138,8 @@ mtd_add_qt_library (TARGET_NAME MantidQtWidgetsSliceViewer MTD_QT_LINK_LIBS MantidQtWidgetsCommon MantidQtWidgetsLegacyQwt + INSTALL_DIR + ${LIB_DIR} OSX_INSTALL_RPATH loader_path/../MacOS LINUX_INSTALL_RPATH diff --git a/qt/widgets/spectrumviewer/CMakeLists.txt b/qt/widgets/spectrumviewer/CMakeLists.txt index 233088f1c7a150dfbf97d02d72335167420906f2..29f1e5638fa6335f628f8b73c36376285d81bd93 100644 --- a/qt/widgets/spectrumviewer/CMakeLists.txt +++ b/qt/widgets/spectrumviewer/CMakeLists.txt @@ -74,6 +74,8 @@ mtd_add_qt_library (TARGET_NAME MantidQtWidgetsSpectrumViewer MTD_QT_LINK_LIBS MantidQtWidgetsCommon MantidQtWidgetsLegacyQwt + INSTALL_DIR + ${LIB_DIR} ) if (OSX_VERSION VERSION_GREATER 10.8)