[pypy-svn] pypy default: manually apply the same modifications done in modified-2.5.2/site.py
antocuni
commits-noreply at bitbucket.org
Wed Jan 19 08:49:51 CET 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r40922:f2b7c179fc32
Date: 2011-01-18 21:22 +0100
http://bitbucket.org/pypy/pypy/changeset/f2b7c179fc32/
Log: manually apply the same modifications done in modified-2.5.2/site.py
diff --git a/lib-python/modified-2.7.0/site.py b/lib-python/modified-2.7.0/site.py
--- a/lib-python/modified-2.7.0/site.py
+++ b/lib-python/modified-2.7.0/site.py
@@ -74,7 +74,6 @@
USER_SITE = None
USER_BASE = None
-
def makepath(*paths):
dir = os.path.join(*paths)
try:
@@ -90,7 +89,10 @@
if hasattr(m, '__loader__'):
continue # don't mess with a PEP 302-supplied __file__
try:
- m.__file__ = os.path.abspath(m.__file__)
+ prev = m.__file__
+ new = os.path.abspath(m.__file__)
+ if prev != new:
+ m.__file__ = new
except (AttributeError, OSError):
pass
@@ -279,6 +281,12 @@
will find its `site-packages` subdirectory depending on the system
environment, and will return a list of full paths.
"""
+ # pypy specific logic
+ if hasattr(sys, 'pypy_version_info') and hasattr(sys, 'prefix'):
+ from distutils.sysconfig import get_python_lib
+ sitedir = get_python_lib(standard_lib=False)
+
+ # cpython logic
sitepackages = []
seen = set()
@@ -425,22 +433,33 @@
if key == 'q':
break
+##def setcopyright():
+## """Set 'copyright' and 'credits' in __builtin__"""
+## __builtin__.copyright = _Printer("copyright", sys.copyright)
+## if sys.platform[:4] == 'java':
+## __builtin__.credits = _Printer(
+## "credits",
+## "Jython is maintained by the Jython developers (www.jython.org).")
+## else:
+## __builtin__.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__)
+## __builtin__.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])
+
def setcopyright():
- """Set 'copyright' and 'credits' in __builtin__"""
+ # XXX this is the PyPy-specific version. Should be unified with the above.
__builtin__.copyright = _Printer("copyright", sys.copyright)
- if sys.platform[:4] == 'java':
- __builtin__.credits = _Printer(
- "credits",
- "Jython is maintained by the Jython developers (www.jython.org).")
- else:
- __builtin__.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__)
+ __builtin__.credits = _Printer(
+ "credits",
+ "PyPy is maintained by the PyPy developers: http://codespeak.net/pypy")
__builtin__.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])
+ "license",
+ "See http://codespeak.net/svn/pypy/dist/LICENSE")
+
class _Helper(object):
@@ -466,7 +485,7 @@
if sys.platform == 'win32':
import locale, codecs
enc = locale.getdefaultlocale()[1]
- if enc.startswith('cp'): # "cp***" ?
+ if enc is not None and enc.startswith('cp'): # "cp***" ?
try:
codecs.lookup(enc)
except LookupError:
More information about the Pypy-commit
mailing list