@@ -266,8 +266,8 @@ def _getuserbase():
266266 if env_base :
267267 return env_base
268268
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" } :
271271 return None
272272
273273 def joinuser (* args ):
@@ -361,22 +361,19 @@ def getsitepackages(prefixes=None):
361361 continue
362362 seen .add (prefix )
363363
364- libdirs = [sys .platlibdir ]
365- if sys .platlibdir != "lib" :
366- libdirs .append ("lib" )
367-
368364 if os .sep == '/' :
365+ libdirs = [sys .platlibdir ]
366+ if sys .platlibdir != "lib" :
367+ libdirs .append ("lib" )
368+
369369 for libdir in libdirs :
370370 path = os .path .join (prefix , libdir ,
371371 "python%d.%d" % sys .version_info [:2 ],
372372 "site-packages" )
373373 sitepackages .append (path )
374374 else :
375375 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" ))
380377 return sitepackages
381378
382379def addsitepackages (known_paths , prefixes = None ):
@@ -418,8 +415,10 @@ def setcopyright():
418415 files , dirs = [], []
419416 # Not all modules are required to have a __file__ attribute. See
420417 # 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__' ):
422420 here = os .path .dirname (os .__file__ )
421+ if here :
423422 files .extend (["LICENSE.txt" , "LICENSE" ])
424423 dirs .extend ([os .path .join (here , os .pardir ), here , os .curdir ])
425424 builtins .license = _sitebuiltins ._Printer (
0 commit comments