All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Subject: [PATCH v1 1/1] binman: Do not pollute source tree when build with `make O=...`
Date: Tue, 30 Nov 2021 21:42:04 +0300	[thread overview]
Message-ID: <20211130184204.61707-1-andriy.shevchenko@linux.intel.com> (raw)

Importing libraries in Python caches the bytecode by default.
Since we run scripts in source tree it ignores the current directory
settings, which is $(srctree), and creates cache just in the middle
of the source tree. Move cache to the current directory.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 tools/binman/main.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/binman/main.py b/tools/binman/main.py
index 8c1e478d54ce..d5ab59948ec9 100755
--- a/tools/binman/main.py
+++ b/tools/binman/main.py
@@ -16,6 +16,13 @@ import sys
 import traceback
 import unittest
 
+#
+# Do not pollute source tree with cache files:
+# https://stackoverflow.com/a/60024195/2511795
+# https://bugs.python.org/issue33499
+#
+sys.pycache_prefix = os.path.relpath(os.path.dirname(sys.argv[0]), os.environ['srctree'])
+
 # Bring in the patman and dtoc libraries (but don't override the first path
 # in PYTHONPATH)
 our_path = os.path.dirname(os.path.realpath(__file__))
-- 
2.33.0


             reply	other threads:[~2021-11-30 18:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 18:42 Andy Shevchenko [this message]
2021-11-30 18:52 ` [PATCH v1 1/1] binman: Do not pollute source tree when build with `make O=...` Tom Rini
2021-11-30 18:58   ` Andy Shevchenko
2021-11-30 19:06     ` Tom Rini
2021-11-30 19:10       ` Andy Shevchenko
2021-11-30 19:23         ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211130184204.61707-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.