[pypy-commit] pypy py3k: merge default

pjenvey noreply at buildbot.pypy.org
Wed Apr 9 20:33:26 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r70502:b7063430977e
Date: 2014-04-09 11:32 -0700
http://bitbucket.org/pypy/pypy/changeset/b7063430977e/

Log:	merge default

diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst
--- a/pypy/doc/faq.rst
+++ b/pypy/doc/faq.rst
@@ -459,6 +459,19 @@
 
 .. _`getting-started`: getting-started-python.html
 
+------------------------------------------
+Compiling PyPy swaps or runs out of memory
+------------------------------------------
+
+This is documented (here__ and here__).  It needs 4 GB of RAM to run
+"rpython targetpypystandalone" on top of PyPy, a bit more when running
+on CPython.  If you have less than 4 GB it will just swap forever (or
+fail if you don't have enough swap).  On 32-bit, divide the numbers by
+two.
+
+.. __: http://pypy.org/download.html#building-from-source
+.. __: https://pypy.readthedocs.org/en/latest/getting-started-python.html#translating-the-pypy-python-interpreter
+
 .. _`how do I compile my own interpreters`:
 
 -------------------------------------
diff --git a/pypy/doc/stm.rst b/pypy/doc/stm.rst
--- a/pypy/doc/stm.rst
+++ b/pypy/doc/stm.rst
@@ -15,11 +15,11 @@
 user, describes work in progress, and finally gives references to more
 implementation details.
 
-This work was done by Remi Meier and Armin Rigo.  Thanks to all donors
-for crowd-funding the work so far!  Please have a look at the 2nd call
-for donation (*not ready yet*)
+This work was done mostly by Remi Meier and Armin Rigo.  Thanks to all
+donors for crowd-funding the work so far!  Please have a look at the
+`2nd call for donation`_.
 
-.. .. _`2nd call for donation`: http://pypy.org/tmdonate2.html
+.. _`2nd call for donation`: http://pypy.org/tmdonate2.html
 
 
 Introduction
diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py
--- a/pypy/module/sys/initpath.py
+++ b/pypy/module/sys/initpath.py
@@ -2,27 +2,31 @@
 Logic to find sys.executable and the initial sys.path containing the stdlib
 """
 
-import sys
+import errno
 import os
 import stat
-import errno
+import sys
+
 from rpython.rlib import rpath
 from rpython.rlib.objectmodel import we_are_translated
+
 from pypy.interpreter.gateway import unwrap_spec
 from pypy.module.sys.state import get as get_state
 
-platform = sys.platform
 IS_WINDOWS = sys.platform == 'win32'
 
+
 def find_executable(executable):
     """
-    Return the absolute path of the executable, by looking into PATH and the
-    current directory.  If it cannot be found, return ''.
+    Return the absolute path of the executable, by looking into PATH and
+    the current directory.  If it cannot be found, return ''.
     """
-    if we_are_translated() and IS_WINDOWS and not executable.lower().endswith('.exe'):
+    if (we_are_translated() and IS_WINDOWS and
+        not executable.lower().endswith('.exe')):
         executable += '.exe'
     if os.sep in executable or (IS_WINDOWS and ':' in executable):
-        pass    # the path is already more than just an executable name
+        # the path is already more than just an executable name
+        pass
     else:
         path = os.environ.get('PATH')
         if path:
@@ -35,15 +39,15 @@
 
     # 'sys.executable' should not end up being an non-existing file;
     # just use '' in this case. (CPython issue #7774)
-    if not os.path.isfile(executable):
-        executable = ''
-    return executable
+    return executable if os.path.isfile(executable) else ''
+
 
 def _readlink_maybe(filename):
     if not IS_WINDOWS:
         return os.readlink(filename)
     raise NotImplementedError
 
+
 def resolvedirof(filename):
     filename = rpath.rabspath(filename)
     dirname = rpath.rabspath(os.path.join(filename, '..'))
@@ -56,36 +60,37 @@
             return resolvedirof(os.path.join(dirname, link))
     return dirname
 
+
 def find_stdlib(state, executable):
     """
     Find and compute the stdlib path, starting from the directory where
-    ``executable`` is and going one level up until we find it.  Return a tuple
-    (path, prefix), where ``prefix`` is the root directory which contains the
-    stdlib.
-    If it cannot be found, return (None, None).
+    ``executable`` is and going one level up until we find it.  Return a
+    tuple (path, prefix), where ``prefix`` is the root directory which
+    contains the stdlib.  If it cannot be found, return (None, None).
     """
-    if executable == '':
-        executable = 'pypy-c'
-    search = executable
+    search = 'pypy-c' if executable == '' else executable
     while True:
         dirname = resolvedirof(search)
         if dirname == search:
-            return None, None # not found :-(
+            return None, None  # not found :-(
         newpath = compute_stdlib_path_maybe(state, dirname)
         if newpath is not None:
             return newpath, dirname
         search = dirname    # walk to the parent directory
 
+
 def _checkdir(path):
     st = os.stat(path)
     if not stat.S_ISDIR(st[0]):
         raise OSError(errno.ENOTDIR, path)
 
+
 def compute_stdlib_path(state, prefix):
     """
-    Compute the paths for the stdlib rooted at ``prefix``. ``prefix`` must at
-    least contain a directory called ``lib-python/X.Y`` and another one called
-    ``lib_pypy``. If they cannot be found, it raises OSError.
+    Compute the paths for the stdlib rooted at ``prefix``. ``prefix``
+    must at least contain a directory called ``lib-python/X.Y`` and
+    another one called ``lib_pypy``. If they cannot be found, it raises
+    OSError.
     """
     from pypy.module.sys.version import CPYTHON_VERSION
     dirname = '%d' % CPYTHON_VERSION[0]
@@ -110,41 +115,42 @@
     importlist.append(lib_tk)
 
     # List here the extra platform-specific paths.
-    if platform != 'win32':
-        importlist.append(os.path.join(python_std_lib, 'plat-'+platform))
-    if platform == 'darwin':
+    if not IS_WINDOWS:
+        importlist.append(os.path.join(python_std_lib, 'plat-' + sys.platform))
+    if sys.platform == 'darwin':
         platmac = os.path.join(python_std_lib, 'plat-mac')
         importlist.append(platmac)
         importlist.append(os.path.join(platmac, 'lib-scriptpackages'))
 
     return importlist
 
+
 def compute_stdlib_path_maybe(state, prefix):
-    """
-    Return the stdlib path rooted at ``prefix``, or None if it cannot be
-    found.
+    """Return the stdlib path rooted at ``prefix``, or None if it cannot
+    be found.
     """
     try:
         return compute_stdlib_path(state, prefix)
     except OSError:
         return None
 
+
 @unwrap_spec(executable='str0')
 def pypy_find_executable(space, executable):
     return space.wrap(find_executable(executable))
 
+
 @unwrap_spec(filename='str0')
 def pypy_resolvedirof(space, filename):
     return space.wrap(resolvedirof(filename))
 
+
 @unwrap_spec(executable='str0')
 def pypy_find_stdlib(space, executable):
     path, prefix = find_stdlib(get_state(space), executable)
     if path is None:
         return space.w_None
-    else:
-        space.setitem(space.sys.w_dict, space.wrap('prefix'),
-                                        space.wrap(prefix))
-        space.setitem(space.sys.w_dict, space.wrap('exec_prefix'),
-                                        space.wrap(prefix))
-        return space.newlist([space.wrap(p) for p in path])
+    space.setitem(space.sys.w_dict, space.wrap('prefix'), space.wrap(prefix))
+    space.setitem(space.sys.w_dict, space.wrap('exec_prefix'),
+                  space.wrap(prefix))
+    return space.newlist([space.wrap(p) for p in path])


More information about the pypy-commit mailing list