For source file "path/to/file.py" it created file with incorrect path
"/absolute/path/to/path/to/file.pyc" instead of "path/to/file.pyc".
(cherry picked from commit
60ff67d010078eca15a74b1429caf779ac4f9c74)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
:return: The file system path to the legacy pyc file.
"""
pyc_file = importlib.util.cache_from_source(source)
- up_one = os.path.dirname(os.path.abspath(source))
- legacy_pyc = os.path.join(up_one, source + 'c')
+ assert source.endswith('.py')
+ legacy_pyc = source + 'c'
shutil.move(pyc_file, legacy_pyc)
return legacy_pyc