]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add -B to python invocation to avoid generating pyc files
authorMartin Galvan <omgalvan.86@gmail.com>
Sat, 17 Dec 2016 19:03:43 +0000 (00:33 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Sat, 17 Dec 2016 19:03:43 +0000 (00:33 +0530)
Without -B, python invocations may result in generation of pyc files
for modules within the source tree, which does not work well when the
source tree is read-only.

2016-12-17  Martin Galvan  <martingalvan@sourceware.org>

* Rules (python-flags, python-invoke): New.
($(test-printers-out)): Use $(python-flags).

Rules

diff --git a/Rules b/Rules
index 9e02eb7ea71669f5d3c46db6386a06bb8d5208c7..fe18ce55de9234c3a62b04abc16b05c80fd76855 100644 (file)
--- a/Rules
+++ b/Rules
@@ -260,6 +260,12 @@ ifneq "$(strip $(tests-printers))" ""
 # inside Makeconfig.
 PYTHON := python
 
+# Invoke Python using -B to avoid generating .pyc files on the source dir,
+# so that we can keep it read-only.
+python-flags := -B
+
+python-invoke := $(PYTHON) $(python-flags)
+
 # Static pattern rule for building the test programs for the pretty printers.
 $(tests-printers-programs): %: %.o $(tests-printers-libs) \
   $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \
@@ -277,7 +283,7 @@ py-env := PYTHONPATH=$(py-const-dir):$(..)scripts:$${PYTHONPATH}
 $(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \
                       $(..)scripts/test_printers_common.py
        $(test-wrapper-env) $(py-env) \
-           $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \
+           $(python-invoke) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \
        $(evaluate-test)
 endif