[Python-Dev] disable writing .py[co]
Skip Montanaro
skip@pobox.com
Tue, 21 Jan 2003 09:01:25 -0600
>> All that happens is that when you go to read or write a .pyc file is
>> that you prepend PYCROOT to the full path to the .py source file in
>> addition to adding a 'c' to the end.
Thomas> Wouldn't that place all the (incompatible) pyc files in the same
Thomas> directory?
Nope. If PYCROOT was set to /tmp and found the socket module in
/usr/lib/python2.3/socket.py, the corresponding .pyc file would be
/tmp/usr/lib/python2.3/socket.pyc.
>> * it's not obvious (to me) what the semantics should be on multi-root
>> systems like Windows (I can see a couple alternatives).
Thomas> I cannot understand this sentence. What do you mean?
On Windows, the current working directory exists on each drive. If I set
PYCROOT to C:\TEMP and locate socket.py in D:\PYTHON23\socket.py, what
should the full path to the .pyc file be? What if I set it to simply \TEMP
(omitting a drive letter)? I won't elaborate all the possibilities, because
I will probably forget some reasonable options, however, maybe the most
straightforward approach would be to do like Cygwin does. Force PYCROOT to
refer to a single directory (tie down the drive letter, even if omitted) and
treat the drive letter in module file paths as a directory component. Given
PYCROOT of C:\TEMP and socket.py on D: as above, the .pyc file might
reasonably be C:\TEMP\D\PYTHON23\socket.pyc.
Skip