From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eOgjCE4fqmFPgwAAgWs5BA (envelope-from ) for ; Fri, 03 Dec 2021 14:44:46 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wATiA04fqmFTDwAAB5/wlQ (envelope-from ) for ; Fri, 03 Dec 2021 13:44:46 +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 B85DEA8AB for ; Fri, 3 Dec 2021 14:44:45 +0100 (CET) Received: from localhost ([::1]:50144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mt8rk-0005cO-Vh for larch@yhetil.org; Fri, 03 Dec 2021 08:44:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mt8p8-0001Uj-AK for guix-patches@gnu.org; Fri, 03 Dec 2021 08:42:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:38724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mt8p8-0007LA-1L for guix-patches@gnu.org; Fri, 03 Dec 2021 08:42:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mt8p7-00016R-W4 for guix-patches@gnu.org; Fri, 03 Dec 2021 08:42:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52259] [PATCH 2/3] gnu: trytond: Fix import of trytond modules. Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Dec 2021 13:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52259 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52259@debbugs.gnu.org X-Debbugs-Original-To: 52259@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16385388824160 (code B ref -1); Fri, 03 Dec 2021 13:42:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Dec 2021 13:41:22 +0000 Received: from localhost ([127.0.0.1]:50265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mt8oT-000151-P0 for submit@debbugs.gnu.org; Fri, 03 Dec 2021 08:41:22 -0500 Received: from lists.gnu.org ([209.51.188.17]:42794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mt8oR-00014m-JW for submit@debbugs.gnu.org; Fri, 03 Dec 2021 08:41:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mt8oR-0007ut-BC for guix-patches@gnu.org; Fri, 03 Dec 2021 08:41:19 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:50589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mt8oO-0005er-5K for guix-patches@gnu.org; Fri, 03 Dec 2021 08:41:19 -0500 Received: from hermia.goebel-consult.de ([79.211.191.200]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MPGJh-1nEM1O3Mbd-00Pb1x; Fri, 03 Dec 2021 14:41:07 +0100 Received: from lenashee.fritz.box (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id 408695F53A; Fri, 3 Dec 2021 14:41:11 +0100 (CET) From: Hartmut Goebel Date: Fri, 3 Dec 2021 14:41:03 +0100 Message-Id: <3fa3f27e0f88ca1bef4639eb106e8f486b5dfcd5.1638538371.git.h.goebel@crazy-compilers.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <5fae975202b1a50b25270568def974822ca0ba98.1638538371.git.h.goebel@crazy-compilers.com> References: <5fae975202b1a50b25270568def974822ca0ba98.1638538371.git.h.goebel@crazy-compilers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:/TPAaXjyjLVOaOMtsyWSr3KdP2eLR9YFO7Ok2lyo7dvhA7Q1yEO 93iQW9yZeef0U72B2+ZBL9R641PphyE/kSTS4qiMC8sSDKpIg+OlDgwsYu0F4PwL5itw+cp NyiLoGzAejrlS/zEt1aVVKLlnZOqlXCWP+/AXzKKOZiTcNhO27dClHn2f6kx/sKWZFDzTA1 WD+uS8XAQpbMz9y6Bsl1w== X-UI-Out-Filterresults: notjunk:1;V03:K0:EDR4Mr/SgvA=:BAthTMkaaFHx+1JjLqKxA4 PYc7zcueewb2n+uHQpxdte2WG8VoH1R7Soe6Qd9cOihU/qhppkkpg237pWnkqeVTWCCc73Zt3 d5LqzbPQQA6CQGGuqGalZyzljE0YT7tPWd10YInMY2zbRQKfFrFqHK+jk4phWGV4xc8CwB+OQ b5JqrKTQ4RQ1UA8Gk7/F2cUaA57ARZI3ADhGgRzPaM9mmRwEHvO+Tm8gkkB7sDnAKhhV7wEiS hoPe5pbnx+bzsePNh/DVziVyuDpSQf9XjeCSm+BWLX8t0RppPRlEY8hq2QhcSKDhF2KXZTFTE wyCIqBSIK7YqqkEiT6nDs0sXJUuqLp00CDIAUDe9e3dp9IvNVgus1IoHLpdS8/yaxGrbDXsdv xveU0eWxeozlI1eLw6El6YuaeYndzu4FKz4rmirdWZKdET5+LnTdZ2SWmNZRfm3t77nCXM8iC OFp28RWSz6Ejs2OW4cCOLkTaIdorFCDgIGCn9MVNcp67L691qHctbOKkTGHBZD9PrFq2KXOgy M+qRZrYg9m1VdG/cqzQQV4kjCt2c1Ywj2uMV8QsAlm2hXptYjH/3Pfz7jQ6yKRuI1Xb0DsPzx Qhrz/9jnvrauTTiaiIe92AG/8yqMLoVAKPecm5B7QAxO96wuHgKQoUtNZzGeUYvs3P6BCkZXG 0L0BqHjmNr964uKyX6yg+d10iMKrmGCliuRyA4KvIPWZW3IYmZRhhgY3Jm/mupCHKdpOgvvQf 4lT2ODSaN9ae/n2G Received-SPF: none client-ip=212.227.126.135; envelope-from=h.goebel@crazy-compilers.com; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638539085; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=vtlw21azWYNf225l2H6/mZv5jboH95crG9sP2sYPFWw=; b=pKuKQmXlf+PkbbAl9ykPIW+FyBzPedobgWVbBx2x9kh9zZUUpk1rMwk3urYEB8MD5N6p1o INk1MqZwh5im+Y4AP7ZOb6NUSYEDSYXdG+ShHPpD7DK+RX2NtPo+kE3FYzEZwYd5CCcswh 2Ue81U+O0V7d3yBINeP1DSz39WhcXsfBHc0+4TaZ0FvMgNSSQwRbSUh8bUhAh7QMqEZqZu Gs0d2zDIcfDbKJxv09hnnbpVFSKnIhX9KzkAkGx7m0SvqXYiQtU4//JQyQAq2l18SaYhen 4eRoxWP+0da42K51t3B0y31+rTHQdOX5f5A24Sw2pFrUbmuCgMgt2i2ZYS/j1w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638539085; a=rsa-sha256; cv=none; b=aD+INeWKHGb0VhU4SzYcfKFsOApnCFVB/8kZoG8rBI7vPdioZZ9n3DtJgLrtZsW9uj3Jgj MLl6XytfIy7f64nuw7gqSp+P42NKVLkJTQ/azSftr8WXB0WzDYjuCF1CDddqahM2YWi6pk L/u6eC4d3AVfvKYni00f41KuA8lALgVkmu4RYrmYoZytqHqLGGOZNGEiwCZljOhNmw1e0+ V4bl3uMAe8nYSbfDJSiE9p1pvkT83WoZkilTFrip4se1+P5ws0uEUfJn6qSSTGhuX7BbW+ QfeNNDtDmZvgx/T5krIziwzww7PQBtgcGT9X1S93DRvu3cFmoWx+6GS0cErXTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.12 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B85DEA8AB X-Spam-Score: -2.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3jOjubhbki6C For adding modules, trytond uses entry-points, anyhow relying on the modules being named "trytond.modules.xxx" and being placed in the same filesystem path as "trytond.modules". The package "trytond.modules" is not a namespace module, anyhow trytond modules must be sub-modules of "trytond.modules". This works well if all packages are installed into the same filesystem path "…/trytond/modules": The Python importer will find all sub_modules at this place. Anyhow, in Guix, modules don't share the same filesystem path and the Python importer will not find them. Solution is to add all trytond module's locations to "trytond.modules._path__". This will make "trytond.module" behave much like a namespace module and the importer pick up the module. * gnu/packages/patches/trytond-add-egg-modules-to-path.patch: New file. * gnu/packages/tryton.scm (trytond): Use it. * gnu/local.mk (dist_patch_DATA): Add it --- gnu/local.mk | 1 + .../trytond-add-egg-modules-to-path.patch | 22 +++++++++++++++++++ gnu/packages/tryton.scm | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/trytond-add-egg-modules-to-path.patch diff --git a/gnu/local.mk b/gnu/local.mk index 604c6cf151..a8b9bcac21 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1816,6 +1816,7 @@ dist_patch_DATA = \ %D%/packages/patches/tor-sandbox-i686.patch \ %D%/packages/patches/transcode-ffmpeg.patch \ %D%/packages/patches/transmission-honor-localedir.patch \ + %D%/packages/patches/trytond-add-egg-modules-to-path.patch \ %D%/packages/patches/ttf2eot-cstddef.patch \ %D%/packages/patches/tup-unbundle-dependencies.patch \ %D%/packages/patches/tuxpaint-stamps-path.patch \ diff --git a/gnu/packages/patches/trytond-add-egg-modules-to-path.patch b/gnu/packages/patches/trytond-add-egg-modules-to-path.patch new file mode 100644 index 0000000000..1baccfee1c --- /dev/null +++ b/gnu/packages/patches/trytond-add-egg-modules-to-path.patch @@ -0,0 +1,22 @@ +Work around trytond.module not being a real namespace module. + +Solution is to add all trytond module's locations to +trytond.modules._path__. This will make trytond.module behave much +like a namespace module. +Adding to __path__ is done in update_egg_modules() to ensure __path__ +is updated whenever the list of egg modules is updated. + +*** a/trytond/modules/__init__.py 1970-01-01 01:00:01.000000000 +0100 +--- b/trytond/modules/__init__.py 2021-12-02 18:12:15.385101986 +0100 +*************** +*** 38,43 **** +--- 38,46 ---- + import pkg_resources + for ep in pkg_resources.iter_entry_points('trytond.modules'): + EGG_MODULES[ep.name] = ep ++ path = os.path.join(ep.dist.location, 'trytond', 'modules') ++ if not path in __path__ and os.path.isdir(path): ++ __path__.append(path) + except ImportError: + pass + diff --git a/gnu/packages/tryton.scm b/gnu/packages/tryton.scm index 0ac0a5a5cd..212d6593ad 100644 --- a/gnu/packages/tryton.scm +++ b/gnu/packages/tryton.scm @@ -48,7 +48,8 @@ (method url-fetch) (uri (pypi-uri "trytond" version)) (sha256 - (base32 "1jp5cadqpwkcnml8r1hj6aak5kc8an2d5ai62p96x77nn0dp3ny4")))) + (base32 "1jp5cadqpwkcnml8r1hj6aak5kc8an2d5ai62p96x77nn0dp3ny4")) + (patches (search-patches "trytond-add-egg-modules-to-path.patch")))) (build-system python-build-system) (propagated-inputs `(("python-dateutil" ,python-dateutil) -- 2.30.2