mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 07:29:23 +00:00
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:
parent
c8a2f04058
commit
fb4382e9a4
2 changed files with 3 additions and 2 deletions
1
third_party/python/Lib/os.py
vendored
1
third_party/python/Lib/os.py
vendored
|
@ -42,6 +42,7 @@ def _get_exports_list(module):
|
||||||
|
|
||||||
name = 'posix'
|
name = 'posix'
|
||||||
linesep = '\n'
|
linesep = '\n'
|
||||||
|
realname = "nt" if cosmo.kernel == "nt" else "posix"
|
||||||
from posix import *
|
from posix import *
|
||||||
from posix import _exit
|
from posix import _exit
|
||||||
__all__.append('_exit')
|
__all__.append('_exit')
|
||||||
|
|
4
third_party/python/Lib/site.py
vendored
4
third_party/python/Lib/site.py
vendored
|
@ -240,7 +240,7 @@ def _getuserbase():
|
||||||
def joinuser(*args):
|
def joinuser(*args):
|
||||||
return os.path.expanduser(os.path.join(*args))
|
return os.path.expanduser(os.path.join(*args))
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.realname == "nt":
|
||||||
base = os.environ.get("APPDATA") or "~"
|
base = os.environ.get("APPDATA") or "~"
|
||||||
if env_base:
|
if env_base:
|
||||||
return env_base
|
return env_base
|
||||||
|
@ -298,7 +298,7 @@ def getusersitepackages():
|
||||||
"posix_user":'{userbase}/lib/python3.6/site-packages',
|
"posix_user":'{userbase}/lib/python3.6/site-packages',
|
||||||
"nt_user": "{userbase}/Python36/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
|
return USER_SITE
|
||||||
|
|
||||||
def addusersitepackages(known_paths):
|
def addusersitepackages(known_paths):
|
||||||
|
|
Loading…
Add table
Reference in a new issue