@@ -266,8 +266,8 @@ def _getuserbase():
266
266
if env_base :
267
267
return env_base
268
268
269
- # VxWorks has no home directories
270
- if sys .platform == " vxworks" :
269
+ # Emscripten, VxWorks, and WASI have no home directories
270
+ if sys .platform in { "emscripten" , " vxworks", "wasi" } :
271
271
return None
272
272
273
273
def joinuser (* args ):
@@ -361,22 +361,19 @@ def getsitepackages(prefixes=None):
361
361
continue
362
362
seen .add (prefix )
363
363
364
- libdirs = [sys .platlibdir ]
365
- if sys .platlibdir != "lib" :
366
- libdirs .append ("lib" )
367
-
368
364
if os .sep == '/' :
365
+ libdirs = [sys .platlibdir ]
366
+ if sys .platlibdir != "lib" :
367
+ libdirs .append ("lib" )
368
+
369
369
for libdir in libdirs :
370
370
path = os .path .join (prefix , libdir ,
371
371
"python%d.%d" % sys .version_info [:2 ],
372
372
"site-packages" )
373
373
sitepackages .append (path )
374
374
else :
375
375
sitepackages .append (prefix )
376
-
377
- for libdir in libdirs :
378
- path = os .path .join (prefix , libdir , "site-packages" )
379
- sitepackages .append (path )
376
+ sitepackages .append (os .path .join (prefix , "Lib" , "site-packages" ))
380
377
return sitepackages
381
378
382
379
def addsitepackages (known_paths , prefixes = None ):
@@ -418,8 +415,10 @@ def setcopyright():
418
415
files , dirs = [], []
419
416
# Not all modules are required to have a __file__ attribute. See
420
417
# PEP 420 for more details.
421
- if hasattr (os , '__file__' ):
418
+ here = getattr (sys , '_stdlib_dir' , None )
419
+ if not here and hasattr (os , '__file__' ):
422
420
here = os .path .dirname (os .__file__ )
421
+ if here :
423
422
files .extend (["LICENSE.txt" , "LICENSE" ])
424
423
dirs .extend ([os .path .join (here , os .pardir ), here , os .curdir ])
425
424
builtins .license = _sitebuiltins ._Printer (
0 commit comments