Skip to content

Commit

Permalink
ENH: Move cmake config items into common itkConfig.py.in file
Browse files Browse the repository at this point in the history
Compiletime file configurations should be kept
to a minimum to avoid complicating debugging

By moving the version string into itkConfig.py.in
we can avoid needing to generate the already
complicated __init__.py file.
  • Loading branch information
hjmjohnson committed Oct 16, 2020
1 parent c7c0736 commit a867b5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
9 changes: 1 addition & 8 deletions Wrapping/Generators/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ if(NOT EXTERNAL_WRAP_ITK_PROJECT)
itkExtras
itkLazy
itkHelpers
itk/__init__
)
# Done listing files.

Expand Down Expand Up @@ -191,20 +192,12 @@ if(NOT EXTERNAL_WRAP_ITK_PROJECT)
"${CMAKE_CURRENT_BINARY_DIR}/${config}/WrapITK.pth"
@ONLY)
# Install the package python files.
set(init_file ${CMAKE_CURRENT_BINARY_DIR}/${config}/itk/__init__.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/itk/__init__.py.in
"${init_file}"
)
WRAP_ITK_PYTHON_BINDINGS_INSTALL(/itk "ITKCommon" ${init_file})
set(python_modules ${ITK_WRAP_PYTHON_INSTALL_FILES})
WRAP_ITK_PYTHON_BINDINGS_INSTALL(/ "ITKCommon" ${python_modules})
endforeach()
else()
# Install the package python files.
set(init_file ${CMAKE_CURRENT_BINARY_DIR}/itk/__init__.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/itk/__init__.py.in
${CMAKE_CURRENT_BINARY_DIR}/itk/__init__.py
)
WRAP_ITK_PYTHON_BINDINGS_INSTALL(/itk "ITKCommon" ${init_file})
set(python_modules ${ITK_WRAP_PYTHON_INSTALL_FILES})
WRAP_ITK_PYTHON_BINDINGS_INSTALL(/ "ITKCommon" ${python_modules})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import os
import sys

__version__ = "@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@"
__version__ = itkConfig.ITK_GLOBAL_VERSION_STRING
thisModule = sys.modules[__name__]


Expand Down
2 changes: 2 additions & 0 deletions Wrapping/Generators/Python/itkConfig.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,7 @@ if "WRAPITK_PYTHON_PATH" in os.environ:

doxygen_root = normalized_path("../Doc")

ITK_GLOBAL_VERSION_STRING :str = "@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@"

del normalized_path
del os

0 comments on commit a867b5e

Please sign in to comment.