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

generate dist-info for Python bindings #447

Merged
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
9 changes: 9 additions & 0 deletions bindings/python3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ function(add_python3_module LIBRARY_NAME MODULE_NAME)
swig_link_libraries(${TARGET_NAME} ${C_LIBRARY_NAME})
swig_link_libraries(${TARGET_NAME} ${Python3_LIBRARIES})

# generate a dist-info for the library (redundantly created for multi-module packages, oh well...)
set(DISTINFO_PATH "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}-${CMAKE_PROJECT_VERSION}.dist-info")
set(METADATA_FILE "${DISTINFO_PATH}/METADATA")
file(MAKE_DIRECTORY ${DISTINFO_PATH})
file(WRITE ${METADATA_FILE} "Metadata-Version: 2.1\n")
file(APPEND ${METADATA_FILE} "Name: ${LIBRARY_NAME}\n")
file(APPEND ${METADATA_FILE} "Version: ${CMAKE_PROJECT_VERSION}\n")

install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${Python3_SITEARCH}/${LIBRARY_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py DESTINATION ${Python3_SITEARCH}/${LIBRARY_NAME})
install(DIRECTORY ${DISTINFO_PATH} DESTINATION ${Python3_SITEARCH})
endfunction()


Expand Down
2 changes: 2 additions & 0 deletions dnf5.spec
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ Python 3 bindings for the libdnf library.

%files -n python3-libdnf5
%{python3_sitearch}/libdnf5
%{python3_sitearch}/libdnf5-*.dist-info
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this could also use the global project major/minor/patch vars to avoid the wildcard- can update that to do so if desired.

%license COPYING.md
%license lgpl-2.1.txt
%endif
Expand All @@ -395,6 +396,7 @@ Python 3 bindings for the libdnf5-cli library.

%files -n python3-libdnf5-cli
%{python3_sitearch}/libdnf5_cli
%{python3_sitearch}/libdnf5_cli-*.dist-info
%license COPYING.md
%license lgpl-2.1.txt
%endif
Expand Down