Author: Philip Jenvey <pjen...@underboss.org>
Branch: 
Changeset: r70506:da3975c63a3e
Date: 2014-04-09 11:52 -0700
http://bitbucket.org/pypy/pypy/changeset/da3975c63a3e/

Log:    fix translation

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
@@ -13,7 +13,9 @@
 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):
@@ -21,10 +23,10 @@
     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:
@@ -43,7 +45,7 @@
 
 
 def _readlink_maybe(filename):
-    if not IS_WINDOWS:
+    if not _WIN32:
         return os.readlink(filename)
     raise NotImplementedError
 
@@ -116,9 +118,9 @@
     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'))
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
@@ -84,7 +84,7 @@
     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')
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to