Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
python-version: '3.x'

- name: Build wheels for CPython
uses: pypa/cibuildwheel@v3.3.1
uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_ARCHS: auto64
CIBW_SKIP: "pp* *-musllinux_* cp36* cp37* cp38*" # no PyPy or musl builds, no older Python versions
CIBW_SKIP: "pp* *-musllinux_* cp38* cp39* cp310*" # no PyPy or musl builds, no older Python versions
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 # alma 8
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_BEFORE_ALL_LINUX: dnf -y install epel-release && yes | dnf -y builddep libcomps.spec
Expand Down
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
graft libcomps*
include version.cmake
include version.json
include VERSION
include pyproject.toml
include setup.py
include COPYING
include README.md
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.24
7 changes: 6 additions & 1 deletion build_prep.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ MACRO(MAKE_LOGENTRY log_entry commit)
set(log_entry "${FMT_FINAL}")
ENDMACRO(MAKE_LOGENTRY)

include (${CMAKE_SOURCE_DIR}/libcomps/version.cmake)
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VERSION)
string(STRIP "${VERSION}" VERSION)
string(REPLACE "." ";" VERSION_LIST ${VERSION})
list(GET VERSION_LIST 0 libcomps_VERSION_MAJOR)
list(GET VERSION_LIST 1 libcomps_VERSION_MINOR)
list(GET VERSION_LIST 2 libcomps_VERSION_PATCH)

SET(changelog_commits 946584c5a01d83bf9ec4c26d3f9d73e37bfb5456;
76764059f1085abbd0eeaeab64f45ec48a58ba4d;
Expand Down
3 changes: 1 addition & 2 deletions libcomps.spec
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Documentation files for python bindings libcomps library.
%package -n python3-%{name}
Summary: Python 3 bindings for libcomps library
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: make
%{?python_provide:%python_provide python3-%{name}}
Requires: %{name}%{?_isa} = %{version}-%{release}
Expand Down Expand Up @@ -113,6 +112,6 @@ popd

%files -n python3-%{name}
%{python3_sitearch}/%{name}/
%{python3_sitearch}/%{name}-*-py%{python3_version}.egg-info
%{python3_sitearch}/%{name}-*.dist-info

%changelog
10 changes: 7 additions & 3 deletions libcomps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ endif()

include (GNUInstallDirs)
include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
include (${CMAKE_SOURCE_DIR}/version.cmake)
file(READ "${CMAKE_SOURCE_DIR}/../VERSION" VERSION)
string(STRIP "${VERSION}" VERSION)
string(REPLACE "." ";" VERSION_LIST ${VERSION})
list(GET VERSION_LIST 0 libcomps_VERSION_MAJOR)
list(GET VERSION_LIST 1 libcomps_VERSION_MINOR)
list(GET VERSION_LIST 2 libcomps_VERSION_PATCH)
set (libcomps_RELEASE 1)
#set (CMAKE_CXX_COMPILER g++)

OPTION (ENABLE_TESTS "Build test?" ON)
Expand All @@ -20,8 +26,6 @@ set(LIBCOMPS_OUT "${CMAKE_CURRENT_BINARY_DIR}/src")

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --pedantic -std=c99 -Wall -Wextra -Wno-missing-field-initializers -O2 -fno-strict-aliasing")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb -O0 -Wall -Wextra")

set (VERSION "${libcomps_VERSION_MAJOR}.${libcomps_VERSION_MINOR}.${libcomps_VERSION_PATCH}")
#set (libcomps_SOURCE comps_list.c)
#set (libcomps_HEADERS comps_list.h)

Expand Down
75 changes: 31 additions & 44 deletions libcomps/src/python/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ set (pycomps_HEADERS pycomps_macros.h pycomps_sequence.h
pycomps_hash.h pycomps_exc.h pycomps_lbw.h
pycomps_types.h)

#set(TEST_FILES ../__init__.py __test.py test_merge_comps.py test_libcomps.py
# utest.py)
#
#set(TEST_COMPS fedora_comps.xml sample_comps.xml
# sample_comps2.xml sample_comps2.xml.gz main_comps.xml
# main_comps2.xml main_arches.xml f21-rawhide-comps.xml
# comps-f21.xml.in
# comps/comps_part1.xml comps/comps_part2.xml
# comps/merged_comps_1_2.xml comps/merged_comps_2_1.xml
# comps/comps-f21.xml)

list (LENGTH pycomps_SRC pycomps_SRCLEN)
math (EXPR pycomps_SRCLEN "${pycomps_SRCLEN} - 1")
foreach(i RANGE 0 ${pycomps_SRCLEN})
Expand All @@ -42,12 +31,6 @@ foreach(i RANGE 0 ${pycomps_SRCLEN})
LIST_REPLACE(pycomps_HEADERS ${i} "${CMAKE_CURRENT_SOURCE_DIR}/${val}")
endforeach(i)

if (NOT SKBUILD)
find_package (PythonInterp 3 EXACT REQUIRED)
find_package (PythonLibs 3 EXACT)
endif(NOT SKBUILD)

include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${LIBCOMPS_INCLUDE_PATH})

if (ENABLE_TESTS)
Expand All @@ -56,21 +39,29 @@ endif ()

include(../pycopy.cmake)

add_library(pycomps SHARED ${pycomps_SRC})
set_target_properties(pycomps PROPERTIES LIBRARY_OUTPUT_DIRECTORY "./libcomps")
set_target_properties(pycomps PROPERTIES PREFIX "")
set_target_properties(pycomps PROPERTIES LIBRARY_OUTPUT_NAME "_libpycomps")
Comment thread
kontura marked this conversation as resolved.
add_dependencies(pycomps src-copy)

target_link_libraries(pycomps libcomps)
target_link_libraries(pycomps ${EXPAT_LIBRARIES})
target_link_libraries(pycomps ${LIBXML2_LIBRARIES})
IF (SKBUILD)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
Python_add_library(pycomps MODULE ${pycomps_SRC})
set_target_properties(pycomps PROPERTIES OUTPUT_NAME "_libpycomps")
ELSE ()
find_package (PythonInterp 3 EXACT REQUIRED)
find_package (PythonLibs 3 EXACT)
include_directories(${PYTHON_INCLUDE_DIR})

if (NOT SKBUILD)
add_library(pycomps SHARED ${pycomps_SRC})
set_target_properties(pycomps PROPERTIES PREFIX "")
set_target_properties(pycomps PROPERTIES LIBRARY_OUTPUT_NAME "_libpycomps")
# manylinux links statically, no libpythonX.so available
# https://github.com/pypa/manylinux/issues/255#issuecomment-450761634
target_link_libraries(pycomps ${PYTHON_LIBRARIES})
endif (NOT SKBUILD)
target_link_libraries(pycomps PRIVATE ${PYTHON_LIBRARIES})
ENDIF ()

set_target_properties(pycomps PROPERTIES LIBRARY_OUTPUT_DIRECTORY "./libcomps")
add_dependencies(pycomps src-copy)

target_link_libraries(pycomps PRIVATE libcomps)
target_link_libraries(pycomps PRIVATE ${EXPAT_LIBRARIES})
target_link_libraries(pycomps PRIVATE ${LIBXML2_LIBRARIES})

if (ENABLE_TESTS)
set(pycopy pytest_run)
Expand All @@ -82,23 +73,19 @@ if (ENABLE_TESTS)
endif ()

IF (SKBUILD)
INSTALL(FILES libcomps/__init__.py DESTINATION libcomps/src/python/src/libcomps)
INSTALL(TARGETS pycomps LIBRARY DESTINATION libcomps/src/python/src/libcomps)
INSTALL(FILES libcomps/__init__.py DESTINATION libcomps)
INSTALL(TARGETS pycomps LIBRARY DESTINATION libcomps)
ELSE ()
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('platlib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)

INSTALL(FILES ${pycomps_SRCDIR}/libcomps/__init__.py DESTINATION ${PYTHON_INSTALL_DIR}/libcomps)
#INSTALL(FILES ${pycomps_SRCDIR}/tests/__test.py DESTINATION
# ${PYTHON_INSTALL_DIR}/libcomps/)
#INSTALL(FILES ${pycomps_SRCDIR}/tests/fedora_comps.xml DESTINATION
# ${PYTHON_INSTALL_DIR}/libcomps/)
#INSTALL(FILES ${pycomps_SRCDIR}/tests/sample_comps.xml DESTINATION
# ${PYTHON_INSTALL_DIR}/libcomps/)
#INSTALL(FILES ${pycomps_SRCDIR}/tests/main_comps.xml DESTINATION
# ${PYTHON_INSTALL_DIR}/libcomps/)
#INSTALL(FILES ${pycomps_SRCDIR}/tests/main_comps2.xml DESTINATION
# ${PYTHON_INSTALL_DIR}/libcomps/)
INSTALL (TARGETS pycomps LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/libcomps)
# Version has to be passed as last argument.
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/../setup_for_python_metadata.py install_egg_info --install-dir \$ENV{DESTDIR}/${PYTHON_INSTALL_DIR}/ ${VERSION})")
ENDIF (SKBUILD)
# Install dist-info metadata so distro packaging tools can discover this package
SET(_DIST_INFO_DIR "${PYTHON_INSTALL_DIR}/libcomps-${VERSION}.dist-info")
INSTALL(CODE "
file(MAKE_DIRECTORY \$ENV{DESTDIR}/${_DIST_INFO_DIR})
file(WRITE \$ENV{DESTDIR}/${_DIST_INFO_DIR}/METADATA \"Metadata-Version: 2.1\\nName: libcomps\\nVersion: ${VERSION}\\n\")
file(WRITE \$ENV{DESTDIR}/${_DIST_INFO_DIR}/INSTALLER \"cmake\\n\")
file(WRITE \$ENV{DESTDIR}/${_DIST_INFO_DIR}/RECORD \"\")
")
ENDIF ()
5 changes: 0 additions & 5 deletions libcomps/version.cmake

This file was deleted.

5 changes: 0 additions & 5 deletions libcomps/version.cmake.in

This file was deleted.

42 changes: 40 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
[build-system]
requires = ["setuptools", "wheel", "scikit-build"]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"

[project]
name = "libcomps"
description = "Comps XML file manipulation library"
readme = "README.md"
license = "GPL-2.0-or-later"
dynamic = ["version"]
authors = [
{name = "RPM Software Management", email = "rpm-ecosystem@lists.rpm.org"},
]
classifiers = [
"Operating System :: POSIX :: Linux",
"Programming Language :: C",
"Topic :: System :: Software Distribution",
"Topic :: System :: Systems Administration",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]

[project.urls]
Homepage = "https://github.com/rpm-software-management/libcomps"

[tool.scikit-build]
cmake.source-dir = "libcomps"
cmake.args = [
"-DBUILD_LIBCOMPS_SHARED:BOOL=OFF",
"-DENABLE_DEVELOPMENT:BOOL=OFF",
"-DENABLE_DOCS:BOOL=OFF",
"-DENABLE_TESTS:BOOL=OFF",
]
metadata.version.provider = "scikit_build_core.metadata.regex"
metadata.version.input = "VERSION"
metadata.version.regex = "(?P<value>.+)"
19 changes: 6 additions & 13 deletions rel-bump.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
#!/bin/env python3
import json
import string

if __name__ == "__main__":
with open("version.json", "r", encoding="utf-8") as f:
version = json.load(f)
version["libcomps_RELEASE"] += 1
with open("VERSION", "r", encoding="utf-8") as f:
version = f.read().strip()

with open("version.json", "w", encoding="utf-8") as f:
json.dump(version, f, indent=4)
major, minor, release = version.split(".")
release = str(int(release) + 1)

with open("libcomps/version.cmake.in", "r", encoding="utf-8") as f:
version_in = f.read()

version_out = string.Template(version_in).substitute(version)
with open("libcomps/version.cmake", "w", encoding="utf-8") as f:
f.write(version_out)
with open("VERSION", "w", encoding="utf-8") as f:
f.write(f"{major}.{minor}.{release}\n")
54 changes: 0 additions & 54 deletions setup.py

This file was deleted.

31 changes: 0 additions & 31 deletions setup_for_python_metadata.py

This file was deleted.

Loading
Loading