From patchwork Sat Apr 18 00:09:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1272532 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=enW+dLkE; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 493thX6d5Hz9sSm for ; Sat, 18 Apr 2020 10:13:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8543181D5E; Sat, 18 Apr 2020 02:12:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="enW+dLkE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 30C0681CFD; Sat, 18 Apr 2020 02:09:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B1F1681D46 for ; Sat, 18 Apr 2020 02:09:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2e.google.com with SMTP id i19so4266684ioh.12 for ; Fri, 17 Apr 2020 17:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7kekv8y2FlKB4zMiMEtiSpoSbInX/Co82evGIR5rAaw=; b=enW+dLkEcwpyTb7NhQMFjr+NUgPav7NTp2q6691pkasNHJjXR4SomTl+x9UkYabHl0 XDO13pvDq8lSW4JoRgNmK4rK/AzS8rOV4sg6QfK5NCgYHSKudym571V0twVo/S4Kw4ZO P2RtBxZXMNGN2X7ogwuTH79dZK7fERA1gMuzU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7kekv8y2FlKB4zMiMEtiSpoSbInX/Co82evGIR5rAaw=; b=jrecgLeRebFOJ63wwArNX2L1diGIiiFxA2yBy6hkAmgHQfVvTentrgBnudtCm2+YBx lcEDhe9h9uOI+ERcxe0slw6UDQwGmTeP99vboqdiBDu2+NGn+hs5nHHgT4Vlu9ekFGen ReuuM3I6Lcxifr8sBJu6hL0Afw/6W4b/njGMQpXTNIJ6j9rY/Gy4Y8KKZDhIXEEDlJT0 F6O6igAFCqlE01NyB00RUVlzuZgJ+SgC/qW8JwXc4esgIUfsdPl2WOm1Qcs6vJFfR2EH gOlc8Q60ApA4UNUl+N5CWBz6WuP0meMQ1aNXc2uaxzmPdfn4W60TccP0ITZRMI49D9kE 8Agg== X-Gm-Message-State: AGi0PuYzhFZd3HQdTQWntUSLWsAxfCcDnEFcgNMv0FubR5bkRCsdPoHU 1gux1+D6nVfocUy2BevbT+h5hMtfSYPbZA== X-Google-Smtp-Source: APiQypKHVavyUn/s2+eqpiQHF440a6NKvwB/D4oVHGLuYXoohtFbjbmL3lDKBKw2wi5zseX1FEjwhw== X-Received: by 2002:a02:b88e:: with SMTP id p14mr763908jam.36.1587168561470; Fri, 17 Apr 2020 17:09:21 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id u7sm872834ilc.40.2020.04.17.17.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 17:09:21 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Stephen Warren , Stephen Warren , Sean Anderson , Tom Rini , Mike Frysinger , Masahiro Yamada , Simon Glass , Heinrich Schuchardt , Markus Klotzbuecher Subject: [PATCH v2 11/14] buildman: Move to absolute imports Date: Fri, 17 Apr 2020 18:09:02 -0600 Message-Id: <20200417180829.v2.11.Ifd9471bb9ca58241e33bc8a24a4a293a8923abed@changeid> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog In-Reply-To: <20200418000905.239056-1-sjg@chromium.org> References: <20200418000905.239056-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean At present buildman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move buildman to use absolute imports. Also adjust moveconfig.py too since it uses some buildman modules and cannot work without this. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/buildman/builder.py | 4 ++-- tools/buildman/control.py | 12 ++++++------ tools/buildman/func_test.py | 9 +++++---- tools/buildman/main.py | 20 ++++++++++---------- tools/buildman/test.py | 12 ++++++------ tools/buildman/toolchain.py | 2 +- tools/moveconfig.py | 8 ++++---- 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 1b61e3a837..b7f2c426e3 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -17,12 +17,12 @@ import sys import threading import time -import builderthread +from buildman import builderthread +from buildman import toolchain import command import gitutil import terminal from terminal import Print -import toolchain """ Theory of Operation diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 7c8d7520fb..e05234c08f 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -5,18 +5,18 @@ import multiprocessing import os import shutil +import subprocess import sys -import board -import bsettings -from builder import Builder +from buildman import board +from buildman import bsettings +from buildman import toolchain +from buildman.builder import Builder +import command import gitutil import patchstream import terminal from terminal import Print -import toolchain -import command -import subprocess def GetPlural(count): """Returns a plural 's' if count is not 1""" diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 29b28f5a9f..9bfdd53698 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -8,11 +8,12 @@ import sys import tempfile import unittest -import board -import bsettings -import cmdline +from buildman import board +from buildman import bsettings +from buildman import cmdline +from buildman import control +from buildman import toolchain import command -import control import gitutil import terminal import toolchain diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 0add628a63..94d495c40b 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -6,6 +6,7 @@ """See README for more information""" +import doctest import multiprocessing import os import re @@ -14,20 +15,19 @@ import unittest # Bring in the patman libraries our_path = os.path.dirname(os.path.realpath(__file__)) -sys.path.insert(1, os.path.join(our_path, '../patman')) +sys.path.insert(1, os.path.join(our_path, '..')) +sys.path.insert(2, os.path.join(our_path, '../patman')) # Our modules -import board -import bsettings -import builder -import checkpatch -import cmdline -import control -import doctest -import gitutil +from buildman import board +from buildman import bsettings +from buildman import builder +from buildman import cmdline +from buildman import control +from buildman import toolchain import patchstream +import gitutil import terminal -import toolchain def RunTests(skip_net_tests): import func_test diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 8b6d138f70..87175eeb63 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -13,15 +13,15 @@ import unittest our_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(our_path, '../patman')) -import board -import bsettings -import builder -import control -import command +from buildman import board +from buildman import bsettings +from buildman import builder +from buildman import control +from buildman import toolchain import commit +import command import terminal import test_util -import toolchain import tools use_network = True diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 4456a805c7..a3540491ec 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -10,7 +10,7 @@ import sys import tempfile import urllib.request, urllib.error, urllib.parse -import bsettings +from buildman import bsettings import command import terminal import tools diff --git a/tools/moveconfig.py b/tools/moveconfig.py index d8bf7fd071..0dd8670403 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -314,11 +314,11 @@ import tempfile import threading import time -sys.path.append(os.path.join(os.path.dirname(__file__), 'buildman')) +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(os.path.join(os.path.dirname(__file__), 'patman')) -import bsettings -import kconfiglib -import toolchain +from buildman import bsettings +from buildman import kconfiglib +from buildman import toolchain SHOW_GNU_MAKE = 'scripts/show-gnu-make' SLEEP_TIME=0.03