Skip to contentSkip to conversation

package/python-augeas: new package

PATCH New Thomas Petazzoni 2 participants 4 messages Jun 21, 2021 – Jun 25, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python-augeas: new package

We backport an upstream patch that fixes the loading of the native library by the FFI logic. Without this, "import augeas" doesn't work as it goes into the ctypes.utils.find_library() logic that tries to use a compiler on the target to find the augeas native library.

Based on initial work from Nicolas Carrier <[email protected]>

---
 DEVELOPERS                                    |   2 +
 package/Config.in                             |   1 +
 ...-Use-CFFI-in-out-of-line-API-mode-49.patch | 101 ++++++++++++++++++
 package/python-augeas/Config.in               |   8 ++
 package/python-augeas/python-augeas.hash      |   3 +
 package/python-augeas/python-augeas.mk        |  21 ++++
 6 files changed, 136 insertions(+)
 create mode 100644 package/python-augeas/0001-Use-CFFI-in-out-of-line-API-mode-49.patch
 create mode 100644 package/python-augeas/Config.in
 create mode 100644 package/python-augeas/python-augeas.hash
 create mode 100644 package/python-augeas/python-augeas.mk
DEVELOPERS +2 -0
index f6621e9670..06d311a085 100644
@@ -1986,6 +1986,7 @@ F:	configs/galileo_defconfig
 
 N:	Nicolas Carrier <[email protected]>
 F:	package/php-xdebug/
+F:	package/python-augeas/
 
 N:	Nicolas Cavallari <[email protected]>
 F:	package/libgit2/
@@ -2672,6 +2673,7 @@ F:	package/pkg-autotools.mk
 F:	package/pkg-generic.mk
 F:	package/python/
 F:	package/python3/
+F:	package/python-augeas/
 F:	package/python-mad/
 F:	package/python-serial/
 F:	package/qextserialport/
package/Config.in +1 -0
index cb8ece4919..35e6d4d493 100644
@@ -908,6 +908,7 @@ menu "External python modules"
 	source "package/python-async-lru/Config.in"
 	source "package/python-async-timeout/Config.in"
 	source "package/python-attrs/Config.in"
+	source "package/python-augeas/Config.in"
 	source "package/python-autobahn/Config.in"
 	source "package/python-automat/Config.in"
 	source "package/python-avro/Config.in"
package/python-augeas/0001-Use-CFFI-in-out-of-line-API-mode-49.patch new file +101 -0

101 lines not on this page · raw message

package/python-augeas/Config.in new file +8 -0
new file mode 100644
index 0000000000..3503a83b3b
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_AUGEAS
+	bool "python-augeas"
+	depends on BR2_PACKAGE_AUGEAS
+	select BR2_PACKAGE_PYTHON_CFFI # runtime
+	help
+	  Pure python bindings for Augeas.
+
+	  https://github.com/hercules-team/python-augeas
package/python-augeas/python-augeas.hash new file +3 -0
new file mode 100644
index 0000000000..f4f4209875
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  1a1d2cdaf2ad4c091ed5ec7976c52d16e14ecfbf40b1bdcaced2465255fb0f87  python-augeas-1.1.0.tar.gz
+sha256  dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551  COPYING
package/python-augeas/python-augeas.mk new file +21 -0
new file mode 100644
index 0000000000..7adaa84f49
@@ -0,0 +1,21 @@
+################################################################################
+#
+# python-augeas
+#
+################################################################################
+
+PYTHON_AUGEAS_VERSION = 1.1.0
+PYTHON_AUGEAS_SITE = $(call github,hercules-team,python-augeas,v$(PYTHON_AUGEAS_VERSION))
+PYTHON_AUGEAS_SETUP_TYPE = setuptools
+PYTHON_AUGEAS_LICENSE = LGPL-2.1+
+PYTHON_AUGEAS_LICENSE_FILES = COPYING
+PYTHON_AUGEAS_DEPENDENCIES = augeas host-python-cffi host-pkgconf
+# This will tell python-augeas to not call xml2-config, and instead
+# use pkg-config to find libxml2. libxml2 is an indirect dependency of
+# augeas, which is why it's not in our dependencies. It's odd that
+# python-augeas searches for libxml2, but that's what it
+# does. Question asked in the pull request at
+# https://github.com/hercules-team/python-augeas/pull/49.
+PYTHON_AUGEAS_ENV = XML2_CONFIG=/bin/false
+
+$(eval $(python-package))
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 support/testing/tests/package/test_python_augeas: new test

---
 DEVELOPERS                                          |  4 ++++
 .../testing/tests/package/sample_python_augeas.py   |  9 +++++++++
 support/testing/tests/package/test_python_augeas.py | 13 +++++++++++++
 3 files changed, 26 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_augeas.py
 create mode 100644 support/testing/tests/package/test_python_augeas.py
DEVELOPERS +4 -0
index 06d311a085..9ff590978c 100644
@@ -1987,6 +1987,8 @@ F:	configs/galileo_defconfig
 N:	Nicolas Carrier <[email protected]>
 F:	package/php-xdebug/
 F:	package/python-augeas/
+F:	support/testing/tests/package/sample_python_augeas.py
+F:	support/testing/tests/package/test_python_augeas.py
 
 N:	Nicolas Cavallari <[email protected]>
 F:	package/libgit2/
@@ -2687,6 +2689,8 @@ F:	package/squashfs/
 F:	package/wayland/
 F:	package/weston/
 F:	support/testing/tests/boot/test_syslinux.py
+F:	support/testing/tests/package/sample_python_augeas.py
+F:	support/testing/tests/package/test_python_augeas.py
 F:	toolchain/
 
 N:	Timo Ketola <[email protected]>
support/testing/tests/package/sample_python_augeas.py new file +9 -0
new file mode 100644
index 0000000000..d62afa564e
@@ -0,0 +1,9 @@
+import augeas
+
+a = augeas.Augeas(root="/")
+hosts = a.match("/files/etc/hosts/*")
+assert(hosts is not None)
+assert(len(hosts) == 2)
+
+assert(a.get("/files/etc/hosts/1/ipaddr") == "127.0.0.1")
+assert(a.get("/files/etc/hosts/1/canonical") == "localhost")
support/testing/tests/package/test_python_augeas.py new file +13 -0
new file mode 100644
index 0000000000..c1424668d6
@@ -0,0 +1,13 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonAugeas(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_AUGEAS=y
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_AUGEAS=y
+        """
+    sample_scripts = ["tests/package/sample_python_augeas.py"]
+    timeout = 60
Signature · 1 line
2.31.1
#2 lore raw

PATCH 1/2 package/python-augeas: new package

In reply to Thomas Petazzoni

Thomas, All,

On 2021-06-21 22:34 +0200, Thomas Petazzoni spake thusly:

Quoted 8 lines

We backport an upstream patch that fixes the loading of the native library by the FFI logic. Without this, "import augeas" doesn't work as it goes into the ctypes.utils.find_library() logic that tries to use a compiler on the target to find the augeas native library.

Based on initial work from Nicolas Carrier <[email protected]>

A new package with a runtime test? Applied to master, thanks.

[--SNIP--]

Quoted 14 lines
package/python-augeas/python-augeas.mk new file +8 -0
new file mode 100644
index 0000000000..7adaa84f49
@@ -0,0 +1,21 @@
+################################################################################
+#
+# python-augeas
+#
+################################################################################
+
+PYTHON_AUGEAS_VERSION = 1.1.0
+PYTHON_AUGEAS_SITE = $(call github,hercules-team,python-augeas,v$(PYTHON_AUGEAS_VERSION))

package/python-augeas/python-augeas.mk line 18

Quoted 10 lines
package/python-augeas/python-augeas.mk new file +10 -0
+PYTHON_AUGEAS_SETUP_TYPE = setuptools
+PYTHON_AUGEAS_LICENSE = LGPL-2.1+
+PYTHON_AUGEAS_LICENSE_FILES = COPYING
+PYTHON_AUGEAS_DEPENDENCIES = augeas host-python-cffi host-pkgconf
+# This will tell python-augeas to not call xml2-config, and instead
+# use pkg-config to find libxml2. libxml2 is an indirect dependency of
+# augeas, which is why it's not in our dependencies. It's odd that
+# python-augeas searches for libxml2, but that's what it
+# does. Question asked in the pull request at
+# https://github.com/hercules-team/python-augeas/pull/49.

They've now replied, and I am not sure I followed... Augeas' .pc does not yield libxml2' CFLAGS, because it is a Requires.Private.

So, why does python-augeas need the CFLAGS from libxml2?

Anyway...

Regards,
Yann E. MORIN.

Quoted 10 lines
package/python-augeas/python-augeas.mk new file +3 -0
+PYTHON_AUGEAS_ENV = XML2_CONFIG=/bin/false
+
+$(eval $(python-package))
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/2 package/python-augeas: new package

Quoted 16 lines · On Thu, 24 Jun 2021 23:53:53 +0200 "Yann E. MORIN" <[email protected]>…

package/python-augeas/python-augeas.mk line 18

Quoted 12 lines
package/python-augeas/python-augeas.mk new file +12 -0
+PYTHON_AUGEAS_VERSION = 1.1.0
+PYTHON_AUGEAS_SITE = $(call github,hercules-team,python-augeas,v$(PYTHON_AUGEAS_VERSION))
+PYTHON_AUGEAS_SETUP_TYPE = setuptools
+PYTHON_AUGEAS_LICENSE = LGPL-2.1+
+PYTHON_AUGEAS_LICENSE_FILES = COPYING
+PYTHON_AUGEAS_DEPENDENCIES = augeas host-python-cffi host-pkgconf
+# This will tell python-augeas to not call xml2-config, and instead
+# use pkg-config to find libxml2. libxml2 is an indirect dependency of
+# augeas, which is why it's not in our dependencies. It's odd that
+# python-augeas searches for libxml2, but that's what it
+# does. Question asked in the pull request at
+# https://github.com/hercules-team/python-augeas/pull/49.  

They've now replied, and I am not sure I followed... Augeas' .pc does not yield libxml2' CFLAGS, because it is a Requires.Private.

Quoted 1 line

So, why does python-augeas need the CFLAGS from libxml2?

Yeah, I was also confused by their reply, and didn't investigate further at this point.

Thanks for looking at the patch and merging!

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com