On 4 December 2015 at 00:22, Giuseppe Scrivano <gscri...@redhat.com> wrote: > Daniel J Walsh <dwa...@redhat.com> writes: >> Will this work on an SELinux system? Will python attempt to create the >> pyc files, when the code is executed? >> SELinux would stop a confined domain from writing to /usr of course, but >> might generate AVC's. If the file system >> is read/only then it would be a matter of whether the SELinux checks >> happen first or second. > > that should not be an issue, the .pyo files will be renamed to .pyc so > Python will see the same set of files as now.
You probably want to hard link them, rather than renaming them, as the kinds of precompiled bytecode files Python will try to load will vary based on the runtime optimisation level: Up to and including Python 3.4, that's: None: *.pyc -O: *.pyo -OO: *.pyo For Python 3.5+, the extension in __pycache__ is always *.pyc, with the optimisation level included in the filename: None: *.pyc -O: *.opt-1.pyc -OO: *.opt-2.pyc The naming scheme was changed in PEP 488 to avoid the problem where using -OO would clobber the cached -O files: https://www.python.org/dev/peps/pep-0488/ Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia