Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python bin path and docs #528

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ jobs:
cmake -DTEST_FILE_DIR=/home/runner/data -DCMAKE_INSTALL_PREFIX=./install -DENABLE_PYTHON=ON ..
make -j2 VERBOSE=1
make install
cd python
sudo python3 setup.py install

- name: test
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ jobs:
cmake -DTEST_FILE_DIR=/Users/runner/data -DCMAKE_INSTALL_PREFIX=./install -DENABLE_PYTHON=ON ..
make -j2 VERBOSE=1
make install
cd python
sudo python3 setup.py install

- name: test-bufr
run: |
Expand Down
18 changes: 11 additions & 7 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ file( COPY ncepbufr utils DESTINATION . )

# Library installation directory
set(_PYVER "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(_build_dir "${CMAKE_CURRENT_BINARY_DIR}/site-packages")
set(_lib_dir "${CMAKE_CURRENT_BINARY_DIR}/site-packages")
set(_bin_root "${CMAKE_CURRENT_BINARY_DIR}/bin")

# Build the extension module for use in install tree
add_custom_target(python_mod ALL)
Expand All @@ -22,8 +23,8 @@ add_custom_command(
TARGET python_mod
COMMAND ${Python3_EXECUTABLE} setup.py install
\${__root}
--prefix=${CMAKE_INSTALL_PREFIX}
--install-lib=${_build_dir}
--install-scripts=${_bin_root}
--install-lib=${_lib_dir}
--record=${CMAKE_BINARY_DIR}/extra_install.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS setup.py.in
Expand All @@ -32,11 +33,14 @@ add_custom_command(
if(ENABLE_DOCS)
# Uses pdoc (https://github.com/BurntSushi/pdoc)
find_program(PDOC_EXECUTABLE pdoc REQUIRED)
set(ENV{PYTHONPATH} ${_build_dir})
add_custom_command(COMMAND ${PDOC_EXECUTABLE} -o ../docs/html/python ./ncepbufr WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(python_docs ALL
${CMAKE_COMMAND} -E env PYTHONPATH=${_lib_dir}:$ENV{PYTHONPATH}
${PDOC_EXECUTABLE} -o ../docs/html/python ./ncepbufr
)
endif()

install(DIRECTORY ${_build_dir} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/python${_PYVER})
install(DIRECTORY ${_lib_dir} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/python${_PYVER})
install(PROGRAMS ${_bin_root}/prepbufr2nc DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})

# Add tests
add_test(NAME test_pyncepbufr_checkpoint
Expand Down Expand Up @@ -76,5 +80,5 @@ list(APPEND _python_tests test_pyncepbufr_test)

foreach(_test ${_python_tests})
set_tests_properties(${_test}
PROPERTIES ENVIRONMENT "PYTHONPATH=${_build_dir}:$ENV{PYTHONPATH}")
PROPERTIES ENVIRONMENT "PYTHONPATH=${_lib_dir}:$ENV{PYTHONPATH}")
endforeach()