bpo-31904: Fix site and sysconfig modules for VxWorks RTOS #21821
Conversation
c7f2c40 to
2888670
Compare
December 2, 2020 06:45
vstinner
left a comment
There was a problem hiding this comment.
What does os.path.expanduser('~') return on VxWorks?
Instead of changing sysconfig and site, maybe posixpath.expanduser() could get a special case to return sys.prefix?
Sorry, something went wrong.
It depends on whether user management feature is enabled or not on VxWorks. By default this feature is disabled. And expanduser() will encounter KeyError then returning the unchanged path. If user management feature is enabled, the pw_dir attribute will be None so that expanduser() will raise exception. So I created PR 23530 to fix this.
Looks sys.prefix is for system-wide settings whereas the return value of |
Sorry, something went wrong.
eccff0c to
795f0e4
Compare
December 7, 2020 10:49
vstinner
left a comment
There was a problem hiding this comment.
LGTM, this change looks reasonable.
The relationship between ENABLE_USER_SITE=False and (USER_SITE=None, USER_BASE=None) may be enhanced to make the code even more generic, but I don't see how it should be done. I'm fine with the current code. Also, sysconfig._getuserbase() doesn't have ENABLE_USER_SITE, so it's ok to use None as a marker "there is no user directory".
Sorry, something went wrong.
|
The second version of the PR is way better, thanks for the update. |
Sorry, something went wrong.
VxWorks RTOS has no home directory for users. Sure it can't recognize the "~" directory. sys.prefix is always set as "/usr" on VxWorks. So for site and sysconfig module, we just simply set the user base as sys.prefix for users. And user site packages path will be sys.prefix/lib/pythonX.Y/site-packages
https://bugs.python.org/issue31904