ClimenteA/pyvan

Bug: absolute/relative paths in python*._pth

Closed this issue · 0 comments

Some changes to the codebase have led to adding absolute instead of relative paths to the python*._pth file, e.g.:

D:\workspace\pyvan\examples\cliapp\dist\pydist\python39.zip
.

# Uncomment to run site.main() automatically
import site

instead of:

python39.zip
.

# Uncomment to run site.main() automatically
import site

This should be fixed otherwise after moving/distributing the generated stand-alone distribution will fail to find the embedded python standard libraries and yield the following error:

Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

I am working on a fix right now!

Relative path to sources in python*._pth

Also, I like to use this opportunity to set the relative path correctly to the source folder if e.g.: --source-sub-dir and --pydist-sub-dir are set:

So if pydist_sub_dir="pydist" and source_sub_dir="code":

. -> ..\code

if pydist_sub_dir="pydist" and source_sub_dir="":

. -> ..

if pydist_sub_dir="" and source_sub_dir="code":

. -> .\code

if pydist_sub_dir="" and source_sub_dir="":

. -> .