I tried to build CPython out of the source tree with a customized read-only source tree (chmod -R -w). I got an error when running tests: tests want to write into a build/ directory... in the source tree. Attached patch fixes this issue.
Ah, there is one and only one failing test: ====================================================================== ERROR: test_synopsis_sourceless (test.test_pydoc.PydocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/haypo/prog/python/ro.master/Lib/test/test_pydoc.py", line 586, in test_synopsis_sourceless synopsis = pydoc.synopsis(filename) File "/home/haypo/prog/python/ro.master/Lib/pydoc.py", line 253, in synopsis mtime = os.stat(filename).st_mtime FileNotFoundError: [Errno 2] No such file or directory: '/home/haypo/prog/python/ro.master/Lib/__pycache__/os.cpython-37.pyc'
I don't think that the test_pydoc failure is very important. I'm not interested to fix it right now. The main blocker issue was regrtest and it's now fixed in the master branch. I don't recall any user complaining about issues with read-only source tree, so I don't think that it's worth it to backport the fix. If I'm wrong, please comment the issue ;-)