os.realname variable for correct USER_SITE value (#410)

In site.py, Python uses os.name to decide where the USER_SITE (ie the
folder containing the user's locally installed packages) is located.
With cosmo we have set os.name as "posix" always, so we use a new
os.realname to decide the USER_SITE location.
This commit is contained in:
Gautham 2022-05-20 20:47:10 +05:30 committed by GitHub
parent c8a2f04058
commit fb4382e9a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -42,6 +42,7 @@ def _get_exports_list(module):
name = 'posix'
linesep = '\n'
realname = "nt" if cosmo.kernel == "nt" else "posix"
from posix import *
from posix import _exit
__all__.append('_exit')

View file

@ -240,7 +240,7 @@ def _getuserbase():
def joinuser(*args):
return os.path.expanduser(os.path.join(*args))
if os.name == "nt":
if os.realname == "nt":
base = os.environ.get("APPDATA") or "~"
if env_base:
return env_base
@ -298,7 +298,7 @@ def getusersitepackages():
"posix_user":'{userbase}/lib/python3.6/site-packages',
"nt_user": "{userbase}/Python36/site-packages",
}
USER_SITE = purelib_map.get('%s_user' % os.name).format(userbase=user_base)
USER_SITE = purelib_map.get('%s_user' % os.realname).format(userbase=user_base)
return USER_SITE
def addusersitepackages(known_paths):