Subject: [bug#70976] [PATCH] gnu: Add python-augeas.

From: Sharlatan Hellseher <[email-masked]>
Date: Thu, 16 May 2024 20:55:54 +0100

Hi,

Thank you for the patch.

I've got some review points.

Try to avoid to modify LD_LIBRARY_PATH
--8<---------------cut here---------------start------------->8---
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-before 'build 'configure-environment
+                     (lambda _
+                       (setenv "LD_LIBRARY_PATH"
+                               (string-append #$(this-package-input "augeas")
+                                              "/lib")))))))
--8<---------------cut here---------------end--------------->8---

As you may check, the project silently uses pkg-config, xml2-config
which provide library search:
https://github.com/hercules-team/python-augeas/blob/a1e84a7e58e535658f681731b66eca7b71c095a2/augeas/ffi.py#L6C1-L8C60
--8<---------------cut here---------------start------------->8--- def
get_include_dirs(): XML2_CONFIG = os.environ.get('XML2_CONFIG',
'xml2-config') PKG_CONFIG = os.environ.get('PKG_CONFIG', 'pkg-config')
--8<---------------cut here---------------end--------------->8---

In that light, augeas needs to be placed in inputs and 2 packages need
to be added to native-inputs (pkg-config, and maybe libxml2):
--8<---------------cut here---------------start------------->8---
+    (propagated-inputs (list augeas python-cffi))
--8<---------------cut here---------------end--------------->8---

In general for the python packages, similar like for the golang -
propagated-inputs is a place for any modules (they are just sources and)
requuring during runtime of the project you may check it like this:
--8<---------------cut here---------------start------------->8---
guix shell python-<name> python -- python3 'import <nmae>'
--8<---------------cut here---------------end--------------->8---

Nix has 100k packages, and may provide some insight on which inputs and
where the package expects ;-)
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/python-modules/augeas/default.nix#L34

--
Oleg