[OpenWrt-Devel] [PATCH] /etc/profile: add 'export PYTHONDONTWRITEBYTECODE=1'

Alexandru Ardelean ardeleanalex at gmail.com
Wed Nov 12 15:08:00 EST 2014


Tells Python not to compile the source files.

The default behaviour is for the sources to be compiled
when the sources are run.

On small disks this can fill them up.

Although the performance of Python will suffer (it's not fast
to begin with) it's better to for it to be slow than to fill up
the disk and cause the target to be stuck.

Users can disable this at their own risk/expense/will/etc.

This works on both python and python3.

Signed-off-by: Alexandru Ardelean <ardeleanalex at gmail.com>
---
 package/base-files/files/etc/profile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
index 3dd58e1..2655bea 100644
--- a/package/base-files/files/etc/profile
+++ b/package/base-files/files/etc/profile
@@ -6,6 +6,7 @@ export PATH=/usr/bin:/usr/sbin:/bin:/sbin
 export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
 export HOME=${HOME:-/root}
 export PS1='\u@\h:\w\$ '
+export PYTHONDONTWRITEBYTECODE=1
 
 [ -x /bin/more ] || alias more=less
 [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
@@ -14,3 +15,4 @@ export PS1='\u@\h:\w\$ '
 
 [ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
 [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list