Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r61038:88ba0bad7688
Date: 2013-02-10 07:35 -0500
http://bitbucket.org/pypy/pypy/changeset/88ba0bad7688/

Log:    small cleanups

diff --git a/pypy/interpreter/test2/test_app_main.py 
b/pypy/interpreter/test2/test_app_main.py
--- a/pypy/interpreter/test2/test_app_main.py
+++ b/pypy/interpreter/test2/test_app_main.py
@@ -907,8 +907,8 @@
         try:
             import app_main
             app_main.setup_bootstrap_path('/tmp/pypy-c') # stdlib not found
+            assert sys.executable == ''
             assert sys.path[:-1] == old_sys_path
-            assert sys.executable == ''
 
             app_main.setup_bootstrap_path(self.fake_exe)
             assert sys.executable == self.fake_exe
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
@@ -32,15 +32,14 @@
                     executable = fn
                     break
     executable = rpath.rabspath(executable)
-    #
+
     # '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
 
-
-def readlink_maybe(filename):
+def _readlink_maybe(filename):
     if not IS_WINDOWS:
         return os.readlink(filename)
     raise NotImplementedError
@@ -53,7 +52,7 @@
     dirname = rpath.rabspath(os.path.join(filename, '..'))
     if os.path.islink(filename):
         try:
-            link = readlink_maybe(filename)
+            link = _readlink_maybe(filename)
         except OSError:
             pass
         else:
@@ -78,9 +77,7 @@
             return newpath, dirname
         search = dirname    # walk to the parent directory
 
-
-
-def checkdir(path):
+def _checkdir(path):
     st = os.stat(path)
     if not stat.S_ISDIR(st[0]):
         raise OSError(errno.ENOTDIR, path)
@@ -96,24 +93,24 @@
                          CPYTHON_VERSION[1])
     lib_python = os.path.join(prefix, 'lib-python')
     python_std_lib = os.path.join(lib_python, dirname)
-    checkdir(python_std_lib)
-    
+    _checkdir(python_std_lib)
+
     lib_pypy = os.path.join(prefix, 'lib_pypy')
-    checkdir(lib_pypy)
+    _checkdir(lib_pypy)
 
     importlist = []
-    #
+
     if state is not None:    # 'None' for testing only
         lib_extensions = os.path.join(lib_pypy, '__extensions__')
         state.w_lib_extensions = state.space.wrap(lib_extensions)
         importlist.append(lib_extensions)
-    #
+
     importlist.append(lib_pypy)
     importlist.append(python_std_lib)
-    #
+
     lib_tk = os.path.join(python_std_lib, 'lib-tk')
     importlist.append(lib_tk)
-    #
+
     # List here the extra platform-specific paths.
     if platform != 'win32':
         importlist.append(os.path.join(python_std_lib, 'plat-'+platform))
@@ -121,7 +118,7 @@
         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):
diff --git a/pypy/module/sys/test/test_initpath.py 
b/pypy/module/sys/test/test_initpath.py
--- a/pypy/module/sys/test/test_initpath.py
+++ b/pypy/module/sys/test/test_initpath.py
@@ -27,7 +27,6 @@
     path, prefix = find_stdlib(None, str(pypy_sym))
     assert prefix == pypydir
 
-
 def test_compute_stdlib_path(tmpdir):
     dirs = build_hierarchy(tmpdir)
     path = compute_stdlib_path(None, str(tmpdir))
@@ -40,7 +39,6 @@
     path = compute_stdlib_path(None, str(tmpdir))
     assert lib_tk in path
 
-
 def test_find_executable(tmpdir, monkeypatch):
     from pypy.module.sys import initpath
     tmpdir = py.path.local(os.path.realpath(str(tmpdir)))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to