summaryrefslogtreecommitdiff
path: root/lang/python
diff options
context:
space:
mode:
authorAlexandru Ardelean <aa@ocedo.com>2014-11-13 10:44:36 +0200
committerAlexandru Ardelean <ardeleanalex@gmail.com>2014-11-16 23:31:59 +0200
commit5b85eff6b2d9107bfb5bed7d6b64ff0460f3bc16 (patch)
tree6dc984442fa629b3b279d7e31e571309273f8dc7 /lang/python
parente2994cfd93d96b14393470352adaa907357a5a92 (diff)
python: add patch to disable python byte codes by default
Use export PYTHONDONTWRITEBYTECODE=0 to re-enable writing byte codes. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python')
-rw-r--r--lang/python/patches/140-do-not-write-bytes-codes.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/lang/python/patches/140-do-not-write-bytes-codes.patch b/lang/python/patches/140-do-not-write-bytes-codes.patch
new file mode 100644
index 000000000..f67e7dcad
--- /dev/null
+++ b/lang/python/patches/140-do-not-write-bytes-codes.patch
@@ -0,0 +1,22 @@
+diff --git a/Python/pythonrun.c b/Python/pythonrun.c
+index 748a63b..cb6e291 100644
+--- a/Python/pythonrun.c
++++ b/Python/pythonrun.c
+@@ -79,7 +79,7 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
+ int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
+ int Py_NoSiteFlag; /* Suppress 'import site' */
+ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
+-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
++int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
+ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
+ int Py_FrozenFlag; /* Needed by getpath.c */
+ int Py_UnicodeFlag = 0; /* Needed by compile.c */
+@@ -174,7 +174,7 @@ Py_InitializeEx(int install_sigs)
+ if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
+ Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
+ if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
+- Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
++ Py_DontWriteBytecodeFlag = atoi(p);
+ /* The variable is only tested for existence here; _PyRandom_Init will
+ check its value further. */
+ if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')