Hi Nicolas! Nicolas Graves <[email protected]> skribis:
> Sadly I've found the use of `with-extensions` in Guix to not be as > convenient as the use of imported-modules. In particular, we need to > wrap every `modify-phases` with a call to `with-extensions` when > `#:modules` contains any package that contains `#:use-module (json)`, > despite there are a lot of use-cases where the package is not necessary > (for instance when the python build-side module is imported only for the > use of the `site-packages` procedure). There are two situations I can think of. For build systems that use Guile-JSON unconditionally, wrap the build system’s gexp (for instance, that in guix/build-system/pyproject.scm) in ‘with-extensions’. Apparently this has already been done. What are the other cases we’re talking about? Packages that, for instance, do not use ‘pyproject-build-system’ yet want to be able to import (guix build-system pyproject-build-system)? If we’re talking about a dozen packages, adding a ‘with-extensions’ stanza in those packages seems okay to me. If there’s more, I’m not sure. > I see two possible directions : > > 1) The `#:autoload` way: Use autoloads instead of `#:use-module` in the > build-systems using `(json)` so that wrapping `with-extensions` is only > required when it's really used. Yes, using #:autoload cannot hurt. > 2) The `#:imported-modules` way: Add an additional keyword argument, > `#:extensions`, that would be re-injected to avoid the additional > `with-extensions` around the `modify-phases` gexp. That would work too. HTH! Ludo’.
