From 8889e7972266140a72e06c6f4ea9b504bb87a27c Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Tue, 16 Apr 2024 19:42:31 -0500 Subject: [PATCH 1/9] modify pyinstall process --- CMakeLists.txt | 23 ++++++++++++++++------- cyclus/CMakeLists.txt | 3 --- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d974fde905..e8203738ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -307,10 +307,11 @@ IF(NOT CYCLUS_DOC_ONLY) # # Use new Python library finder find_package (Python3 COMPONENTS Interpreter Development NumPy) - - execute_process(COMMAND "${Python3_EXECUTABLE}" -m site --user-site - OUTPUT_VARIABLE PYTHON_SITE_PACKAGES - OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT DEFINED PYTHON_SITE_PACKAGES) + execute_process(COMMAND "${Python3_EXECUTABLE}" -m site --user-site + OUTPUT_VARIABLE PYTHON_SITE_PACKAGES + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() message("-- PYTHON_EXECUTABLE: ${Python3_EXECUTABLE}") message("-- PYTHON_SITE_PACKAGES: ${PYTHON_SITE_PACKAGES}") @@ -437,9 +438,17 @@ IF(NOT CYCLUS_DOC_ONLY) ) if(Cython_FOUND) - set(pyinstallscript "${CMAKE_CURRENT_BINARY_DIR}/cmake/SetupPyInstall.cmake") - configure_file(cmake/SetupPyInstall.cmake.in ${pyinstallscript} @ONLY) - install(SCRIPT ${pyinstallscript}) + install(CODE " + message(\"############### Begin Python Install ###############\") + set(ENV{CYCLUS_PROJECT_VERSION} \"${CMAKE_PROJECT_VERSION}\") + execute_process(COMMAND ${Python3_EXECUTABLE} -m pip install --target=${PYTHON_SITE_PACKAGES} --force-reinstall --upgrade --no-deps . + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + RESULT_VARIABLE res_var) + Message(\"res var is ${res_var}\") + if(NOT \"${res_var}\" STREQUAL \"\") + message(FATAL_ERROR \"Process python -m pip install failed, res_var = '${res_var}'\") + endif() + ") endif(Cython_FOUND) ############################################################################################## ################################## begin uninstall target #################################### diff --git a/cyclus/CMakeLists.txt b/cyclus/CMakeLists.txt index 4177e08b42..82edcfc88c 100644 --- a/cyclus/CMakeLists.txt +++ b/cyclus/CMakeLists.txt @@ -42,6 +42,3 @@ foreach(file ${CYCLUS_CYTHON_FILES}) # by setup.py, along with the pure python files. install(TARGETS ${targ} LIBRARY DESTINATION "${PYTHON_SITE_PACKAGES}/cyclus") endforeach() - -FILE(GLOB CYCLUS_PYTHON_FILES "${CYCLUS_PYSOURCE_DIR}/*.py") -INSTALL(FILES ${CYCLUS_PYTHON_FILES} DESTINATION "${PYTHON_SITE_PACKAGES}/cyclus") From cfb2ea718d3042f01b03457558ad37441c9ae4dd Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Tue, 16 Apr 2024 20:13:44 -0500 Subject: [PATCH 2/9] Minor changes --- CMakeLists.txt | 1 - cmake/SetupPyInstall.cmake.in | 26 -------------------------- docker/Dockerfile | 1 - 3 files changed, 28 deletions(-) delete mode 100644 cmake/SetupPyInstall.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index e8203738ae..bcdc2fc6f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -444,7 +444,6 @@ IF(NOT CYCLUS_DOC_ONLY) execute_process(COMMAND ${Python3_EXECUTABLE} -m pip install --target=${PYTHON_SITE_PACKAGES} --force-reinstall --upgrade --no-deps . WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE res_var) - Message(\"res var is ${res_var}\") if(NOT \"${res_var}\" STREQUAL \"\") message(FATAL_ERROR \"Process python -m pip install failed, res_var = '${res_var}'\") endif() diff --git a/cmake/SetupPyInstall.cmake.in b/cmake/SetupPyInstall.cmake.in deleted file mode 100644 index 78800d2c6e..0000000000 --- a/cmake/SetupPyInstall.cmake.in +++ /dev/null @@ -1,26 +0,0 @@ -# -# Runs setup.py install -# -set(PYTHON_EXECUTABLE @Python3_EXECUTABLE@) -set(CYCLUS_PROJECT_VERSION @CMAKE_PROJECT_VERSION@) -set(ENV{CYCLUS_PROJECT_VERSION} "${CYCLUS_PROJECT_VERSION}") -message("############### Begin Python Install ###############") -message("-- Python installer:") -message(" PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}") -message(" CYCLUS_PROJECT_VERSION: ${CYCLUS_PROJECT_VERSION}") -message(" CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") -set(CMAKE_CURRENT_BINARY_DIR @CMAKE_CURRENT_BINARY_DIR@) -message(" CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}") -execute_process(COMMAND ${PYTHON_EXECUTABLE} -m site --user-site - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - OUTPUT_VARIABLE site_packages - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE res_var) -message(" PYTHON_SITE_PACKAGES: ${site_packages}") -execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --target=${site_packages} --force-reinstall --upgrade --no-deps . - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - RESULT_VARIABLE res_var) -if(NOT "${res_var}" STREQUAL "0") - message(FATAL_ERROR "Process python -m pip install failed, res_var = '${res_var}'") -endif() -message("############### End Python Install ###############") diff --git a/docker/Dockerfile b/docker/Dockerfile index 40d411378d..69be5a1e63 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -150,7 +150,6 @@ WORKDIR /cyclus # for further CMake debugging. RUN python install.py -j ${make_cores} --build-type=Release --allow-milps ENV PATH /root/.local/bin:$PATH -ENV LD_LIBRARY_PATH /root/.local/lib:/root/.local/lib/cyclus FROM cyclus as deb-generation WORKDIR /cyclus/build From 9e64e29dd84733da562a231edaeccd7ec64ebcb2 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Tue, 16 Apr 2024 21:32:28 -0500 Subject: [PATCH 3/9] change references to cycpp in tests --- tests/cycpp_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cycpp_test.py b/tests/cycpp_test.py index ca853582f3..4dc932af36 100644 --- a/tests/cycpp_test.py +++ b/tests/cycpp_test.py @@ -13,20 +13,20 @@ sys.path.insert(0, os.path.join(cycdir, 'cli')) # pass 1 Filters -from cycpp import NamespaceFilter, TypedefFilter, UsingFilter,\ +from cyclus.cycpp import NamespaceFilter, TypedefFilter, UsingFilter,\ UsingNamespaceFilter, NamespaceAliasFilter, ClassFilter, \ AccessFilter, PragmaCyclusErrorFilter # pass 2 Filters -from cycpp import VarDecorationFilter, VarDeclarationFilter, ExecFilter, \ +from cyclus.cycpp import VarDecorationFilter, VarDeclarationFilter, ExecFilter, \ NoteDecorationFilter, StateAccumulator # pass 3 Filters -from cycpp import CloneFilter, InitFromCopyFilter, \ +from cyclus.cycpp import CloneFilter, InitFromCopyFilter, \ InitFromDbFilter, InfileToDbFilter, SchemaFilter, SnapshotFilter, \ SnapshotInvFilter, InitInvFilter, DefaultPragmaFilter, AnnotationsFilter -import cycpp +import cyclus.cycpp as cycpp class MockMachine(object): def __init__(self): From c24b088957839ab6255ddb4c1f64d41e073b3f60 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 17 Apr 2024 08:30:13 -0500 Subject: [PATCH 4/9] add ending message to python install --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcdc2fc6f7..ae6a6b36d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -447,6 +447,7 @@ IF(NOT CYCLUS_DOC_ONLY) if(NOT \"${res_var}\" STREQUAL \"\") message(FATAL_ERROR \"Process python -m pip install failed, res_var = '${res_var}'\") endif() + message(\"Cyclus Python package successfully installed in ${PYTHON_SITE_PACKAGES}\") ") endif(Cython_FOUND) ############################################################################################## From 11a031951a83678d7b97dfc348c748d396863076 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 17 Apr 2024 08:53:12 -0500 Subject: [PATCH 5/9] use suggeseted boost package --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 69be5a1e63..96d94a63ff 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -85,7 +85,7 @@ RUN conda update -y --all && \ liblapack \ pkg-config \ coincbc \ - boost-cpp \ + libboost-devel \ hdf5 \ sqlite \ pcre \ From 2a4d293efa5fe18d6a01e34cd6bc80531fea405f Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 17 Apr 2024 09:23:04 -0500 Subject: [PATCH 6/9] update changelog --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e0e316ff1e..fb6683f0eb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -38,7 +38,7 @@ Since last release **Changed:** * Moved to unified CHANGELOG Entry and check them with GithubAction (#1571) -* Major update and modernization of build (#1587, #1632, #1734) +* Major update and modernization of build (#1587, #1632, #1734, #1737) * Changed Json formatting for compatibility with current python standards (#1587) * Changed README.rst installation instructions, tested on fresh Ubuntu-22.04 system with Python 3.11 (#1617, #1644) * Resolved various compilation warnings due to use of deprecated APIs (#1671) From e50ccf5298aa813aecbc53b3fb4b5c0ff9163ab2 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:39:11 -0500 Subject: [PATCH 7/9] update FindCyclus.cmake to find the cython modules --- cmake/FindCyclus.cmake | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/cmake/FindCyclus.cmake b/cmake/FindCyclus.cmake index 873c317d24..2a2fecea59 100644 --- a/cmake/FindCyclus.cmake +++ b/cmake/FindCyclus.cmake @@ -88,6 +88,30 @@ FIND_LIBRARY(CYCLUS_CORE_LIBRARY NAMES cyclus /opt/local /opt/local/cyclus PATH_SUFFIXES cyclus/lib lib) +# Look for the library +FIND_LIBRARY(CYCLUS_EVENTHOOKS_LIBRARY NAMES eventhooks.so + HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus" + ${DEPS_CYCLUS} + /usr/local/cyclus/lib /usr/local/cyclus + /opt/local /opt/local/cyclus + PATH_SUFFIXES cyclus/lib lib) + +# Look for the library +FIND_LIBRARY(CYCLUS_PYINFILE_LIBRARY NAMES pyinfile.so + HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus" + ${DEPS_CYCLUS} + /usr/local/cyclus/lib /usr/local/cyclus + /opt/local /opt/local/cyclus + PATH_SUFFIXES cyclus/lib lib) + +# Look for the library +FIND_LIBRARY(CYCLUS_PYMODULE_LIBRARY NAMES pymodule.so + HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus" + ${DEPS_CYCLUS} + /usr/local/cyclus/lib /usr/local/cyclus + /opt/local /opt/local/cyclus + PATH_SUFFIXES cyclus/lib lib) + # Look for the library FIND_LIBRARY(CYCLUS_AGENT_TEST_LIBRARY NAMES baseagentunittests HINTS "${CYCLUS_ROOT_DIR}" "${CYCLUS_ROOT_DIR}/cyclus" @@ -112,6 +136,17 @@ IF(CYCLUS_CORE_INCLUDE_DIR AND CYCLUS_CORE_TEST_INCLUDE_DIR AND CYCLUS_AGENT_TEST_LIBRARY) SET(CYCLUS_CORE_FOUND 1) SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARY}") + # if Cyclus was installed without Cython these three libraries won't be found because they don't exist + # if Cyclus was installed WITH Cython we need to link against them + if(NOT ${CYCLUS_EVENTHOOKS_LIBRARY} STREQUAL "CYCLUS_EVENTHOOKS_LIBRARY-NOTFOUND") + SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARIES}" "${CYCLUS_EVENTHOOKS_LIBRARY}") + endif() + if(NOT ${CYCLUS_PYINFILE_LIBRARY} STREQUAL "CYCLUS_PYINFILE_LIBRARY-NOTFOUND") + SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARIES}" "${CYCLUS_PYINFILE_LIBRARY}") + endif() + if(NOT ${CYCLUS_PYMODULE_LIBRARY} STREQUAL "CYCLUS_PYMODULE_LIBRARY-NOTFOUND") + SET(CYCLUS_CORE_LIBRARIES "${CYCLUS_CORE_LIBRARIES}" "${CYCLUS_PYMODULE_LIBRARY}") + endif() SET(CYCLUS_TEST_LIBRARIES "${CYCLUS_GTEST_LIBRARY}" "${CYCLUS_AGENT_TEST_LIBRARY}") SET(CYCLUS_AGENT_TEST_LIBRARIES "${CYCLUS_AGENT_TEST_LIBRARY}") SET(CYCLUS_CORE_INCLUDE_DIRS "${CYCLUS_CORE_INCLUDE_DIR}") From 0005bea441839fd2f12ebe09436c7b3e81152aef Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Sat, 20 Apr 2024 13:35:29 -0500 Subject: [PATCH 8/9] require python components --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae6a6b36d0..2f2f63ee97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,7 +306,7 @@ IF(NOT CYCLUS_DOC_ONLY) # Cython & Python Bindings # # Use new Python library finder - find_package (Python3 COMPONENTS Interpreter Development NumPy) + find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy) if(NOT DEFINED PYTHON_SITE_PACKAGES) execute_process(COMMAND "${Python3_EXECUTABLE}" -m site --user-site OUTPUT_VARIABLE PYTHON_SITE_PACKAGES From 80023338b034a053d8a797b1b4ac055c5c92ffa0 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Sat, 20 Apr 2024 13:50:18 -0500 Subject: [PATCH 9/9] change repository back to cyclus in publish_release.yml --- .github/workflows/publish_release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 95a00b82f4..4800fded31 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -34,7 +34,7 @@ jobs: echo "stable_tag=ci-image-cache" >> "$GITHUB_ENV" - name: Tag as stable - if: ${{ github.repository_owner == 'bennibbelink' && github.event_name == 'release' }} + if: ${{ github.repository_owner == 'cyclus' && github.event_name == 'release' }} run: | echo "version_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV" echo "stable_tag=stable" >> "$GITHUB_ENV" @@ -60,8 +60,8 @@ jobs: push: true target: cyclus tags: | - ghcr.io/bennibbelink/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{ env.version_tag }} - ghcr.io/bennibbelink/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{ env.stable_tag }} + ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{ env.version_tag }} + ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{ env.stable_tag }} build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} @@ -108,7 +108,7 @@ jobs: echo "stable_tag=ci-image-cache" >> "$GITHUB_ENV" - name: Tag as stable - if: ${{ github.repository_owner == 'bennibbelink' && github.event_name == 'release' }} + if: ${{ github.repository_owner == 'cyclus' && github.event_name == 'release' }} run: | echo "version_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV" echo "stable_tag=stable" >> "$GITHUB_ENV" @@ -133,7 +133,7 @@ jobs: file: docker/Rocky.dockerfile push: true tags: | - ghcr.io/bennibbelink/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:${{ env.version_tag }} - ghcr.io/bennibbelink/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:${{ env.stable_tag }} + ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:${{ env.version_tag }} + ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:${{ env.stable_tag }} build-args: | rocky_version=${{ matrix.rocky_versions }}