From patchwork Thu Nov 12 10:16:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 25093 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D6BA727BBF4; Thu, 12 Nov 2020 10:18:08 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F148427BBF6 for ; Thu, 12 Nov 2020 10:18:07 +0000 (GMT) Received: from localhost ([::1]:43936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kd9g7-0005Yc-1P for patchwork@mira.cbaines.net; 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 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-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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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)