Commits

Philip Jenvey  committed 7eafa29 Merge

merge default

  • Participants
  • Parent commits b706343, da3975c
  • Branches py3k

Comments (0)

Files changed (3)

File pypy/module/posix/test/test_posix2.py

         if sys.platform != "win32":
             assert not posix.access(pdir, posix.X_OK)
 
-
     def test_times(self):
         """
         posix.times() should return a five-tuple giving float-representations
             res = os.system(cmd)
             assert res == 0
 
+
 class AppTestPosixUnicode:
-
     def setup_class(cls):
         cls.space = space
         cls.w_posix = space.appexec([], GET_POSIX)
         except OSError:
             pass
 
+
 class AppTestUnicodeFilename:
     def setup_class(cls):
         ufilename = (unicode(udir.join('test_unicode_filename_')) +

File pypy/module/sys/initpath.py

 from pypy.interpreter.gateway import unwrap_spec
 from pypy.module.sys.state import get as get_state
 
-IS_WINDOWS = sys.platform == 'win32'
+PLATFORM = sys.platform
+_MACOSX = sys.platform == 'darwin'
+_WIN32 = 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 ''.
     """
-    if (we_are_translated() and IS_WINDOWS and
+    if (we_are_translated() and _WIN32 and
         not executable.lower().endswith('.exe')):
         executable += '.exe'
-    if os.sep in executable or (IS_WINDOWS and ':' in executable):
+    if os.sep in executable or (_WIN32 and ':' in executable):
         # the path is already more than just an executable name
         pass
     else:
 
 
 def _readlink_maybe(filename):
-    if not IS_WINDOWS:
+    if not _WIN32:
         return os.readlink(filename)
     raise NotImplementedError
 
     importlist.append(lib_tk)
 
     # List here the extra platform-specific paths.
-    if not IS_WINDOWS:
-        importlist.append(os.path.join(python_std_lib, 'plat-' + sys.platform))
-    if sys.platform == 'darwin':
+    if not _WIN32:
+        importlist.append(os.path.join(python_std_lib, 'plat-' + PLATFORM))
+    if _MACOSX:
         platmac = os.path.join(python_std_lib, 'plat-mac')
         importlist.append(platmac)
         importlist.append(os.path.join(platmac, 'lib-scriptpackages'))
     path, prefix = find_stdlib(get_state(space), executable)
     if path is None:
         return space.w_None
-    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))
+    w_prefix = space.wrap(prefix)
+    space.setitem(space.sys.w_dict, space.wrap('prefix'), w_prefix)
+    space.setitem(space.sys.w_dict, space.wrap('exec_prefix'), w_prefix)
     return space.newlist([space.wrap(p) for p in path])

File pypy/module/sys/test/test_initpath.py

     assert find_executable('pypy') == a.join('pypy')
     #
     monkeypatch.setattr(initpath, 'we_are_translated', lambda: True)
-    monkeypatch.setattr(initpath, 'IS_WINDOWS', True)
+    monkeypatch.setattr(initpath, '_WIN32', True)
     monkeypatch.setenv('PATH', str(a))
     a.join('pypy.exe').ensure(file=True)
     assert find_executable('pypy') == a.join('pypy.exe')