diff --git a/cmake/pip.cmake b/cmake/pip.cmake index 2617ab25..4ee35aa1 100644 --- a/cmake/pip.cmake +++ b/cmake/pip.cmake @@ -1,13 +1,18 @@ # Check all Pip modules exist -# Author : K. Zarebski -# Date : last modified 2020-11-05 +# Author : PROCESS Team (UKAEA) +# Date : last modified 2023-07-24 # # Checks to see if all Python module requirements are satisfied else # runs python pip on the requirements file MACRO(PIP_INSTALL) SET(PIP_NAME "pip_installs") - + if ( RELEASE ) + SET(RELEASE TRUE) + else() + SET(RELEASE FALSE) + endif() + EXECUTE_PROCESS( COMMAND bash -c "${Python3_EXECUTABLE} -c \"import ford\"" OUTPUT_VARIABLE FORD_CHECK @@ -35,6 +40,7 @@ MACRO(PIP_INSTALL) ENDIF() SET(MODULE_REQUIREMENTS_FILE ${CMAKE_SOURCE_DIR}/requirements.txt) + SET(DEVELOP_REQUIREMENTS_FILE ${CMAKE_SOURCE_DIR}/requirements_dev.txt) STRING(REPLACE "/" "_" PIP_OUT_PREFIX ${Python3_EXECUTABLE}) SET(PIP_COMPLETE_FILE ${CMAKE_BINARY_DIR}/${PIP_OUT_PREFIX}.touch) ADD_CUSTOM_TARGET( @@ -44,12 +50,22 @@ MACRO(PIP_INSTALL) # Manually install numpy as including it in requirements doesnt install it # It is a pre-requisite to f90wrap install - ADD_CUSTOM_COMMAND( - OUTPUT ${PIP_COMPLETE_FILE} - COMMAND ${Python3_EXECUTABLE} -m pip install numpy - COMMAND ${Python3_EXECUTABLE} -m pip install -r ${MODULE_REQUIREMENTS_FILE} - COMMAND touch ${PIP_COMPLETE_FILE} - ) + if (${RELEASE}) + ADD_CUSTOM_COMMAND( + OUTPUT ${PIP_COMPLETE_FILE} + COMMAND ${Python3_EXECUTABLE} -m pip install numpy + COMMAND ${Python3_EXECUTABLE} -m pip install -r ${MODULE_REQUIREMENTS_FILE} + COMMAND touch ${PIP_COMPLETE_FILE} + ) + else() + ADD_CUSTOM_COMMAND( + OUTPUT ${PIP_COMPLETE_FILE} + COMMAND ${Python3_EXECUTABLE} -m pip install numpy + COMMAND ${Python3_EXECUTABLE} -m pip install -r ${MODULE_REQUIREMENTS_FILE} + COMMAND ${Python3_EXECUTABLE} -m pip install -r ${DEVELOP_REQUIREMENTS_FILE} + COMMAND touch ${PIP_COMPLETE_FILE} + ) + endif() ADD_DEPENDENCIES(${PIP_NAME} ford_git) ENDMACRO() diff --git a/requirements.txt b/requirements.txt index 96bba206..39ab315a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,21 +10,14 @@ matplotlib>=2.1.1 pillow>=5.1.0 Markdown>=3.2.2,<3.4 toposort>=1.5 -pytest>=5.4.1 netCDF4>=1.5.4 wheel>=0.36.2 jupyter==1.0.0 pdf2image==1.16.0 -pre-commit>=2.16.0 -black>=22.3.0,<=23.0.0 -flake8>=5.0.4 -pytest-cov>=3.0.0 -pytest-xdist>=2.5.0 numba>=0.55.2 pandas>=1.1.5 bokeh==2.4.0 mkdocstrings==0.18.0 -flinter==0.3.0 PyVMCON>=2.1.0,<3.0.0 CoolProp>=6.4 Jinja2>=3.0 diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 00000000..7b95b8b5 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,7 @@ +black>=22.3.0,<=23.0.0 +flake8>=5.0.4 +flinter==0.3.0 +pre-commit>=2.16.0 +pytest>=5.4.1 +pytest-cov>=3.0.0 +pytest-xdist>=2.5.0