[pypy-issue] [issue1572] py3k: import site-packages at startup

Renaud Blanch tracker at bugs.pypy.org
Thu Aug 1 15:44:52 CEST 2013


Renaud Blanch <rndblnch at gmail.com> added the comment:

in fact the fact that site.USER_SITE does not exist does not seem to be the problem.
with cpython and pypy2 I get:


    [esperluet:~] blanch% pypy -m site
    sys.path = [
        '/Users/blanch',
        '/Users/Shared/src/pypy-2.0.1/lib_pypy/__extensions__',
        '/Users/Shared/src/pypy-2.0.1/lib_pypy',
        '/Users/Shared/src/pypy-2.0.1/lib-python/2.7',
        '/Users/Shared/src/pypy-2.0.1/lib-python/2.7/lib-tk',
        '/Users/Shared/src/pypy-2.0.1/lib-python/2.7/plat-darwin',
        '/Users/Shared/src/pypy-2.0.1/lib-python/2.7/plat-mac',
        '/Users/Shared/src/pypy-2.0.1/lib-python/2.7/plat-mac/lib-scriptpackages',
        '/Users/Shared/src/pypy-2.0.1/site-packages',
    ]
    USER_BASE: '/Users/blanch/.local' (doesn't exist)
    USER_SITE: '/Users/blanch/.local/lib/python2.7/site-packages' (doesn't exist)
    ENABLE_USER_SITE: True

and with pypy3:


    [esperluet:~] blanch% pypy3 -m site
    sys.path = [
        '/Users/blanch',
        '/Users/Shared/src/pypy3-2.1-beta1-osx64/lib_pypy/__extensions__',
        '/Users/Shared/src/pypy3-2.1-beta1-osx64/lib_pypy',
        '/Users/Shared/src/pypy3-2.1-beta1-osx64/lib-python/3',
        '/Users/Shared/src/pypy3-2.1-beta1-osx64/lib-python/3/lib-tk',
        '/Users/Shared/src/pypy3-2.1-beta1-osx64/lib-python/3/plat-darwin',
        '/Users/Shared/src/pypy3-2.1-beta1-osx64/lib-python/3/plat-mac',
        '/Users/Shared/src/pypy3-2.1-beta1-osx64/lib-python/3/plat-mac/lib-scriptpackages',
    ]
    USER_BASE: '/Users/blanch/.local' (doesn't exist)
    USER_SITE: '/Users/blanch/.local/lib/python3.2/site-packages' (doesn't exist)
    ENABLE_USER_SITE: True

so the only difference is in site-pacakges being not included in sys.path...

i guess the pypy specific logic that has been removed from site.py in pypy3 (see below) has something to do with this regression:


    [esperluet:/Users/Shared/src] blanch% diff -ru pypy-2.0.1/lib-python/2.7/site.py pypy3-2.1-beta1-osx64/lib-python/3/site.py 
    --- pypy-2.0.1/lib-python/2.7/site.py	2013-04-21 20:25:13.000000000 +0200
    +++ pypy3-2.1-beta1-osx64/lib-python/3/site.py	2013-07-30 09:02:26.000000000 +0200

    [skipped]

    @@ -292,7 +274,6 @@
         will find its `site-packages` subdirectory depending on the system
         environment, and will return a list of full paths.
         """
    -    is_pypy = '__pypy__' in sys.builtin_module_names
         sitepackages = []
         seen = set()
     
    @@ -303,10 +284,6 @@
     
             if sys.platform in ('os2emx', 'riscos'):
                 sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
    -        elif is_pypy:
    -            from distutils.sysconfig import get_python_lib
    -            sitedir = get_python_lib(standard_lib=False, prefix=prefix)
    -            sitepackages.append(sitedir)
             elif os.sep == '/':
                 sitepackages.append(os.path.join(prefix, "lib",
                                             "python" + sys.version[:3],

----------
status: unread -> chatting

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1572>
________________________________________


More information about the pypy-issue mailing list