diff --git a/lang/python/python-augeas/Makefile b/lang/python/python-augeas/Makefile index 67a34e256b..22a098c009 100644 --- a/lang/python/python-augeas/Makefile +++ b/lang/python/python-augeas/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=python-augeas -PKG_VERSION:=1.1.0 -PKG_RELEASE:=2 +PKG_VERSION:=1.2.0 +PKG_RELEASE:=1 PYPI_NAME:=python-augeas -PKG_HASH:=5194a49e86b40ffc57055f73d833f87e39dce6fce934683e7d0d5bbb8eff3b8c +PKG_HASH:=d2334710e12bdec8b6633a7c2b72df4ca24ab79094a3c9e699494fdb62054a10 PKG_MAINTAINER:=Jan Pavlinec , Alexandru Ardelean PKG_LICENSE:=LGPL-2.1-or-later diff --git a/lang/python/python-augeas/patches/001-backport-ffi-fix.patch b/lang/python/python-augeas/patches/001-backport-ffi-fix.patch deleted file mode 100644 index 4009469fb1..0000000000 --- a/lang/python/python-augeas/patches/001-backport-ffi-fix.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 712c2028568df7760bc98d95577e35709078bfea Mon Sep 17 00:00:00 2001 -From: Jeffery To -Date: Sun, 8 Nov 2020 21:51:09 +0800 -Subject: [PATCH] Use CFFI in out-of-line API mode (#49) - -Currently, ffi.py is called during setup to generate augeas.py; this -file would normally be used for out-of-line ABI mode. ffi.py is also -imported at run-time, instead of the generated augeas.py, and used in -in-line ABI mode. - -This changes usage of CFFI to out-of-line API mode (CFFI's "main mode of -usage"): ffi.py is called during setup to generate _augeas.abi3.so (a C -extension module); this generated module is imported at run-time. - -With this change, the headers/development files for augeas (i.e. -libaugeas-dev on Debian, augeas-devel on Fedora, etc.) and the C -compiler are required for build/setup. (These were not necessary -previously.) - -Closes https://github.com/hercules-team/python-augeas/issues/48. ---- - augeas/__init__.py | 2 +- - augeas/ffi.py | 27 ++++++++++++++++++++++----- - setup.py | 1 + - 3 files changed, 24 insertions(+), 6 deletions(-) - ---- a/augeas/__init__.py -+++ b/augeas/__init__.py -@@ -32,7 +32,7 @@ format and the transformation into a tre - - from sys import version_info as _pyver - --from augeas.ffi import ffi, lib -+from _augeas import ffi, lib - - __author__ = "Nathaniel McCallum " - __credits__ = """Jeff Schroeder ---- a/augeas/ffi.py -+++ b/augeas/ffi.py -@@ -1,9 +1,28 @@ -+import os -+import subprocess -+ - from cffi import FFI - -+def get_include_dirs(): -+ XML2_CONFIG = os.environ.get('XML2_CONFIG', 'xml2-config') -+ PKG_CONFIG = os.environ.get('PKG_CONFIG', 'pkg-config') -+ try: -+ stdout = subprocess.check_output([XML2_CONFIG, '--cflags']) -+ except (OSError, subprocess.CalledProcessError): -+ try: -+ stdout = subprocess.check_output([PKG_CONFIG, '--cflags', 'libxml-2.0']) -+ except (OSError, subprocess.CalledProcessError): -+ stdout = b'' -+ cflags = stdout.decode('utf-8').split() -+ return [cflag[2:] for cflag in cflags if cflag.startswith('-I')] -+ - ffi = FFI() --ffi.set_source("augeas", -- None, -- libraries=['augeas']) -+ffi.set_source("_augeas", -+ """ -+ #include -+ """, -+ libraries=['augeas'], -+ include_dirs=get_include_dirs()) - - ffi.cdef(""" - typedef struct augeas augeas; -@@ -44,7 +63,5 @@ const char *aug_error_details(augeas *au - void free(void *); - """) - --lib = ffi.dlopen("augeas") -- - if __name__ == "__main__": - ffi.compile(verbose=True) ---- a/setup.py -+++ b/setup.py -@@ -22,6 +22,7 @@ setup(name=name, - setup_requires=["cffi>=1.0.0"], - cffi_modules=["augeas/ffi.py:ffi"], - install_requires=["cffi>=1.0.0"], -+ zip_safe=False, - url="http://augeas.net/", - classifiers=[ - "Programming Language :: Python :: 2.7", diff --git a/lang/python/python-augeas/test.sh b/lang/python/python-augeas/test.sh new file mode 100644 index 0000000000..b485f280e6 --- /dev/null +++ b/lang/python/python-augeas/test.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +[ "$1" = python3-augeas ] || exit 0 + +python3 - <<'EOF' +import augeas + +# Basic instantiation (in-memory, no files touched) +a = augeas.Augeas(root="/dev/null", loadpath=None, + flags=augeas.Augeas.NO_LOAD | augeas.Augeas.NO_MODL_AUTOLOAD) + +# Set and get a value +a.set("/test/key", "value") +assert a.get("/test/key") == "value", "get after set failed" + +# Match +a.set("/test/a", "1") +a.set("/test/b", "2") +matches = a.match("/test/*") +assert len(matches) == 3, f"Expected 3 matches, got {len(matches)}" + +# Remove +a.remove("/test/key") +assert a.get("/test/key") is None, "Expected None after remove" + +a.close() +print("python-augeas OK") +EOF