From 885bd36f81b65cabdd908a93eed5f2eea2a0b707 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 9 Oct 2023 18:34:16 +0000 Subject: [PATCH] Include dist-info for python3-libdnf This is the libdnf version of this patch [0] for DNF 4. Per [1], Python packages should include some minimal distribution metadata, e.g. to make the package appear in `pip list`. [0] https://github.com/rpm-software-management/dnf/pull/1997 [1] https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata = changelog = msg: Add metadata for `libdnf` Python package type: bugfix --- bindings/python/CMakeLists.txt | 8 ++++++++ libdnf.spec | 1 + 2 files changed, 9 insertions(+) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 32973dce06..097eea4420 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -41,3 +41,11 @@ libdnf_swig_module(utils libdnf ${PYTHON_LIBRARY} ${SQLite3_LIBRARIES}) configure_file(__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py COPYONLY) install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/libdnf) + +set(DISTINFO_PATH "${CMAKE_CURRENT_BINARY_DIR}/libdnf-${LIBDNF_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: libdnf\n") +file(APPEND ${METADATA_FILE} "Version: ${LIBDNF_VERSION}\n") +install(DIRECTORY ${DISTINFO_PATH} DESTINATION ${PYTHON_INSTALL_DIR}) diff --git a/libdnf.spec b/libdnf.spec index 59e9259ded..233a102608 100644 --- a/libdnf.spec +++ b/libdnf.spec @@ -289,6 +289,7 @@ popd %if %{with python3} %files -n python3-%{name} +%{python3_sitearch}/%{name}-*.dist-info %{python3_sitearch}/%{name}/ %endif