From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MDn4AuILrV+9CAAA0tVLHw (envelope-from ) for ; Thu, 12 Nov 2020 10:18:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MHduOuELrV/6dAAA1q6Kng (envelope-from ) for ; Thu, 12 Nov 2020 10:18:09 +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 273AF9400BF for ; Thu, 12 Nov 2020 10:18:09 +0000 (UTC) Received: from localhost ([::1]:43936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kd9g7-0005Yc-SF for larch@yhetil.org; Thu, 12 Nov 2020 05:18:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kd9g2-0005YQ-4a for guix-patches@gnu.org; Thu, 12 Nov 2020 05:18:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kd9g1-0001ZN-Qb for guix-patches@gnu.org; Thu, 12 Nov 2020 05:18:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kd9g1-0000KB-N8 for guix-patches@gnu.org; Thu, 12 Nov 2020 05:18:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#44590] [WIP PATCH CORE-UPDATES] build/python: Check for cythonized files. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 12 Nov 2020 10:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44590 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 44590@debbugs.gnu.org Cc: Efraim Flashner X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16051762411197 (code B ref -1); Thu, 12 Nov 2020 10:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 12 Nov 2020 10:17:21 +0000 Received: from localhost ([127.0.0.1]:43755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kd9fM-0000JF-Ts for submit@debbugs.gnu.org; Thu, 12 Nov 2020 05:17:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:60938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kd9fI-0000J4-CA for submit@debbugs.gnu.org; Thu, 12 Nov 2020 05:17:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kd9fI-0005Uo-6p for guix-patches@gnu.org; Thu, 12 Nov 2020 05:17:16 -0500 Received: from flashner.co.il ([178.62.234.194]:33874) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kd9f7-0001JF-Ap for guix-patches@gnu.org; Thu, 12 Nov 2020 05:17:15 -0500 Received: from localhost (unknown [141.226.13.8]) by flashner.co.il (Postfix) with ESMTPSA id 9983B4006B; Thu, 12 Nov 2020 10:17:03 +0000 (UTC) From: Efraim Flashner Date: Thu, 12 Nov 2020 12:16:30 +0200 Message-Id: <20201112101630.1302-1-efraim@flashner.co.il> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=178.62.234.194; envelope-from=efraim@flashner.co.il; helo=flashner.co.il X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 04:15:53 X-ACL-Warn: Detected OS = ??? 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.3 (--) 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-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: VyOrtdOx8tOB * guix/build/python-build-system.scm (ensure-no-cythonized-files): New procedure. (%standard-phases): Add it. --- This patch only checks if a file exists and suggests it may be cythonized. It doesn't check the first line for the string "generated by Cython" in that file or in any file. It also doesn't error when it thinks it finds a file. It does provide a good visual queue that the source needs more scrutiny before being added. --- guix/build/python-build-system.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index 4a07496d22..bc34e22df8 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2018 Arun Isaac ;;; Copyright © 2019, 2020 Maxim Cournoyer ;;; Copyright © 2020 Jakub Kądziołka +;;; Copyright © 2020 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -262,6 +263,18 @@ installed with setuptools." (setenv "PYTHONHASHSEED" "0") #t) +(define* (ensure-no-cythonized-files #:rest _) + "Check the source code for @code{.c} files which may have been pre-generated +by Cython." + (for-each + (lambda (file) + (let ((generated-file + (string-append (string-drop-right file 3) "c"))) + (when (file-exists? generated-file) + (warning (G_ "Possible Cythonized file found: ~a~%") generated-file)))) + (find-files "." "\\.pyx$")) + #t) + (define %standard-phases ;; The build phase only builds C extensions and copies the Python sources, ;; while the install phase copies then byte-compiles the sources to the @@ -271,6 +284,8 @@ installed with setuptools." (add-after 'unpack 'ensure-no-mtimes-pre-1980 ensure-no-mtimes-pre-1980) (add-after 'ensure-no-mtimes-pre-1980 'enable-bytecode-determinism enable-bytecode-determinism) + (add-after 'enable-bytecode-determinism 'ensure-no-cythonized-files + ensure-no-cythonized-files) (delete 'bootstrap) (delete 'configure) ;not needed (replace 'build build) -- 2.29.2