From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SOkZN16mmWBvbgAAgWs5BA (envelope-from ) for ; Mon, 10 May 2021 23:32:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MM+5Ml6mmWBWFwAAB5/wlQ (envelope-from ) for ; Mon, 10 May 2021 21:32:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1EC1AD1C4 for ; Mon, 10 May 2021 23:32:14 +0200 (CEST) Received: from localhost ([::1]:56904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgDVd-0003r0-1u for larch@yhetil.org; Mon, 10 May 2021 17:32:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgDVB-0003oY-2c for help-guix@gnu.org; Mon, 10 May 2021 17:31:47 -0400 Received: from mail1.fsfe.org ([217.69.89.151]:59602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgDV3-0007ON-W0 for help-guix@gnu.org; Mon, 10 May 2021 17:31:44 -0400 From: Jelle Licht To: help-guix Subject: python to support SQLite extensions Date: Mon, 10 May 2021 23:31:33 +0200 Message-ID: <86tunagtsa.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.69.89.151; envelope-from=jlicht@fsfe.org; helo=mail1.fsfe.org X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620682334; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=1hudmFtAh2WnQoiQNxXUDiyaXVTN7oYZtvcz9lU0Onc=; b=I1qbBnF6gkNQYlB/5f9v5BBSL+gz5Z6vDKibCFhZVYzAaAgcEY28XtuH+A/YS6JLZpn1Ah JCokCcDg7kSmH3Hn9S+0pOew+yh5DsqBYLI5L418ygBF2l+QWqIdUdZMzby5yQmJaejUDz iHaAf89OJULrnoqx08Gs/NDBpjRPXDe8CsqosgzcOdV4rqlf6Mops46AwBjAOU02qoO7E/ uXGOSrK3uiD21A7bclcMD2G/qXCqF+zPandba/E/X8cjYisF7VPPF+uIDj9QUseFAMJvFy TTmQbM+t0Dh08u5UKRdA6Tnabs0zSG3Zm4jcy9aMbFTL073xiIpeLQEzXO9QAA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620682334; a=rsa-sha256; cv=none; b=sZt9xH3MpRsPKxwSU/Fi5RiZ/mRZumpD6iblhhKUg0ltVa6BwMRAbot07G4MeO9JbY1LCM T1Ldj9M3e8vMQ1PY+2/O8sHbOk2gtLHhhv2II2CGDhlBvuX3VuFCguw3SEc8F6NqZww7sB xydJUdZvD/7TGSNp/v5jlX7554mJCmkzs6E8Ptcb3y8Cp2614VfueC4DsN+3Qm/N2oLhZz HpBYhJ2GfKIbs/ueah3NNieLDaXBFhfLTfAzzSjBiLbRjbNY/VvgT58/AX+DQLpSYTKspN S57OgRG1yRu/kvkrdkBKQY2LSruHtu1Ibe3WXPzKUbgv/uRFWz1RJby8iQTVdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Spam-Score: -0.85 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=fsfe.org (policy=none); spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: 1EC1AD1C4 X-Spam-Score: -0.85 X-Migadu-Scanner: scn0.migadu.com X-TUID: /awyz13BK6E6 Hello folks, I want to enable support for loadable extensions in python's sqlite3 module. This should be enabled by passing `--enable-loadable-sqlite-extensions' to `./configure'. I've spend an embarassing amount of time on this, so perhaps someone out there understands python better than I do and can elucidate me. This does depend on our SQLite package needing support for loadable extensions, but it seems it does. I've tried the following custom package definition: --8<---------------cut here---------------start------------->8--- (define-public python/sqlite-extensions (package (inherit python) (arguments (substitute-keyword-arguments (package-arguments python) ((#:configure-flags flags '()) `(cons "--enable-loadable-sqlite-extensions" ,flags)))))) --8<---------------cut here---------------end--------------->8--- ... which seems to 'work', according to the build log: --8<---------------cut here---------------start------------->8--- [snip] checking for --enable-loadable-sqlite-extensions... yes [snip] --8<---------------cut here---------------end--------------->8--- Sadly, even with my freshly built python3, I get the following: --8<---------------cut here---------------start------------->8--- #> import sqlite3 #> conn=sqlite3.connect("/tmp/some-db.sqlite") #> conn.enable_load_extension(True) Traceback (most recent call last): File "", line 1, in AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension' --8<---------------cut here---------------end--------------->8--- 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. Thanks for any pointers, - Jelle NB, this configure option happens to be enabled by default in many other distro's (among which Nix [1]), so it might actually make sense to also set things up in such a way on our next core-updates cycle, once the flag actually does something. [1] https://github.com/NixOS/nixpkgs/pull/67472/files