help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python to support SQLite extensions


From: Felix Gruber
Subject: Re: python to support SQLite extensions
Date: Sun, 16 May 2021 17:56:49 +0000

Hi Jelle,

On 5/10/21 11:31 PM, Jelle Licht wrote:
> Does anybody perhaps know why my python is correctly receiving (and
> subsequently ignoring) this configure flag? It seems that *something*
> happens between the 'configure' script receiving the flag, and the file
> in `Modules/_sqlite/connection.c' being built, it seems
> SQLITE_OMIT_LOAD_EXTENSION is set to "1".
> 
> This (seemingly) happens in setup.py, lines 1432 and on:
> --8<---------------cut here---------------start------------->8---
>  if '--enable-loadable-sqlite-extensions' not in 
> sysconfig.get_config_var("CONFIG_ARGS"):
>      sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))
> --8<---------------cut here---------------end--------------->8---
> 
> Indeed, in *any* python3 I can find on my Guix System, I see:
> 
> --8<---------------cut here---------------start------------->8---
> #> import sysconfig
> #> sysconfig.get_config_var("CONFIG_ARGS")
> '--with-system-ffi'
> --8<---------------cut here---------------end--------------->8---
> 
> Something weird is going on!
> 
> I have no clue how to continue finding why this happens, but for my
> personal problem I can just patch python's setup.py file.

You're onto something with `sysconfig.get_config_var("CONFIG_ARGS")`:
In the definition of the python-2.7 package from which the python
package eventually derives from, a phase
`'do-not-record-configure-flags` is added before `'configure`. This
phase removes everything but '--with-system-ffi' from `CONFIG_ARGS`.

I've successfully enabled loadable sqlite extensions with the following
package definition.
-------8<----------------8<----------------8<----------------8<-------
(define python-with-loadable-sqlite-modules
  (package (inherit python)
    (arguments
     (substitute-keyword-arguments (package-arguments python)
       ((#:configure-flags cf)
        `(cons* "--enable-loadable-sqlite-extensions" ,cf))
       ((#:phases phases)
        `(modify-phases ,phases
           (delete 'do-not-record-configure-flags)))))))
------->8---------------->8---------------->8---------------->8-------

While this works, it might be better to modify the
`'do-not-record-configure-flags` phase to keep the
`--enable-loadable-sqlite-extensions` option instead of completely
removing this phase.

I think it might be a good idea to enable loadable sqlite extensions by
default in the python package. As you've already pointed out, other
distros have this option enabled which leads to surprises when trying to
load sqlite extensions in guix's python.


Hope that helps,
Felix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]