Commits

Philip Jenvey committed 0ad8f52

issue1572: fix site-packages missing in sys.path and bring over some other
site.py customizations from default

Comments (0)

Files changed (1)

 import builtins
 import traceback
 
+is_pypy = '__pypy__' in sys.builtin_module_names
+
 # Prefixes for site-packages; add additional prefixes like /usr/local here
 PREFIXES = [sys.prefix, sys.exec_prefix]
 # Enable per user site-packages directory
 
         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
+            sitepackages.append(get_python_lib(standard_lib=False,
+                                               prefix=prefix))
         elif os.sep == '/':
             sitepackages.append(os.path.join(prefix, "lib",
                                         "python" + sys.version[:3],
 
 def setcopyright():
     """Set 'copyright' and 'credits' in builtins"""
+    licenseargs = None
+    if is_pypy:
+        credits = "PyPy is maintained by the PyPy developers: http://pypy.org/"
+        license = "See https://bitbucket.org/pypy/pypy/src/default/LICENSE"
+        licenseargs = (license,)
+    elif sys.platform[:4] == 'java':
+        credits = ("Jython is maintained by the Jython developers "
+                   "(www.jython.org).")
+    else:
+        credits = """\
+    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
+    for supporting Python development.  See www.python.org for more information."""
+
     builtins.copyright = _Printer("copyright", sys.copyright)
-    if sys.platform[:4] == 'java':
-        builtins.credits = _Printer(
-            "credits",
-            "Jython is maintained by the Jython developers (www.jython.org).")
-    else:
-        builtins.credits = _Printer("credits", """\
-    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
-    for supporting Python development.  See www.python.org for more information.""")
-    here = os.path.dirname(os.__file__)
-    builtins.license = _Printer(
-        "license", "See http://www.python.org/%.3s/license.html" % sys.version,
-        ["LICENSE.txt", "LICENSE"],
-        [os.path.join(here, os.pardir), here, os.curdir])
+    builtins.credits = _Printer("credits", credits)
+    if licenseargs is None:
+        here = os.path.dirname(os.__file__)
+        license = "See http://www.python.org/%.3s/license.html" % sys.version
+        licenseargs = (license, ["LICENSE.txt", "LICENSE"],
+                       [os.path.join(here, os.pardir), here, os.curdir])
+    builtins.license = _Printer("license", *licenseargs)
 
 
 class _Helper(object):