On Samstag, 18. Februar 2017 00:04:36 CET Ferdinand Thiessen wrote:
On 17.02.2017 23:48, Stefan Bruens wrote:
Ever wondered what happens if there *are* pyc bytecode files? Python *stats* the python source file, looks for a corresponding bytecode file in the (python2: source; python3: __pycache__) directory, reads the bytecode file header, compares the header timestamp with the change time from the earlier stat call, and executes the byte code. The contents of the source file are *not* read at all.
"Executes it"
It has be said that it gets executed only in the python virtual machine as it is not x86 bytecode. And then you have to know which python interpreter you use, there are more than one.
You *either* execute CPython 2 or 3, Jython or whatever by its name, depending on the $PATH, *or* you have the interpreter path specified in the toplevel script. At this point, the interpreter is fixed.
At least I know CPython (the "default" one), Jython (uses the JVM), PyPy and then there are several other programs that are using python for scripting (some of them also are loading python libraries from system, so they would have been patched to work with pyc code).
Currently we ship bytecode for every supported Python interpreter (for Tumbleweed, that is CPython 2.7 and CPython 3.5), accompanied *each time* by the source code. *If* the bytecode is available, the sources are *not* read. Your concern applies to the current situation already - can you tell me which files will be sourced by the current trivial script? --- #! /usr/bin/env python from time import sleep sleep(1) ---
But is there one good point for dropping the python sources? Of cause you can save some space, but that would be about some MiB (on my system 24MiB), but which system does not have enough space to for that?
As I already said, there are small devices, like Raspberry Pi, there are containers. It also saves download bandwidth on both the mirrors as the users machine. Regards, Stefan -- Stefan Brüns / Bergstraße 21 / 52062 Aachen home: +49 241 53809034 mobile: +49 151 50412019 work: +49 2405 49936-424 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org