From patchwork Tue Dec 20 13:46:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 707438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tjfHd1gqTz9t0m for ; Wed, 21 Dec 2016 00:47:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 486FD2FF88; Tue, 20 Dec 2016 13:47:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7izykyX9503M; Tue, 20 Dec 2016 13:47:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 729EB30040; Tue, 20 Dec 2016 13:47:15 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 8976A1BFA57 for ; Tue, 20 Dec 2016 13:46:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 86AD085443 for ; Tue, 20 Dec 2016 13:46:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lh2QOm8dezJJ for ; Tue, 20 Dec 2016 13:46:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lupi.sysmic.org (sysmic.org [62.210.89.17]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3E450856D6 for ; Tue, 20 Dec 2016 13:46:55 +0000 (UTC) Received: from lupi.online.net (sysmic.org [62.210.89.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jezz) by lupi.sysmic.org (Postfix) with ESMTPSA id E8B2A43052; Tue, 20 Dec 2016 14:46:51 +0100 (CET) From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= To: buildroot@busybox.net Date: Tue, 20 Dec 2016 14:46:22 +0100 Message-Id: <1482241596-31688-6-git-send-email-jezz@sysmic.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482241596-31688-1-git-send-email-jezz@sysmic.org> References: <1482241596-31688-1-git-send-email-jezz@sysmic.org> MIME-Version: 1.0 Cc: Thomas Petazzoni , =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= Subject: [Buildroot] [PATCH v5 05/19] pycompile: allow to force compilation X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" By default, compile_dir() rely on modification time to know if a python file have to be built again. However in some circumstances (when doing reproducible builds), modification times are not reliable. Thus, this patch add a way to force rebuild of all python sources. Signed-off-by: Jérôme Pouiller Reviewed-by: Samuel Martin --- Notes: v5: - Improve commit log v3: - new patch support/scripts/pycompile.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/support/scripts/pycompile.py b/support/scripts/pycompile.py index fde711a..5598f8a 100644 --- a/support/scripts/pycompile.py +++ b/support/scripts/pycompile.py @@ -10,6 +10,7 @@ from __future__ import print_function import sys import py_compile import compileall +import argparse class ReportProblem: def __nonzero__(self): @@ -21,4 +22,12 @@ class ReportProblem: report_problem = ReportProblem() -compileall.compile_dir(sys.argv[1], quiet=report_problem) +parser = argparse.ArgumentParser(description='Compile Python source files in a directory tree.') +parser.add_argument("target", metavar='DIRECTORY', + help='Directory to scan') +parser.add_argument("--force", action='store_true', + help="Force compilation even if alread compiled") + +args = parser.parse_args() + +compileall.compile_dir(args.target, force=args.force, quiet=report_problem)