From caf8c92366afece640863f19470042af203aca42 Mon Sep 17 00:00:00 2001
From: Thomas Jahns <jahns@dkrz.de>
Date: Fri, 23 Oct 2015 16:27:09 +0000
Subject: [PATCH] Prevent python from putting .pyc files into the source tree.

---
 interfaces/Makefile.am | 4 ++++
 interfaces/Makefile.in | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/interfaces/Makefile.am b/interfaces/Makefile.am
index 456c70d5e..55e01b89b 100644
--- a/interfaces/Makefile.am
+++ b/interfaces/Makefile.am
@@ -205,6 +205,7 @@ python/CdiLib.stamp: python/cdilib_wrap.c
 	@set -e ; cd python ; \
 	  $(setup_python_vars) \
 	  $(setup_cdilib_py_vars) \
+	  PYTHONDONTWRITEBYTECODE=1 \
 	  $(PYTHON) "$${setupLib_py}" build_ext -v
 	touch $@
 
@@ -213,6 +214,7 @@ pythonLibTest: pythonLib
 	@set -e ; cd python ; \
 	  $(setup_python_vars) \
 	  $(setup_cdilib_py_vars) \
+	  PYTHONDONTWRITEBYTECODE=1 \
 	  $(PYTHON) \
 	  `test -f testLib.py || echo '$(abs_srcdir)/python/'`testLib.py \
 	  $(select_test_file)
@@ -250,6 +252,7 @@ python/CdiObj.stamp: python/cdiobj_wrap.cpp cdi.lo
 	@set -e ; cd python; $(setup_python_vars) \
 	  $(setup_python_cxx_vars) \
 	  $(setup_cdiobj_py_vars) \
+	  PYTHONDONTWRITEBYTECODE=1 \
 	  $(PYTHON) "$${setupObj_py}" \
 	  build_ext -v
 	touch $@
@@ -260,6 +263,7 @@ pythonObjTest: pythonObj
 	  $(setup_python_vars) \
 	  $(setup_python_cxx_vars) \
 	  $(setup_cdiobj_py_vars) \
+	  PYTHONDONTWRITEBYTECODE=1 \
 	  $(PYTHON) `test -f testObj.py || echo '$(abs_srcdir)/python/'`testObj.py \
 	  $(select_test_file)
 
diff --git a/interfaces/Makefile.in b/interfaces/Makefile.in
index e37a6270d..818cb34e7 100644
--- a/interfaces/Makefile.in
+++ b/interfaces/Makefile.in
@@ -1017,6 +1017,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 @ENABLE_PYTHON_TRUE@	@set -e ; cd python ; \
 @ENABLE_PYTHON_TRUE@	  $(setup_python_vars) \
 @ENABLE_PYTHON_TRUE@	  $(setup_cdilib_py_vars) \
+@ENABLE_PYTHON_TRUE@	  PYTHONDONTWRITEBYTECODE=1 \
 @ENABLE_PYTHON_TRUE@	  $(PYTHON) "$${setupLib_py}" build_ext -v
 @ENABLE_PYTHON_TRUE@	touch $@
 
@@ -1025,6 +1026,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 @ENABLE_PYTHON_TRUE@	@set -e ; cd python ; \
 @ENABLE_PYTHON_TRUE@	  $(setup_python_vars) \
 @ENABLE_PYTHON_TRUE@	  $(setup_cdilib_py_vars) \
+@ENABLE_PYTHON_TRUE@	  PYTHONDONTWRITEBYTECODE=1 \
 @ENABLE_PYTHON_TRUE@	  $(PYTHON) \
 @ENABLE_PYTHON_TRUE@	  `test -f testLib.py || echo '$(abs_srcdir)/python/'`testLib.py \
 @ENABLE_PYTHON_TRUE@	  $(select_test_file)
@@ -1047,6 +1049,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 @ENABLE_PYTHON_TRUE@	@set -e ; cd python; $(setup_python_vars) \
 @ENABLE_PYTHON_TRUE@	  $(setup_python_cxx_vars) \
 @ENABLE_PYTHON_TRUE@	  $(setup_cdiobj_py_vars) \
+@ENABLE_PYTHON_TRUE@	  PYTHONDONTWRITEBYTECODE=1 \
 @ENABLE_PYTHON_TRUE@	  $(PYTHON) "$${setupObj_py}" \
 @ENABLE_PYTHON_TRUE@	  build_ext -v
 @ENABLE_PYTHON_TRUE@	touch $@
@@ -1057,6 +1060,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 @ENABLE_PYTHON_TRUE@	  $(setup_python_vars) \
 @ENABLE_PYTHON_TRUE@	  $(setup_python_cxx_vars) \
 @ENABLE_PYTHON_TRUE@	  $(setup_cdiobj_py_vars) \
+@ENABLE_PYTHON_TRUE@	  PYTHONDONTWRITEBYTECODE=1 \
 @ENABLE_PYTHON_TRUE@	  $(PYTHON) `test -f testObj.py || echo '$(abs_srcdir)/python/'`testObj.py \
 @ENABLE_PYTHON_TRUE@	  $(select_test_file)
 
-- 
GitLab